2020-06-16 13:59:51

by Michael Ellerman

[permalink] [raw]
Subject: [PATCH 1/2] powerpc/syscalls: Use the number when building SPU syscall table

Currently the macro that inserts entries into the SPU syscall table
doesn't actually use the "nr" (syscall number) parameter.

This does work, but it relies on the exact right number of syscall
entries being emitted in order for the syscal numbers to line up with
the array entries. If for example we had two entries with the same
syscall number we wouldn't get an error, it would just cause all
subsequent syscalls to be off by one in the spu_syscall_table.

So instead change the macro to assign to the specific entry of the
array, meaning any numbering overlap will be caught by the compiler.

Signed-off-by: Michael Ellerman <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
arch/powerpc/platforms/cell/spu_callbacks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index cbee3666da07..abdef9bcf432 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -35,7 +35,7 @@
*/

static void *spu_syscall_table[] = {
-#define __SYSCALL(nr, entry) entry,
+#define __SYSCALL(nr, entry) [nr] = entry,
#include <asm/syscall_table_spu.h>
#undef __SYSCALL
};
--
2.25.1


2020-06-18 12:39:50

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/syscalls: Use the number when building SPU syscall table

On Tue, 16 Jun 2020 23:56:16 +1000, Michael Ellerman wrote:
> Currently the macro that inserts entries into the SPU syscall table
> doesn't actually use the "nr" (syscall number) parameter.
>
> This does work, but it relies on the exact right number of syscall
> entries being emitted in order for the syscal numbers to line up with
> the array entries. If for example we had two entries with the same
> syscall number we wouldn't get an error, it would just cause all
> subsequent syscalls to be off by one in the spu_syscall_table.
>
> [...]

Applied to powerpc/fixes.

[1/2] powerpc/syscalls: Use the number when building SPU syscall table
https://git.kernel.org/powerpc/c/1497eea68624f6076bf3eaf66baec3771ea04045
[2/2] powerpc/syscalls: Split SPU-ness out of ABI
https://git.kernel.org/powerpc/c/35e32a6cb5f694fda54a5f391917e4ceefa0fece

cheers

2020-06-21 10:15:31

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/syscalls: Use the number when building SPU syscall table

Michael Ellerman <[email protected]> writes:
> On Tue, 16 Jun 2020 23:56:16 +1000, Michael Ellerman wrote:
>> Currently the macro that inserts entries into the SPU syscall table
>> doesn't actually use the "nr" (syscall number) parameter.
>>
>> This does work, but it relies on the exact right number of syscall
>> entries being emitted in order for the syscal numbers to line up with
>> the array entries. If for example we had two entries with the same
>> syscall number we wouldn't get an error, it would just cause all
>> subsequent syscalls to be off by one in the spu_syscall_table.
>>
>> [...]
>
> Applied to powerpc/fixes.
>
> [1/2] powerpc/syscalls: Use the number when building SPU syscall table
> https://git.kernel.org/powerpc/c/1497eea68624f6076bf3eaf66baec3771ea04045
> [2/2] powerpc/syscalls: Split SPU-ness out of ABI
> https://git.kernel.org/powerpc/c/35e32a6cb5f694fda54a5f391917e4ceefa0fece

Patch 2 dropped.

cheers