[PATCH v3 5/7] powerpc/64s/interrupt: masked handler debug check for previous hard disable

2022-09-25 Thread Nicholas Piggin
Prior changes eliminated cases of masked PACA_IRQ_MUST_HARD_MASK interrupts that re-fire due to MSR[EE] being enabled while they are pending. Add a debug check in the masked interrupt handler to catch if this occurs. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10

[PATCH v3 4/7] powerpc/64s: Fix irq state management in runlatch functions

2022-09-25 Thread Nicholas Piggin
and may trip warnings or cause other problems as we tighten up this state management. Fix this by only re-enabling if PACA_IRQ_HARD_DIS is clear. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/runlatch.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH v3 3/7] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending

2022-09-25 Thread Nicholas Piggin
. interrupt_exit_kernel_prepare() clears PACA_IRQ_HARD_DIS 10. interrupt returns with MSR[EE]=1 11. PMU interrupt fires, perf handler runs Fixes: 4423eb5ae32e ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nicholas Piggin --- arch/powe

[PATCH v3 2/7] powerpc/64: mark irqs hard disabled in boot paca

2022-09-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/setup_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 2b2d0b0fbb30..ce8fc6575eaa 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/

[PATCH v3 1/7] powerpc/64/interrupt: Fix false warning in context tracking due to idle state

2022-09-25 Thread Nicholas Piggin
Commit 171476775d32 ("context_tracking: Convert state to atomic_t") added a CONTEXT_IDLE state which can be encountered by interrupts from kernel mode in the idle thread, causing a false positive warning. Fixes: 171476775d32 ("context_tracking: Convert state to atomic_t") Sig

[PATCH v3 0/7] powerpc/64: interrupt soft-mask and context fixes

2022-09-25 Thread Nicholas Piggin
No real changes since last posting, I just pulled fixes from several series together and rearranged them and updated changelogs slightly. Thanks, Nick Nicholas Piggin (7): powerpc/64/interrupt: Fix false warning in context tracking due to idle state powerpc/64: mark irqs hard disabled

[PATCH] powerpc/pseries: move hcall_tracepoint_refcount out of .toc

2022-09-25 Thread Nicholas Piggin
The .toc section is not really intended for arbitrary data. Writable data in particular prevents making the TOC read-only after relocation. Move hcall_tracepoint_refcount into the .data section. Signed-off-by: Nicholas Piggin --- This is split out from "[v2,2/5] powerpc/64: asm use consi

[PATCH v2 5/5] powerpc/64e: provide an addressing macro for use with TOC in alternate register

2022-09-25 Thread Nicholas Piggin
t/toc optimization is not supported" messages by the linker. Having r2 be one of the saved registers and using that for TOC addressing may be the best way to avoid that and switch this to TOC addressing. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ppc_asm.h | 11 +++ ar

[PATCH v2 4/5] powerpc/64: provide a helper macro to load r2 with the kernel TOC

2022-09-25 Thread Nicholas Piggin
A later change stops the kernel using r2 and loads it with a poison value. Provide a PACATOC loading abstraction which can hide this detail. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ppc_asm.h | 6 ++ arch/powerpc/kernel/exceptions-64e.S | 12

[PATCH v2 3/5] powerpc/64: switch asm helpers from GOT to TOC relative addressing

2022-09-25 Thread Nicholas Piggin
There is no need to use GOT addressing within the kernel. Signed-off-by: Nicholas Piggin --- arch/powerpc/boot/ppc_asm.h| 3 ++- arch/powerpc/include/asm/ppc_asm.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot

[PATCH v2 2/5] powerpc/64: asm use consistent global variable declaration and access

2022-09-25 Thread Nicholas Piggin
Use helper macros to access global variables, and place them in .data sections rather than in .toc. Putting addresses in TOC is not required because the kernel is linked with a single TOC. Signed-off-by: Nicholas Piggin --- arch/powerpc/boot/opal-calls.S | 6 +++--- arch/powerpc

[PATCH v2 0/5] powerpc/64: avoid GOT addressing, don't put data in TOC

2022-09-25 Thread Nicholas Piggin
ot wrapper compile. Nicholas Piggin (5): powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER powerpc/64: asm use consistent global variable declaration and access powerpc/64: switch asm helpers from GOT to TOC relative addressing powerpc/64: provide a helper macro to load r2 with the

[PATCH v2 1/5] powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER

2022-09-25 Thread Nicholas Piggin
bytes and 64-bit has 0x in the top bytes. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h| 4 ++-- arch/powerpc/kernel/entry_32.S | 6 +++--- arch/powerpc/kernel/exceptions-64e.S | 8 +--- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel

Re: [PATCH] powerpc/irq: Modernise inline assembly in irq_soft_mask_{set,return}

2022-09-23 Thread Nicholas Piggin
On Sat Sep 24, 2022 at 8:15 AM AEST, Segher Boessenkool wrote: > On Sat, Sep 24, 2022 at 02:26:52AM +1000, Nicholas Piggin wrote: > > I still don't see what clauses guarantees asm("%0" ::"r"(foo)) to give > > 13. It doesn't say access via inline assembly is spe

Re: [PATCH] powerpc/irq: Modernise inline assembly in irq_soft_mask_{set,return}

2022-09-23 Thread Nicholas Piggin
On Fri Sep 23, 2022 at 10:18 PM AEST, Segher Boessenkool wrote: > On Fri, Sep 23, 2022 at 05:08:13PM +1000, Nicholas Piggin wrote: > > On Tue Sep 20, 2022 at 4:41 PM AEST, Christophe Leroy wrote: > > > local_paca is declared as global register asm("r13"), it is therefo

[RFC PATCH 2/2] powerpc: nop trap instruction after WARN_ONCE fires

2022-09-23 Thread Nicholas Piggin
WARN_ONCE and similar are often used in frequently executed code, and should not crash the system. The program check interrupt caused by WARN_ON_ONCE can be a significant overhead even when nothing is being printed. This can cause performance to become unacceptable, having the same effective

[RFC PATCH 1/2] powerpc: Don't use extable for WARN

2022-09-23 Thread Nicholas Piggin
adds a recovery address to the bug_entry struct instead of using the extable. The size of the bug entry table plus the extable go from 137kB to 126kB. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 4 arch/powerpc/include/asm/bug.h | 31

Re: [PATCH 16/17] powerpc/qspinlock: allow indefinite spinning on a preempted owner

2022-09-23 Thread Nicholas Piggin
On Fri Sep 23, 2022 at 1:02 AM AEST, Laurent Dufour wrote: > On 28/07/2022 08:31:19, Nicholas Piggin wrote: > > Provide an option that holds off queueing indefinitely while the lock > > owner is preempted. This could reduce queueing latencies for very > > overcomm

Re: [PATCH v6 22/25] powerpc/64s: Clear user GPRs in syscall interrupt entry

2022-09-23 Thread Nicholas Piggin
On Wed Sep 21, 2022 at 4:56 PM AEST, Rohan McLure wrote: > 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

Re: [PATCH v6 21/25] powerpc: Provide syscall wrapper

2022-09-23 Thread Nicholas Piggin
ck around What's this doing? Why can't it continue using the declaration in syscalls.h? Aside from that and the stray hunk to go in the previous patch, Reviewed-by: Nicholas Piggin Thanks, Nick

Re: [PATCH v6 20/25] powerpc: Change system_call_exception calling convention

2022-09-23 Thread Nicholas Piggin
+ regs->gpr[6], regs->gpr[7], regs->gpr[8]); which got into your next patch. Otherwise I think it looks good. Reviewed-by: Nicholas Piggin

Re: [PATCH v6 19/25] powerpc: Remove high-order word clearing on compat syscall entry

2022-09-23 Thread Nicholas Piggin
gnature type of the target handler. > > Signed-off-by: Rohan McLure > Reported-by: Nicholas Piggin Thanks for digging through it to make sure things will work right without this. Some handlers look problematic without the rest of your series, right? e.g., upstream compat_sys_mmap2 has long

Re: [RFC PATCH 5/7] powerpc/64s: update generic cpu option name and compiler flags

2022-09-23 Thread Nicholas Piggin
On Thu Sep 22, 2022 at 1:22 AM AEST, Segher Boessenkool wrote: > Hi! > > On Wed, Sep 21, 2022 at 11:01:18AM +1000, Nicholas Piggin wrote: > > On Wed Sep 21, 2022 at 8:16 AM AEST, Segher Boessenkool wrote: > > > On Tue, Sep 20, 2022 at 12:01:47AM +1000, Nicholas Piggin wrote

Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5

2022-09-23 Thread Nicholas Piggin
On Thu Sep 22, 2022 at 4:50 AM AEST, Segher Boessenkool wrote: > On Wed, Sep 21, 2022 at 11:41:02AM +1000, Nicholas Piggin wrote: > > Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5. > > POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added > > th

Re: [PATCH] powerpc/irq: Modernise inline assembly in irq_soft_mask_{set,return}

2022-09-23 Thread Nicholas Piggin
On Tue Sep 20, 2022 at 4:41 PM AEST, Christophe Leroy wrote: > local_paca is declared as global register asm("r13"), it is therefore > garantied to always ever be r13. > > It is therefore not required to opencode r13 in the assembly, use > a reference to local_paca->irq_soft_mask instead. > > This

Re: [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return()

2022-09-23 Thread Nicholas Piggin
code > irq_soft_mask helpers"") > > irq_soft_mask_set_return() and irq_soft_mask_or_return() > are overset of irq_soft_mask_set(). > > Have them use irq_soft_mask_set() instead of duplicating it. > > Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin > --- > arch/powerpc/i

Re: [PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-09-23 Thread Nicholas Piggin
On Fri Sep 23, 2022 at 3:46 PM AEST, Christophe Leroy wrote: > > > Le 23/09/2022 à 05:30, Nicholas Piggin a écrit : > > This adds basic POWER10_CPU option, which builds with -mcpu=power10. > > > > Signed-off-by: Nicholas Piggin > > --- > > There's quite

Re: [PATCH 1/5] powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER

2022-09-23 Thread Nicholas Piggin
On Fri Sep 23, 2022 at 3:34 PM AEST, Christophe Leroy wrote: > > > Le 23/09/2022 à 05:25, Nicholas Piggin a écrit : > > Using a 32-bit constant for this marker allows it to be loaded with > > two ALU instructions, like 32-bit. This avoids a TOC entry and a > > TOC load t

[PATCH] powerpc/64s: POWER10 CPU Kconfig build option

2022-09-22 Thread Nicholas Piggin
This adds basic POWER10_CPU option, which builds with -mcpu=power10. Signed-off-by: Nicholas Piggin --- There's quite a lot of asm and linker changes slated for the next merge window already so I may leave the pcrel patch for next time. I think we can add the basic POWER10 build option though

[PATCH 5/5] powerpc/64e: provide an addressing macro for use with TOC in alternate register

2022-09-22 Thread Nicholas Piggin
t/toc optimization is not supported" messages by the linker. Having r2 be one of the saved registers and using that for TOC addressing may be the best way to avoid that and switch this to TOC addressing. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ppc_asm.h | 11 +++ ar

[PATCH 4/5] powerpc/64: provide a helper macro to load r2 with the kernel TOC

2022-09-22 Thread Nicholas Piggin
A later change stops the kernel using r2 and loads it with a poison value. Provide a PACATOC loading abstraction which can hide this detail. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ppc_asm.h | 6 ++ arch/powerpc/kernel/exceptions-64e.S | 12

[PATCH 3/5] powerpc/64: switch asm helpers from GOT to TOC relative addressing

2022-09-22 Thread Nicholas Piggin
There is no need to use GOT addressing within the kernel. Signed-off-by: Nicholas Piggin --- arch/powerpc/boot/ppc_asm.h| 3 ++- arch/powerpc/include/asm/ppc_asm.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot

[PATCH 2/5] powerpc/64: asm use consistent global variable declaration and access

2022-09-22 Thread Nicholas Piggin
Use helper macros to access global variables, and place them in .data sections rather than in .toc. Putting addresses in TOC is not required because the kernel is linked with a single TOC. Signed-off-by: Nicholas Piggin --- arch/powerpc/boot/opal-calls.S | 6 +++--- arch/powerpc

[PATCH 1/5] powerpc/64: use 32-bit immediate for STACK_FRAME_REGS_MARKER

2022-09-22 Thread Nicholas Piggin
bytes and 64-bit has 0x in the top bytes. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h| 5 +++-- arch/powerpc/kernel/entry_32.S | 6 +++--- arch/powerpc/kernel/exceptions-64e.S | 8 +--- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel

[PATCH 0/5] powerpc/64: avoid GOT addressing, don't put data in TOC

2022-09-22 Thread Nicholas Piggin
touching ppc32 much (only slight comment change and interrupt stack magic number change). Patch 2 is probably actually required before we make the TOC readonly at runtime, because there is one case (hcall_tracepoint_refcount) that puts read-write data in the TOC section. Thanks, Nick Nicholas Piggin

[PATCH 2/2] powerpc/64s: update cpu selection options

2022-09-20 Thread Nicholas Piggin
-by: Nicholas Piggin --- The 970 option builds and boots a QEMU TCG 970 machine. Documentation/powerpc/isa-versions.rst | 14 ++ arch/powerpc/Makefile | 5 +++-- arch/powerpc/platforms/Kconfig.cputype | 8 3 files changed, 21 insertions(+), 6 deletions

[PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5

2022-09-20 Thread Nicholas Piggin
Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5. POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added the popcntb instruction which a compiler might use. Use -mcpu=power4. Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support") Signed-off-by: Nicho

Re: [RFC PATCH 5/7] powerpc/64s: update generic cpu option name and compiler flags

2022-09-20 Thread Nicholas Piggin
On Wed Sep 21, 2022 at 8:16 AM AEST, Segher Boessenkool wrote: > Hi! > > On Tue, Sep 20, 2022 at 12:01:47AM +1000, Nicholas Piggin wrote: > > Update the 64s GENERIC_CPU option. POWER4 support has been dropped, so > > make that clear in the option name. > > AFAIR the

[PATCH v4 2/2] powerpc/64s: Make POWER10 and later use pause_short in cpu_relax loops

2022-09-20 Thread Nicholas Piggin
) on POWER10. QEMU TCG only supports this instruction correctly since v7.1, versions without the fix may cause hangs whne running POWER10 CPUs. Reviewed-by: Segher Boessenkool Signed-off-by: Nicholas Piggin --- v4: - Rebase, test with upstream qemu with fix - Clarify asm comments and fix typo

[PATCH v4 1/2] powerpc: add ISA v3.0 / v3.1 wait opcode macro

2022-09-20 Thread Nicholas Piggin
but the kernel only uses WC=0). Reviewed-by: Segher Boessenkool Signed-off-by: Nicholas Piggin --- v2: Update naming, patch changelog and title. v3: v2 sent incorrect patches, sorry. v4: Rebase. arch/powerpc/include/asm/ppc-opcode.h | 7 +-- arch/powerpc/kernel/idle_book3e.S | 2 +- 2 files

