[PATCH v4 03/21] powerpc: remove arguments from fault handler functions

2021-01-02 Thread Nicholas Piggin
Make mm fault handlers all just take the pt_regs * argument and load DAR/DSISR from that. Make those that return a value return long. This is done to make the function signatures match other handlers, which will help with a future patch to add wrappers. Explicit arguments could be added for

[PATCH v4 07/21] powerpc: add interrupt wrapper entry / exit stub functions

2021-01-02 Thread Nicholas Piggin
These will be used by subsequent patches. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 66 1 file changed, 66 insertions(+) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index

[PATCH v4 16/21] powerpc/64: move account_stolen_time into its own function

2021-01-02 Thread Nicholas Piggin
This will be used by interrupt entry as well. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/cputime.h | 15 +++ arch/powerpc/kernel/syscall_64.c | 10 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/cputime.h

[PATCH v4 19/21] powerpc/64s: move NMI soft-mask handling to C

2021-01-02 Thread Nicholas Piggin
Saving and restoring soft-mask state can now be done in C using the interrupt handler wrapper functions. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 26 arch/powerpc/kernel/exceptions-64s.S | 60 2 files changed, 26

[PATCH v4 21/21] powerpc/64s: power4 nap fixup in C

2021-01-02 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 15 + arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/include/asm/thread_info.h | 6

[PATCH v4 08/21] powerpc: add interrupt_cond_local_irq_enable helper

2021-01-02 Thread Nicholas Piggin
Simple helper for synchronous interrupt handlers (i.e., process-context) to enable interrupts if it was taken in an interrupts-enabled context. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/kernel/traps.c | 24

[PATCH v4 11/21] powerpc/64: context tracking move to interrupt wrappers

2021-01-02 Thread Nicholas Piggin
This moves exception_enter/exit calls to wrapper functions for synchronous interrupts. More interrupt handlers are covered by this than previously. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 9 arch/powerpc/kernel/traps.c | 74

[PATCH v4 02/21] powerpc/64s: move the last of the page fault handling logic to C

2021-01-02 Thread Nicholas Piggin
The page fault handling still has some complex logic particularly around hash table handling, in asm. Implement this in C instead. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + arch/powerpc/kernel/exceptions-64s.S | 131 +++---

[PATCH v4 04/21] powerpc: bad_page_fault, do_break get registers from regs

2021-01-02 Thread Nicholas Piggin
Similar to the previous patch this makes interrupt handler function types more regular so they can be wrapped with the next patch. bad_page_fault and do_break are not performance critical. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/bug.h | 4 ++--

[PATCH v4 10/21] powerpc/64s/hash: improve context tracking of hash faults

2021-01-02 Thread Nicholas Piggin
This moves the 64s/hash context tracking from hash_page_mm() to __do_hash_fault(), so it's no longer called by OCXL / SPU accelerators, which was certainly the wrong thing to be doing, because those callers are not low level interrupt handlers, so should have entered a kernel context tracking

[PATCH v4 12/21] powerpc/64: add context tracking to asynchronous interrupts

2021-01-02 Thread Nicholas Piggin
Previously context tracking was not done for asynchronous interrupts, (those that run in interrupt context), and if those would cause a reschedule when they exit, then scheduling functions (schedule_user, preempt_schedule_irq) call exception_enter/exit to fix this up and exit user context. This

[PATCH v4 18/21] powerpc: move NMI entry/exit code into wrapper

2021-01-02 Thread Nicholas Piggin
This moves the common NMI entry and exit code into the interrupt handler wrappers. This changes the behaviour of soft-NMI (watchdog) and HMI interrupts, and also MCE interrupts on 64e, by adding missing parts of the NMI entry to them. Signed-off-by: Nicholas Piggin ---

[PATCH v4 20/21] powerpc/64s: runlatch interrupt handling in C

2021-01-02 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/kernel/exceptions-64s.S | 18 -- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git

[PATCH v4 00/21] powerpc: interrupt wrappers

2021-01-02 Thread Nicholas Piggin
This adds interrupt handler wrapper functions, similar to the generic / x86 code, and moves several common operations into them from either asm or open coded in the individual handlers. Since v1: - Fixed a couple of compile issues - Fixed perf weirdness (sometimes NMI, sometimes not) - Also move

[PATCH v4 05/21] powerpc/perf: move perf irq/nmi handling details into traps.c

2021-01-02 Thread Nicholas Piggin
This is required in order to allow more significant differences between NMI type interrupt handlers and regular asynchronous handlers. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/traps.c | 31 +++- arch/powerpc/perf/core-book3s.c | 35

[PATCH v4 14/21] powerpc/64s: move context tracking exit to interrupt exit path

2021-01-02 Thread Nicholas Piggin
The interrupt handler wrapper functions are not the ideal place to maintain context tracking because after they return, the low level exit code must then determine if there are interrupts to replay, or if the task should be preempted, etc. Those paths (e.g., schedule_user) include their own

[PATCH v4 15/21] powerpc/64s: reconcile interrupts in C

2021-01-02 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 15 +++ arch/powerpc/kernel/exceptions-64s.S | 26 -- 2 files changed, 11 insertions(+), 30 deletions(-)

[PATCH v4 01/21] powerpc/32s: Do DABR match out of handle_page_fault()

2021-01-02 Thread Nicholas Piggin
From: Christophe Leroy handle_page_fault() has some code dedicated to book3s/32 to call do_break() when the DSI is a DABR match. On other platforms, do_break() is handled separately. Do the same for book3s/32, do it earlier in the process of DSI. This change also avoid doing the test on ISI.

[PATCH v4 06/21] powerpc: interrupt handler wrapper functions

2021-01-02 Thread Nicholas Piggin
Add wrapper functions (derived from x86 macros) for interrupt handler functions. This allows interrupt entry code to be written in C. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/asm-prototypes.h | 29 --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 -

[PATCH v4 09/21] powerpc/64: context tracking remove _TIF_NOHZ

2021-01-02 Thread Nicholas Piggin
Add context tracking to the system call handler explicitly, and remove _TIF_NOHZ. This saves 35 cycles on gettid system call cost on POWER9 with a CONFIG_NOHZ_FULL kernel. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/thread_info.h |

[PATCH v4 13/21] powerpc: handle irq_enter/irq_exit in interrupt handler wrappers

2021-01-02 Thread Nicholas Piggin
Move irq_enter/irq_exit into asynchronous interrupt handler wrappers. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 2 ++ arch/powerpc/kernel/dbell.c | 3 +-- arch/powerpc/kernel/irq.c| 4 arch/powerpc/kernel/tau_6xx.c| 3 ---

[PATCH v4 17/21] powerpc/64: entry cpu time accounting in C

2021-01-02 Thread Nicholas Piggin
There is no need for this to be in asm, use the new intrrupt entry wrapper. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/interrupt.h | 7 +++ arch/powerpc/include/asm/ppc_asm.h | 24 arch/powerpc/kernel/exceptions-64e.S | 1 -

Re: [PATCH v4 02/21] powerpc/64s: move the last of the page fault handling logic to C

2021-01-02 Thread Christophe Leroy
Nicholas Piggin a écrit : The page fault handling still has some complex logic particularly around hash table handling, in asm. Implement this in C instead. Hi, I'm afk at the moment and unable to look at this in details before one week but this looks pretty complexe, especially the churn

[PATCH v2] powerpc: fix alignment bug whithin the init sections

2021-01-02 Thread Ariel Marcovitch
This is a bug that causes early crashes in builds with a .exit.text section smaller than a page and a .init.text section that ends in the beginning of a physical page (this is kinda random, which might explain why this wasn't really encountered before). The init sections are ordered like this:

[PATCH 2/2] powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode

2021-01-02 Thread Will Springer
Swap upper/lower 32 bits for 64-bit compat syscalls, conditioned on endianness. This is modeled after the same functionality in arch/mips/kernel/linux32.c. This fixes compat_sys on ppc64le, when called by 32-bit little-endian processes. Tested with `file /bin/bash` (pread64) and `truncate -s 5G

[PATCH 0/2] powerpc: fixes for 32-bit little-endian processes

2021-01-02 Thread Will Springer
These are a couple small fixes that enable 32-bit little endian ("ppcle") processes to run on a ppc64le kernel. Currently this is of interest for the purposes of emulating ia32 programs with native userland assistance via box86[1] (see PR#279 for initial ppc support), but a standalone userland is

[PATCH 1/2] powerpc: use kernel endianness in MSR in 32-bit signal handler

2021-01-02 Thread Will Springer
From: Joseph J Allen This mirrors the behavior in handle_rt_signal32, to obey kernel endianness rather than assume a 32-bit process is big-endian. Without this change, any 32-bit little-endian process will SIGILL immediately upon handling a signal. Signed-off-by: Joseph J Allen Signed-off-by: