Re: [PATCH 10/23] powerpc: Use generic fallocate compatibility syscall

2022-09-15 Thread Arnd Bergmann
On Fri, Sep 16, 2022, at 7:32 AM, Rohan McLure wrote: > 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 ge

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

2022-09-15 Thread Arnd Bergmann
On Fri, Sep 16, 2022, at 7:32 AM, Rohan McLure wrote: > As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate > compatibility handlers assume parameters are passed with 32-bit > big-endian ABI. This affects the assignment of odd-even parameter pairs > to the high or low words of a 64

Re: [PATCH 5/5] tty: hvc: remove HVC_IUCV_MAGIC

2022-09-15 Thread Jiri Slaby
On 16. 09. 22, 3:55, наб wrote: According to Greg, in the context of magic numbers as defined in magic-number.rst, "the tty layer should not need this and I'll gladly take patches" This stretches that definition slightly, since it multiplexes it with the terminal number as a constant offset, but

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

2022-09-15 Thread Michael Ellerman
"Nicholas Piggin" writes: > 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 4/6] static_call: Move static call selftest to static_call_selftest.c

2022-09-15 Thread Benjamin Gray
These tests are out-of-line only, so moving them to the their own file allows them to be run when an arch does not implement inline static calls. Signed-off-by: Benjamin Gray --- kernel/Makefile | 1 + kernel/static_call_inline.c | 43 --- kernel/

[PATCH 6/6] powerpc/64: Add tests for out-of-line static calls

2022-09-15 Thread Benjamin Gray
KUnit tests for the various combinations of caller/trampoline/target and kernel/module. They must be run from a module loaded at runtime to guarantee they have a different TOC to the kernel. The tests try to mitigate the chance of panicing by restoring the TOC after every static call. Not all poss

[PATCH 0/6] Out-of-line static calls for powerpc64 ELF V2

2022-09-15 Thread Benjamin Gray
Implementation of out-of-line static calls for PowerPC 64-bit ELF V2 ABI. Static calls patch an indirect branch into a direct branch at runtime. Out-of-line specifically has a caller directly call a trampoline, and the trampoline gets patched to directly call the target. More context regarding the

[PATCH 3/6] powerpc/module: Optimise nearby branches in ELF V2 ABI stub

2022-09-15 Thread Benjamin Gray
Inserts a direct branch to the stub target when possible, replacing the mtctr/btctr sequence. The load into r12 could potentially be skipped too, but that change would need to refactor the arguments to indicate that the address does not have a separate local entry point. This helps the static cal

[PATCH 5/6] powerpc/64: Add support for out-of-line static calls

2022-09-15 Thread Benjamin Gray
Implement static call support for 64 bit V2 ABI. This requires making sure the TOC is kept correct across kernel-module boundaries. As a secondary concern, it tries to use the local entry point of a target wherever possible. It does so by checking if both tramp & target are kernel code, and falls b

[PATCH 1/6] powerpc/code-patching: Implement generic text patching function

2022-09-15 Thread Benjamin Gray
Adds a generic text patching mechanism for patches of 1, 2, 4, or 8 bytes. The patcher conditionally syncs the icache depending on if the content will be executed (as opposed to, e.g., read-only data). The `patch_instruction` function is reimplemented in terms of this more generic function. This g

[PATCH 2/6] powerpc/module: Handle caller-saved TOC in module linker

2022-09-15 Thread Benjamin Gray
The callee may set a field in `st_other` to 1 to indicate r2 should be treated as caller-saved. This means a trampoline must be used to save the current TOC before calling it and restore it afterwards, much like external calls. This is necessary for supporting V2 ABI static calls that do not prese

[PATCH 5/5] tty: hvc: remove HVC_IUCV_MAGIC

2022-09-15 Thread наб
According to Greg, in the context of magic numbers as defined in magic-number.rst, "the tty layer should not need this and I'll gladly take patches" This stretches that definition slightly, since it multiplexes it with the terminal number as a constant offset, but is equivalent Ref: https://lore.

Re: [PATCH 00/23] powerpc: Syscall wrapper and register clearing

2022-09-15 Thread Rohan McLure
> On 16 Sep 2022, at 3:32 pm, Rohan McLure wrote: > > V4 available here: > > Link: > https://lore.kernel.org/all/20220824020548.62625-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

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

2022-09-15 Thread Rohan McLure
> On 16 Sep 2022, at 3:32 pm, Rohan McLure wrote: > > 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-

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

2022-09-15 Thread Rohan McLure
V4 available here: Link: https://lore.kernel.org/all/20220824020548.62625-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 wh

[PATCH 12/23] powerpc: Remove direct call to personality syscall handler

2022-09-15 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 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-15 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. Signed-off-by: Rohan

[PATCH 11/23] powerpc/32: Remove powerpc select specialisation

2022-09-15 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 07/23] powerpc/64s: Fix comment on interrupt handler prologue

2022-09-15 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 15/23] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-09-15 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 order is

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