Re: [PATCH v2 3/7] powerpc/build: move got, toc, plt, branch_lt sections to read-only

2022-09-20 Thread Nicholas Piggin
0-rc5 next-20220916] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > > > url: > > h

Re: [PATCH v2 06/19] powerpc/cputable: Split cpu_specs[] out of cputable.h

2022-09-20 Thread Nicholas Piggin
On Tue Sep 20, 2022 at 3:01 AM AEST, Christophe Leroy wrote: > cpu_specs[] is full of #ifdefs depending on the different > types of CPU. > > CPUs are mutually exclusive, it is therefore possible to split > cpu_specs[] into smaller more readable pieces. > > Create cpu_specs_XXX.h that will each be

Re: [PATCH v2 2/2] powerpc/kvm: Remove unused references for MMCR3/SIER2/SIER3 registers

2022-09-20 Thread Nicholas Piggin
nt PMU save/restore in > C") > Signed-off-by: Kajol Jain And it was increased from 7 to 10 with 5752fe0b811bb which added the POWER10 registers, so that makes sense to go back to 7 in the POWER8 path. Reviewed-by: Nicholas Piggin > --- > arch/powerpc/include/asm/kvm_book3s_a

Re: [PATCH v2 1/2] powerpc/kvm: Remove unused macros from asm-offset

2022-09-20 Thread Nicholas Piggin
tions were missed to remove. Patch > fixes by removing the unused macros. > > Signed-off-by: Disha Goel Thanks, good cleanup. Reviewed-by: Nicholas Piggin > --- > arch/powerpc/kernel/asm-offsets.c | 25 - > 1 file changed, 25 deletions(-) >

Re: [PATCH] Revert "powerpc/rtas: Implement reentrant rtas call"

2022-09-19 Thread Nicholas Piggin
On Mon Sep 19, 2022 at 11:51 PM AEST, Nathan Lynch wrote: > Nathan Lynch writes: > > "Nicholas Piggin" writes: > >> On Wed Sep 14, 2022 at 3:39 AM AEST, Leonardo Brás wrote: > >>> On Mon, 2022-09-12 at 14:58 -0500, Nathan Lynch wrote: > >>> &

Re: [PACTH v2] powerpc/pseries/mce: Avoid instrumentation in realmode

2022-09-19 Thread Nicholas Piggin
On Mon Sep 19, 2022 at 4:03 PM AEST, Ganesh wrote: > On 9/7/22 09:49, Nicholas Piggin wrote: > > > On Mon Sep 5, 2022 at 4:38 PM AEST, Ganesh Goudar wrote: > >> Part of machine check error handling is done in realmode, > >> As of now instrumentation is not possib

Re: [PATCH 22/23] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-19 Thread Nicholas Piggin
On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: > 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

