Thread (6 messages) flat view 6 messages, 3 authors, 2020-06-21

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

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2020-06-19 10:26:15
Also in: lkml

Michael Ellerman [off-list ref] 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@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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help