LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Cc: linux-arch@ozlabs.org, linux-kernel@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCH 2/2] powerpc/syscalls: Split SPU-ness out of ABI
Date: Fri, 19 Jun 2020 20:26:05 +1000	[thread overview]
Message-ID: <87h7v7cpxe.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20200616135617.2937252-2-mpe@ellerman.id.au>

Michael Ellerman <mpe@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@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


  reply	other threads:[~2020-06-19 10:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 13:56 [PATCH 1/2] powerpc/syscalls: Use the number when building SPU syscall table Michael Ellerman
2020-06-16 13:56 ` [PATCH 2/2] powerpc/syscalls: Split SPU-ness out of ABI Michael Ellerman
2020-06-19 10:26   ` Michael Ellerman [this message]
2020-06-19 12:07   ` Arnd Bergmann
2020-06-18 12:37 ` [PATCH 1/2] powerpc/syscalls: Use the number when building SPU syscall table Michael Ellerman
2020-06-21 10:13   ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7v7cpxe.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=arnd@arndb.de \
    --cc=linux-arch@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox