Re: [PATCH] powerpc/purgatory: Omit use of bin2c

2022-07-24 Thread Masahiro Yamada
On Sun, Jun 26, 2022 at 7:42 AM Masahiro Yamada wrote: > > The .incbin assembler directive is much faster than bin2c + $(CC). > > Do similar refactoring as in commit 4c0f032d4963 ("s390/purgatory: > Omit use of bin2c"). > > Please note the .quad directive matches to size_t in C (both 8 byte) > bec

[PATCH] KVM: PPC: Book3S HV:fix repeated words in comments

2022-07-24 Thread wangjianli
From: Jianli Wang Delete the redundant word 'do'. Signed-off-by: Jianli Wang --- arch/powerpc/kvm/book3s_hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index e08fb3124dca..17d79be6077d 100644 --- a/arch/power

[PATCH] powerpc/kvm: fix repeated words in comments Delete the redundant word 'that'.

2022-07-24 Thread wangjianli
Signed-off-by: wangjianli --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 514fd45c1994..73c6db20cd8a 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/

[PATCH] powerpc/mm: fix repeated words in comments

2022-07-24 Thread wangjianli
Delete the redundant word 'so'. Signed-off-by: wangjianli --- arch/powerpc/mm/init-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index 119ef491f797..acf5d7ba79d1 100644 --- a/arch/powerpc/mm/init-common

Re: [PATCH] powerpc/purgatory: Omit use of bin2c

2022-07-24 Thread Segher Boessenkool
On Sun, Jun 26, 2022 at 07:40:37AM +0900, Masahiro Yamada wrote: > The .incbin assembler directive is much faster than bin2c + $(CC). And perhaps more importantly it is simpler and less clumsy. > --- /dev/null > +++ b/arch/powerpc/purgatory/kexec-purgatory.S > @@ -0,0 +1,14 @@ > +/* SPDX-License-

Re: [PATCH] KVM: PPC: Book3S HV:fix repeated words in comments

2022-07-24 Thread Segher Boessenkool
On Sun, Jul 24, 2022 at 01:41:37PM +0800, wangjianli wrote: > From: Jianli Wang > > Delete the redundant word 'do'. > - /* invalidate the entry (what do do on error from the above ?) */ > + /* invalidate the entry (what do on error from the above ?) */ Probably "what to do" was meant he

Re: [PATCH] powerpc/mm: fix repeated words in comments

2022-07-24 Thread Segher Boessenkool
On Sun, Jul 24, 2022 at 02:36:22PM +0800, wangjianli wrote: > Delete the redundant word 'so'. > /* It would be nice if this was a BUILD_BUG_ON(), but at the >* moment, gcc doesn't seem to recognize is_power_of_2 as a > - * constant expression, so so much for that. */ > + *

[PATCH v2] powerpc/purgatory: Omit use of bin2c