Re: [PATCH 21/23] powerpc/64: Add INTERRUPT_SANITIZE_REGISTERS Kconfig

2022-09-19 Thread Nicholas Piggin
d up just simplifying code by always doing it... for now I'm happier to have the option. Acked-by: Nicholas Piggin > --- > V4 -> V5: New patch > --- > arch/powerpc/Kconfig | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/arch/powerpc/Kconfig b/arch/powe

Re: [PATCH 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-19 Thread Nicholas Piggin
On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: > 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

Re: [PATCH 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-19 Thread Nicholas Piggin
On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: > 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

Re: [PATCH 19/23] powerpc: Provide syscall wrapper

2022-09-19 Thread Nicholas Piggin
On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: > 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

Re: [PATCH 18/23] powerpc: Use common syscall handler type

2022-09-19 Thread Nicholas Piggin
ed there with the same name. That can just use your new type AFAIKS. We're hopefully solving the rodata thing separately, so long as you've got the const there that's enough. Other than that, Reviewed-by: Nicholas Piggin > 5 files changed, 14 insertions(+), 10 deletions(-) > > diff -

Re: [PATCH 17/23] powerpc: Enable compile-time check for syscall handlers

2022-09-19 Thread Nicholas Piggin
ing systbl.S in C, and including the > linux/syscalls.h, linux/compat.h and asm/syscalls.h headers for > prototypes. > > Reported-by: Arnd Bergmann > Signed-off-by: Rohan McLure > Reported-by: Nicholas Piggin > --- > V1 -> V2: New patch. > V4 -> V5: For this pa

Re: [PATCH 16/23] powerpc: Include all arch-specific syscall prototypes

2022-09-19 Thread Nicholas Piggin
he compile time checking so it must be right :) Acked-by: Nicholas Piggin > --- > V1 -> V2: Explicitly include prototypes. > V2 -> V3: Remove extraneous #include and ppc_fallocate > prototype. Rename header. > V4 -> V5: Clean. Elaborate comment on long long munging. Remov

Re: [PATCH 15/23] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-09-19 Thread Nicholas Piggin
series may allow for asm/unistd.h to signal > through its defines that a generic implementation of these syscall > handlers with the correct calling convention be emitted, through the > __ARCH_WANT_COMPAT_SYS_... convention. > > Signed-off-by: Rohan McLure Looks good Reviewed-by: Nic

Re: [PATCH 09/23] asm-generic: compat: Support BE for long long args in 32-bit ABIs

2022-09-19 Thread Nicholas Piggin
r efficiently defining little endian compatibility syscalls. > > Architectures supporting big endianness may benefit from reciprocal > argument translation, but are welcome also to implement their own. > > Signed-off-by: Rohan McLure Better put Arnd and linux-arch on cc... Revi

Re: [PATCH 08/23] powerpc: Fix fallocate and fadvise64_64 compat parameter combination

2022-09-19 Thread Nicholas Piggin
ff-by: Rohan McLure I'm still not sure if ppc32 is usable with LE kernel, but in any case the patch is good I think. Reviewed-by: Nicholas Piggin > --- > V4 -> V5: New patch. > --- > arch/powerpc/include/asm/syscalls.h | 12 > arch/powerpc/kernel/sys_ppc32.

Re: [PATCH 07/23] powerpc/64s: Fix comment on interrupt handler prologue

2022-09-19 Thread Nicholas Piggin
these saves has grown over the many > revisions of this macro. Fix this by signalling with a comment where > r11-r12 are saved to the PACA. > > Signed-off-by: Rohan McLure > Reported-by: Nicholas Piggin Reviewed-by: Nicholas Piggin > --- > V1 -> V2: Given its own

Re: [PATCH 06/23] powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS

2022-09-19 Thread Nicholas Piggin
nd employing the ZEROIZE_GPR macro when appropriate. > > Also simplify an invocation of SAVE_GPRS targetting all non-volatile > registers to SAVE_NVGPRS. > > Signed-off-by: Rohan Mclure > Reported-by: Nicholas Piggin > --- > V3 -> V4: New commit. > --- &g

Re: [PATCH 05/23] powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S

2022-09-19 Thread Nicholas Piggin
gt; together restores at the end of the interrupt handler where the saved > value is not consumed earlier in the handler code. > > Signed-off-by: Rohan McLure > Reported-by: Christophe Leroy Reviewed-by: Nicholas Piggin > --- > V2 -> V3: New patch. > V3 -> V4: Minimise resto

[RFC PATCH 7/7] powerpc/64s: Add option to build vmlinux with pcrel addressing

2022-09-19 Thread Nicholas Piggin
at assembly time. Even aligning the prefixed instruction can't generally solve it. Fortunately it's only one place in the kernel so far. This reduces kernel text size by about 6%. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 7 +++ arch/powerpc/include/asm

[RFC PATCH 6/7] powerpc/64s: POWER10 CPU Kconfig build option

2022-09-19 Thread Nicholas Piggin
This adds basic POWER10_CPU option, which builds with -mcpu=power10. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 7 ++- arch/powerpc/platforms/Kconfig.cputype | 8 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/Makefile

[RFC PATCH 5/7] powerpc/64s: update generic cpu option name and compiler flags

2022-09-19 Thread Nicholas Piggin
of power5. Effectively the minimum compiler version means power5 was always being selected here, so this should not change anything. 970 / G5 code generation does not seem to have been a problem with -mcpu=power5, but it's possible we should go back to power4 to be really safe. Signed-off-by: Nicholas

[RFC PATCH 4/7] powerpc: add CFUNC assembly label annotation

2022-09-19 Thread Nicholas Piggin
This macro is to be used in assembly where C functions are called. pcrel addressing mode requires branches to functions with a localentry value of 1 to have either a trailing nop or @notoc. This macro permits the latter without changing callers. Signed-off-by: Nicholas Piggin --- arch/powerpc

[RFC PATCH 3/7] powerpc/64: provide a helper macro to load r2 with the kernel TOC

2022-09-19 Thread Nicholas Piggin
A later change stops the kernel using r2 and loads it with a poison value. Provide a PACATOC loading abstraction which can hide this detail. XXX: 64e, KVM, ftrace not entirely done Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ppc_asm.h | 3 +++ arch/powerpc/kernel

[RFC PATCH 2/7] powerpc/64: abstract asm global variable declaration and access

2022-09-19 Thread Nicholas Piggin
Use asm helpers to access global variables and to define them in asm. Stop using got addressing and use the more common @toc offsets. 32-bit already does this so that should be unchanged. Signed-off-by: Nicholas Piggin --- arch/powerpc/boot/opal-calls.S | 6 +- arch/powerpc/boot

[RFC PATCH 1/7] powerpc: use 16-bit immediate for STACK_FRAME_REGS_MARKER

2022-09-19 Thread Nicholas Piggin
-bit uses, to avoid false positives. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/ptrace.h| 6 +++--- arch/powerpc/kernel/entry_32.S | 9 - arch/powerpc/kernel/exceptions-64e.S | 8 +--- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel/head_32.h

[RFC PATCH 0/7] powerpc: first hack at pcrel addressing

2022-09-19 Thread Nicholas Piggin
with the approach. Aside from polishing, the major bit missing before merge is Kconfig detection of compiler pcrel feature. Thanks, Nick Nicholas Piggin (7): powerpc: use 16-bit immediate for STACK_FRAME_REGS_MARKER powerpc/64: abstract asm global variable declaration and access powerpc/64: provide

[PATCH v2 7/7] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE

2022-09-15 Thread Nicholas Piggin
as far as linking goes. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/systbl.S | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index cb3358886203..0bec33e86f50 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc

[PATCH v2 6/7] powerpc/64/build: merge .got and .toc input sections

2022-09-15 Thread Nicholas Piggin
Follow the binutils ld internal linker script and merge .got and .toc input sections in the .got output section. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch

[PATCH v2 5/7] powerpc/64/build: only include .opd with ELFv1

2022-09-15 Thread Nicholas Piggin
ELFv2 does not use function descriptors so .opd is not required. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index ae0814063900..737825ae2ae0

[PATCH v2 4/7] powerpc/build: move .data.rel.ro, .sdata2 to read-only

2022-09-15 Thread Nicholas Piggin
.sdata2 is a readonly small data section for ppc32, and .data.rel.ro is data that needs relocating but is read-only after that so these can both be moved to the read only memory region. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 20 1 file

[PATCH v2 3/7] powerpc/build: move got, toc, plt, branch_lt sections to read-only

2022-09-15 Thread Nicholas Piggin
This moves linker-related tables from .data to read-only area. Relocations are performed at early boot time before memory is protected, after which there should be no modifications required. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 42

[PATCH v2 2/7] powerpc/32/build: move got1/got2 sections out of text

2022-09-15 Thread Nicholas Piggin
Following the example from the binutils default linker script, move .got1 and .got2 out of .text, to just after RO_DATA. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/powerpc

[PATCH v2 1/7] powerpc: move __end_rodata to cover arch read-only sections

2022-09-15 Thread Nicholas Piggin
to follow read-only data. This makes is_kernel_rodata() exactly cover the read-only region, as well as other things using __end_rodata (e.g., kernel/dma/debug.c). Boot dmesg also prints the rodata size more accurately. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S| 3

[PATCH v2 0/7] powerpc: build / linker improvements

2022-09-15 Thread Nicholas Piggin
in that patch, the relocations were a red herring. - Update the changelog in the __end_rodata patch. - Align __end_rodata to strict align size. Nicholas Piggin (7): powerpc: move __end_rodata to cover arch read-only sections powerpc/32/build: move got1/got2 sections out of text powerpc/build

Re: [PATCH] Revert "powerpc/rtas: Implement reentrant rtas call"

2022-09-15 Thread Nicholas Piggin
On Wed Sep 14, 2022 at 3:39 AM AEST, Leonardo Brás wrote: > On Mon, 2022-09-12 at 14:58 -0500, Nathan Lynch wrote: > > Leonardo Brás writes: > > > On Fri, 2022-09-09 at 09:04 -0500, Nathan Lynch wrote: > > > > Leonardo Brás writes: > > > > > On Wed, 2022-09-07 at 17:01 -0500, Nathan Lynch wrote:

Re: [PATCH] powerpc/64: Remove unused SYS_CALL_TABLE symbol

2022-09-15 Thread Nicholas Piggin
so remove them. > Acked-by: Nicholas Piggin > Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic > in C") > Signed-off-by: Michael Ellerman > --- > arch/powerpc/kernel/interrupt_64.S | 10 -- > 1 file changed, 10 deletions(-) > >

Re: [PATCH kernel] KVM: PPC: Make KVM_CAP_IRQFD_RESAMPLE platform dependent

2022-09-15 Thread Nicholas Piggin
Seems okay to me, it probably better go through the KVM tree though. Acked-by: Nicholas Piggin Thanks, Nick On Tue Sep 13, 2022 at 10:50 PM AEST, Alexey Kardashevskiy wrote: > Ping? It's been a while and probably got lost :-/ > > On 18/05/2022 16:27, Alexey Kardashevs

Re: [PATCH v4 10/20] powerpc: Use common syscall handler type

2022-09-15 Thread Nicholas Piggin
On Thu Sep 15, 2022 at 3:45 PM AEST, Rohan McLure wrote: > > > > On 12 Sep 2022, at 8:56 pm, Nicholas Piggin wrote: > > > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: > >> Cause syscall handlers to be typed as follows when called indi

Re: [PATCH v4 19/20] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-15 Thread Nicholas Piggin
On Thu Sep 15, 2022 at 4:55 PM AEST, Rohan McLure wrote: > > > > On 12 Sep 2022, at 10:15 pm, Nicholas Piggin wrote: > > > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: > >> Zero GPRS r0, r2-r11, r14-r31, on entry into the kernel for all >

Re: [PATCH 1/7] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE

2022-09-15 Thread Nicholas Piggin
On Thu Sep 15, 2022 at 10:51 PM AEST, Michael Ellerman wrote: > Christophe Leroy writes: > > Le 14/09/2022 à 17:47, Nicholas Piggin a écrit : > >> Const function pointers live in .data.rel.ro rather than .rodata because > >> they must be relocated. This change prevents

Re: [PATCH 2/7] powerpc: move __end_rodata to cover arch read-only sections

2022-09-15 Thread Nicholas Piggin
On Thu Sep 15, 2022 at 10:47 PM AEST, Michael Ellerman wrote: > Nicholas Piggin writes: > > powerpc has a number of read-only sections and tables that are put > > after RO_DATA(). Move the __end_rodata symbol to cover these as well. > > > > Setting memory to read

[PATCH 6/6] powerpc/64s/interrupt: halt early boot interrupts if paca is not set up

2022-09-15 Thread Nicholas Piggin
could be printed to console at this point in any case because even udbg is only set up after the boot paca is set, so this shouldn't be missed. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 11 +-- arch/powerpc/kernel/head_64.S| 3 +++ arch/powerpc

[PATCH 5/6] powerpc/64: don't set boot CPU's r13 to paca until the structure is set up

2022-09-15 Thread Nicholas Piggin
The idea is to get to the point where if r13 is non-zero, then it should contain a reasonable paca. This can be used in early boot program check and machine check handlers to avoid running off into the weeds if they hit before r13 has a paca. Signed-off-by: Nicholas Piggin --- arch/powerpc

[PATCH 4/6] powerpc/64: avoid using r13 in relocate

2022-09-15 Thread Nicholas Piggin
be used as another fixed reg one day. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/reloc_64.S | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S index 232e4549defe..efd52f2e7033 100644

[PATCH 3/6] powerpc/64s: early boot machine check handler

2022-09-15 Thread Nicholas Piggin
, and the machine check stack is temporarily set to the middle of the init task stack. This allows machine checks (e.g., due to invalid data access in real mode) to print something useful earlier in boot (as soon as udbg is set up, if CONFIG_PPC_EARLY_DEBUG=y). Signed-off-by: Nicholas Piggin --- arch

[PATCH 2/6] powerpc/64s/interrupt: move early boot ILE fixup into a macro

2022-09-15 Thread Nicholas Piggin
In preparation for using this sequence in machine check interrupt, move it into a macro, with a small change to make it position independent. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 101 +++ 1 file changed, 56 insertions(+), 45 deletions

[PATCH 1/6] powerpc/64: mark irqs hard disabled in boot paca

2022-09-15 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/setup_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 2b2d0b0fbb30..ce8fc6575eaa 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/

[PATCH 0/6] powerpc/64: improve boot debugging

2022-09-15 Thread Nicholas Piggin
This series is mostly 64s but has a few fixes that cover 64e too. The main thing is the early boot machine check handler. Thanks, Nick Nicholas Piggin (6): powerpc/64: mark irqs hard disabled in boot paca powerpc/64s/interrupt: move early boot ILE fixup into a macro powerpc/64s: early boot

[PATCH 7/7] powerpc/64/build: merge .got and .toc input sections

2022-09-14 Thread Nicholas Piggin
Follow the binutils ld internal linker script and merge .got and .toc input sections in the .got output section. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch

[PATCH 6/7] powerpc/64/build: only include .opd with ELFv1

2022-09-14 Thread Nicholas Piggin
ELFv2 does not use function descriptors so .opd is not required. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 44050863032e..404944263db8

[PATCH 5/7] powerpc/build: move .data.rel.ro, .sdata2 to read-only

2022-09-14 Thread Nicholas Piggin
.sdata2 is a readonly small data section for ppc32, and .data.rel.ro is data that needs relocating but is read-only after that so these can both be moved to the read only memory region. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 20 1 file

[PATCH 4/7] powerpc/build: move got, toc, plt, branch_lt sections to read-only

2022-09-14 Thread Nicholas Piggin
This moves linker related tables from .data to read-only area. Relocations are performed at early boot time before memory is protected, after which there should be no modifications required. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 42

[PATCH 3/7] powerpc/32/build: move got1/got2 sections out of text

2022-09-14 Thread Nicholas Piggin
Following the example from the binutils default linker script, move .got1 and .got2 out of .text, to just after RO_DATA where they are in read-only NX memory. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S | 21 +++-- 1 file changed, 11 insertions(+), 10

[PATCH 2/7] powerpc: move __end_rodata to cover arch read-only sections

2022-09-14 Thread Nicholas Piggin
(), and some other checks. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/vmlinux.lds.S| 3 +++ arch/powerpc/mm/book3s32/mmu.c | 2 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- arch/powerpc/mm/pgtable_32.c | 5

[PATCH 1/7] powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE

2022-09-14 Thread Nicholas Piggin
this patch, 44x_defconfig + CONFIG_RELOCATABLE boots to busybox. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/systbl.S | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index cb3358886203..0bec33e86f50 100644 --- a/arch/powerpc

[PATCH 0/7] powerpc: build / linker improvements

2022-09-14 Thread Nicholas Piggin
This series is mainly about moving more things out of writable and executable memory, and slightly moving the linker script in the direction of the binutils ld internal linker script as we do. Thanks, Nick Nicholas Piggin (7): powerpc/build: put sys_call_table in .data.rel.ro if RELOCATABLE

Re: [PATCH v4 17/20] powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS

2022-09-12 Thread Nicholas Piggin
nd employing the ZEROIZE_GPR macro when appropriate. > > Also simplify an invocation of SAVE_GPRS targetting all non-volatile > registers to SAVE_NVGPRS. > Reviewed-by: Nicholas Piggin > Signed-off-by: Rohan Mclure > --- > V3 -> V4: New commit. > --- >

Re: [PATCH v4 19/20] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-12 Thread Nicholas Piggin
On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: > 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

<    5   6   7   8   9   10   11   12   13   14   >