[PATCH 2/2] powerpc/syscalls: Split SPU-ness out of ABI

Michael Ellerman mpe at ellerman.id.au
Fri Jun 19 20:26:05 AEST 2020


Michael Ellerman <mpe at ellerman.id.au> writes:
> Using the ABI field to encode whether a syscall is usable by SPU
> programs or not is a bit of kludge.
>
> The ABI of the syscall doesn't change depending on the SPU-ness, but
> in order to make the syscall generation work we have to pretend that
> it does.
>
> It also means we have more duplicated syscall lines than we need to,
> and the SPU logic is not well contained, instead all of the syscall
> generation targets need to know if they are spu or nospu.
>
> So instead add a separate file which contains the information on which
> syscalls are available for SPU programs. It's just a list of syscall
> numbers with a single "spu" field. If the field has the value "spu"
> then the syscall is available to SPU programs, any other value or no
> entry entirely means the syscall is not available to SPU programs.
>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> ---
>  arch/powerpc/kernel/syscalls/Makefile      |  16 +-
>  arch/powerpc/kernel/syscalls/spu.tbl       | 430 +++++++++++++++++++++
>  arch/powerpc/kernel/syscalls/syscall.tbl   | 195 ++++------
>  arch/powerpc/kernel/syscalls/syscalltbl.sh |  10 +-
>  4 files changed, 523 insertions(+), 128 deletions(-)
>  create mode 100644 arch/powerpc/kernel/syscalls/spu.tbl

For the archives, the changes to the syscall table & the generation of
the spu.tbl can be more-or-less generated with the script below
(ignoring whitespace & comments).

cheers


#!/bin/bash

git checkout v5.8-rc1

table=arch/powerpc/kernel/syscalls/syscall.tbl

for number in {0..439}
do
    line=$(grep -E "^$number\s+(common|spu)" $table)
    if [[ -n "$line" ]]; then
	read number abi name syscall compat <<< "$line"
	if [[ "$syscall" != "sys_ni_syscall" ]]; then
	    if [[ "$name" == "utimesat" ]]; then # fix typo
		name="futimesat"
	    fi
	    echo -e "$number\t$name\tspu"
	    continue
	fi
    fi

    line=$(grep -m 1 -E "^$number\s+" $table)
    read number abi name syscall compat <<< "$line"
    if [[ -n "$name" ]]; then
	echo -e "$number\t$name\t-"
    fi
done > spu-generated.tbl

cat $table | while read line
do
    read number abi name syscall compat <<< "$line"

    if [[ "$number" == "#" ]]; then
	echo $line
	continue
    fi

    case "$abi" in
	"nospu")	;&
	"common")	;&
	"32")		;&
	"64") echo "$line" | sed -e "s/nospu/common/" ;;
    esac
done > syscall-generated.tbl

git cat-file -p 35e32a6cb5f6:$table | diff -w -u - syscall-generated.tbl
git cat-file -p 35e32a6cb5f6:arch/powerpc/kernel/syscalls/spu.tbl | diff -w -u - spu-generated.tbl



More information about the Linuxppc-dev mailing list