2022-07-24 Thread Masahiro Yamada
The .incbin assembler directive is much faster than bin2c + $(CC). Do similar refactoring as in commit 4c0f032d4963 ("s390/purgatory: Omit use of bin2c"). Please note the .quad directive matches to size_t in C (both 8 byte) because the purgatory is compiled only for the 64-bit kernel. (KEXEC_FILE

Re: [PATCH] powerpc/purgatory: Omit use of bin2c

2022-07-24 Thread Masahiro Yamada
On Mon, Jul 25, 2022 at 10:42 AM Segher Boessenkool wrote: > > On Sun, Jun 26, 2022 at 07:40:37AM +0900, Masahiro Yamada wrote: > > The .incbin assembler directive is much faster than bin2c + $(CC). > > And perhaps more importantly it is simpler and less clumsy. > > > --- /dev/null > > +++ b/arch/

Re: [PATCH] powerpc: Remove the static variable initialisations to 0

2022-07-24 Thread Michael Ellerman
Segher Boessenkool writes: > On Sat, Jul 23, 2022 at 03:34:05PM +0200, Michal Suchánek wrote: >> Hello, >> >> On Sat, Jul 23, 2022 at 05:24:36PM +0800, Jason Wang wrote: >> > Initialise global and static variable to 0 is always unnecessary. >> > Remove the unnecessary initialisations. >> >> Isn'

[PATCH v2 00/14] powerpc: Syscall wrapper and register clearing

2022-07-24 Thread Rohan McLure
V1 available here: Link: https://lore.kernel.org/all/20220601054850.250287-1-rmcl...@linux.ibm.com/ Implement a syscall wrapper, causing arguments to handlers to be passed via a struct pt_regs on the stack. The syscall wrapper is implemented for all platforms other than the Cell processor, from w

[PATCH v2 01/14] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-07-24 Thread Rohan McLure
Arch-specific implementations of syscall handlers are currently used over generic implementations for the following reasons: 1. Semantics unique to powerpc 2. Compatibility syscalls require 'argument padding' to comply with 64-bit argument convention in ELF32 abi. 3. Parameter types or orde

[PATCH v2 02/14] powerpc: Remove direct call to personality syscall handler

2022-07-24 Thread Rohan McLure
Syscall handlers should not be invoked internally by their symbol names, as these symbols defined by the architecture-defined SYSCALL_DEFINE macro. Fortunately, in the case of ppc64_personality, its call to sys_personality can be replaced with an invocation to the equivalent ksys_personality inline

[PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers

2022-07-24 Thread Rohan McLure
Syscall handlers should not be invoked internally by their symbol names, as these symbols defined by the architecture-defined SYSCALL_DEFINE macro. Move the compatibility syscall definition for mmap2 to syscalls.c, so that all mmap implementations can share an inline helper function, as is done wit

[PATCH v2 04/14] powerpc/32: Remove powerpc select specialisation

2022-07-24 Thread Rohan McLure
Syscall #82 has been implemented for 32-bit platforms in a unique way on powerpc systems. This hack will in effect guess whether the caller is expecting new select semantics or old select semantics. It does so via a guess, based off the first parameter. In new select, this parameter represents the

[PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall

2022-07-24 Thread Rohan McLure
The powerpc fallocate compat syscall handler is identical to the generic implementation provided by commit 59c10c52f573f ("riscv: compat: syscall: Add compat_sys_call_table implementation"), and as such can be removed in favour of the generic implementation. A future patch series will replace more

[PATCH v2 06/14] powerpc: Include all arch-specific syscall prototypes

2022-07-24 Thread Rohan McLure
Forward declare all syscall handler prototypes where a generic prototype is not provided in either linux/syscalls.h or linux/compat.h in asm/syscalls.h. This is required for compile-time type-checking for syscall handlers, which is implemented later in this series. 32-bit compatibility syscall han

[PATCH v2 07/14] powerpc: Enable compile-time check for syscall handlers

2022-07-24 Thread Rohan McLure
The table of syscall handlers and registered compatibility syscall handlers has in past been produced using assembly, with function references resolved at link time. This moves link-time errors to compile-time, by rewriting systbl.S in C, and including the linux/syscalls.h, linux/compat.h and asm/s

[PATCH v2 08/14] powerpc: Use common syscall handler type

2022-07-24 Thread Rohan McLure
Cause syscall handlers to be typed as follows when called indirectly throughout the kernel. typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); Since both 32 and 64-bit abis allow for at least the first s

[PATCH v2 09/14] powerpc: Add NULLIFY_GPRS macros for register clears

2022-07-24 Thread Rohan McLure
Macros for restoring and saving registers to and from the stack exist. Provide macros with the same interface for clearing a range of gprs by setting each register's value in that range to zero. The resulting macros are called NULLIFY_GPRS and NULLIFY_NVGPRS, keeping with the naming of the accompa

[PATCH v2 10/14] powerpc: Provide syscall wrapper

2022-07-24 Thread Rohan McLure
Implement syscall wrapper as per s390, x86, arm64. When enabled cause handlers to accept parameters from a stack frame rather than from user scratch register state. This allows for user registers to be safely cleared in order to reduce caller influence on speculation within syscall routine. The wra

[PATCH v2 11/14] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-07-24 Thread Rohan McLure
Clear user state in gprs (assign to zero) to reduce the influence of user registers on speculation within kernel syscall handlers. Clears occur at the very beginning of the sc and scv 0 interrupt handlers, with restores occurring following the execution of the syscall handler. One function of sysc

[PATCH v2 12/14] powerpc/64s: Use {NULLIFY,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-07-24 Thread Rohan McLure
Use the convenience macros for saving/clearing/restoring gprs in keeping with syscall calling conventions. The plural variants of these macros can store a range of registers for concision. This works well when the save-to-stack logic is simple (a gpr is saved to its corresponding offset in the str

[PATCH v2 13/14] powerpc/64s: Fix comment on interrupt handler prologue

2022-07-24 Thread Rohan McLure
Interrupt handlers on 64s systems will often need to save register state from the interrupted process to make space for loading special purpose registers or for internal state. Fix a comment documenting a common code path macro in the beginning of interrupt handlers where r10 is saved to the PACA

[PATCH v2 14/14] powerpc/64s: Clear gprs on interrupt routine entry

2022-07-24 Thread Rohan McLure
Zero GPRS r0, r2-r11, r14-r31, on entry into the kernel for all other interrupt sources to limit influence of user-space values in potential speculation gadgets. The remaining gprs are overwritten by entry macros to interrupt handlers, irrespective of whether or not a given handler consumes these r

Re: [PATCH] powerpc/kvm: fix repeated words in comments Delete the redundant word 'that'.

2022-07-24 Thread Michael Ellerman
wangjianli writes: > Signed-off-by: wangjianli > --- > arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c > b/arch/powerpc/kvm/book3s_64_mmu_hv.c > index 514fd45c1994..73c6db20cd8a 100644 > --- a/arch/