2022-09-15 Thread Rohan McLure
As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate compatibility handlers assume parameters are passed with 32-bit big-endian ABI. This affects the assignment of odd-even parameter pairs to the high or low words of a 64-bit syscall parameter. Fix fadvise64_64 fallocate compat han

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

2022-09-15 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 10/23] powerpc: Use generic fallocate compatibility syscall

2022-09-15 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 22/23] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-15 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

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

2022-09-15 Thread Rohan McLure
Add Kconfig option for enabling clearing of registers on arrival in an interrupt handler. This reduces the speculation influence of registers on kernel internals. The option will be consumed by 64-bit systems that feature speculation and wish to implement this mitigation. This patch only introduce

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

2022-09-15 Thread Rohan McLure
Restoring the register state of the interrupted thread involves issuing a large number of predictable loads to the kernel stack frame. Issue the REST_GPR{,S} macros to clearly signal when this is happening, and bunch together restores at the end of the interrupt handler where the saved value is not

[PATCH 02/23] powerpc: Save caller r3 prior to system_call_exception

2022-09-15 Thread Rohan McLure
This reverts commit 8875f47b7681 ("powerpc/syscall: Save r3 in regs->orig_r3 "). Save caller's original r3 state to the kernel stackframe before entering system_call_exception. This allows for user registers to be cleared by the time system_call_exception is entered, reducing the influence of user

[PATCH 04/23] powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-09-15 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 user gpr value we are hoping to save is still live. In the syscall interrupt handler

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

2022-09-15 Thread Rohan McLure
Cause syscall handlers to be typed as follows when called indirectly throughout the kernel. This is to allow for better type checking. typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); Since both 32 and

[PATCH 19/23] powerpc: Provide syscall wrapper

2022-09-15 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 09/23] asm-generic: compat: Support BE for long long args in 32-bit ABIs

2022-09-15 Thread Rohan McLure
32-bit ABIs support passing 64-bit integers by registers via argument translation. Commit 59c10c52f573 ("riscv: compat: syscall: Add compat_sys_call_table implementation") implements the compat_arg_u64 macro for efficiently defining little endian compatibility syscalls. Architectures supporting bi

[PATCH 14/23] powerpc: Provide do_ppc64_personality helper

2022-09-15 Thread Rohan McLure
Avoid duplication in future patch that will define the ppc64_personality syscall handler in terms of the SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE macros, by extracting the common body of ppc64_personality into a helper function. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2 ->

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

2022-09-15 Thread Rohan McLure
The common interrupt handler prologue macro and the bad_stack trampolines include consecutive sequences of register saves, and some register clears. Neaten such instances by expanding use of the SAVE_GPRS macro and employing the ZEROIZE_GPR macro when appropriate. Also simplify an invocation of SA

[PATCH 13/23] powerpc: Remove direct call to mmap2 syscall handlers

2022-09-15 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 a helper function. Remove 'inline' on st

[PATCH 01/23] powerpc: Remove asmlinkage from syscall handler definitions

2022-09-15 Thread Rohan McLure
The asmlinkage macro has no special meaning in powerpc, and prior to this patch is used sporadically on some syscall handler definitions. On architectures that do not define asmlinkage, it resolves to extern "C" for C++ compilers and a nop otherwise. The current invocations of asmlinkage provide fa

[PATCH 03/23] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-09-15 Thread Rohan McLure
Provide register zeroing macros, following the same convention as existing register stack save/restore macros, to be used in later change to concisely zero a sequence of consecutive gprs. The resulting macros are called ZEROIZE_GPRS and ZEROIZE_NVGPRS, keeping with the naming of the accompanying r

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

2022-09-15 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 23/23] powerpc/64e: Clear gprs on interrupt routine entry on Book3E

2022-09-15 Thread Rohan McLure
Zero GPRS r14-r31 on entry into the kernel for interrupt sources to limit influence of user-space values in potential speculation gadgets. Prior to this commit, all other GPRS are reassigned during the common prologue to interrupt handlers and so need not be zeroised explicitly. This may be done s

[PATCH] powerpc: Save AMR/IAMR when switching tasks

2022-09-15 Thread Samuel Holland
With CONFIG_PREEMPT=y (involuntary preemption enabled), it is possible to switch away from a task inside copy_{from,to}_user. This left the CPU with userspace access enabled until after the next IRQ or privilege level switch, when AMR/IAMR got reset to AMR_KU[AE]P_BLOCKED. Then, when switching back

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

2022-09-15 Thread Anup Patel
On Wed, May 4, 2022 at 1:18 PM Alexey Kardashevskiy wrote: > > When introduced, IRQFD resampling worked on POWER8 with XICS. However > KVM on POWER9 has never implemented it - the compatibility mode code > ("XICS-on-XIVE") misses the kvm_notify_acked_irq() call and the native > XIVE mode does not

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

2022-09-15 Thread Nicholas Piggin
Const function pointers by convention live in .data.rel.ro if they need to be relocated. Now that .data.rel.ro is linked into the read-only region, put them in the right section. This doesn't make much practical difference, but it will make the C conversion of sys_call_table a smaller change as far

[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/po

[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 1006

[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 changed

[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/k

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

2022-09-15 Thread Nicholas Piggin
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-only at boot is done using __init_begin, change that that to use __end_rodata. This removes the requirement for the init section to follow

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

2022-09-15 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 Since v1: - Move sys_call_table data.rel.ro patch to the end. - And fix the changelog in th

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
On Tue Sep 13, 2022 at 10:45 PM AEST, Michael Ellerman wrote: > In interrupt_64.S, formerly entry_64.S, there are two toc entries > created for sys_call_table and compat_sys_call_table. > > These are no longer used, since the system call entry was converted from > asm to C, so remove them. > Acked

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 Kardashevskiy wrote: > > > > > > On

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 indirectly > >> throughout the kernel. > >> > >> ty

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 > >> other interrupt sources to limit influen

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 powerpc/32 from generating >

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-only at boot is done using __init_

Re: [RFC 0/3] Asynchronous EEH recovery

2022-09-15 Thread Ganesh
On 9/2/22 05:49, Jason Gunthorpe wrote: On Tue, Aug 16, 2022 at 08:57:13AM +0530, Ganesh Goudar wrote: Hi, EEH reocvery is currently serialized and these patches shorten the time taken for EEH recovery by making the recovery to run in parallel. The original author of these patches is Sam Bobro

[linux-next:master] BUILD REGRESSION 6ce5d01e7011b32600656bf90a626b1e51fb192a

2022-09-15 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: 6ce5d01e7011b32600656bf90a626b1e51fb192a Add linux-next specific files for 20220915 Error/Warning reports: https://lore.kernel.org/linux-mm/202209150141.wgbakqmx-...@intel.com https

Re: [PATCH v3 4/4] arm64: support batched/deferred tlb shootdown during page reclamation

2022-09-15 Thread Nadav Amit
> On Sep 14, 2022, at 11:42 PM, Barry Song <21cn...@gmail.com> wrote: > >> >> The very idea behind TLB deferral is the opportunity it (might) provide >> to accumulate address ranges and cpu masks so that individual TLB flush >> can be replaced with a more cost effective range based TLB flush.

Re: [PATCH] powerpc/pseries: add lparctl driver for platform-specific functions

2022-09-15 Thread Nathan Lynch
Michal Suchánek writes: > On Tue, Sep 13, 2022 at 12:02:42PM -0500, Nathan Lynch wrote: >> Anyway, of course I intend to support the more complex calls, but >> supporting the simple calls actually unbreaks a lot of stuff. > > The thing is that supporting calls that return more than one page of > d

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

2022-09-15 Thread Michael Ellerman
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 powerpc/32 from generating >> R_PPC_UADDR32 relocations (which are not handled). The sys_call_tabl

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

2022-09-15 Thread Michael Ellerman
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-only at boot is done using __init_begin, > change that that to use __end_rodata. Did you just do that bec

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

2022-09-15 Thread Nicholas Piggin
Ensure r13 is zero from very early in boot until it gets set to the boot paca pointer. This allows early program and mce handlers to halt if there is no valid paca, rather than potentially run off into the weeds. This preserves register and memory contents for low level debugging tools. Nothing co

[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/kerne

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

2022-09-15 Thread Nicholas Piggin
relocate() uses r13 in early boot before it is used for the paca. Use a different register for this so r13 is kept unchanged until it is set to the paca pointer. Avoid r14 as well while we're here, there's no reason not to use the volatile registers which is a bit less surprising, and r14 could be

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

2022-09-15 Thread Nicholas Piggin
Use the early boot interrupt fixup in the machine check handler to allow the machine check handler to run before interrupt endian is set up. Branch to an early boot handler that just does a basic crash, which allows it to run before ppc_md is set up. MSR[ME] is enabled on the boot CPU earlier, and

[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
This prevents interrupts in early boot (e.g., program check) from enabling MSR[EE], potentially causing endian mismatch or other crashes when reporting early boot traps. Fixes: 4423eb5ae32ec ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nic

[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

Re: [RFC PATCH v1] spi: fsl_spi: Convert to transfer_one

2022-09-15 Thread Mark Brown
On Thu, 18 Aug 2022 15:38:37 +0200, Christophe Leroy wrote: > Let the core handle all the chipselect bakery and replace > transfer_one_message() by transfer_one() and prepare_message(). > > At the time being, there is fsl_spi_cs_control() to handle > chipselects. That function handles both GPIO an

Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn}

2022-09-15 Thread Peter Zijlstra
On Thu, Sep 15, 2022 at 10:56:58AM +0800, Chen Zhongjin wrote: > We have found some anonymous information on x86 in .rodata. Well yes, but that's still a bunch of heuristics on our side. > I'm not sure if those are *all* of Josh wanted on x86, however for arm64 we > did not found that in the sam