[PATCH v11 1/8] powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro

2020-03-19 Thread Michal Suchanek
interface unconditionally. Link: https://lore.kernel.org/lkml/20190828151552.ga16...@infradead.org/ Link: https://lore.kernel.org/lkml/20190829214319.498c7de2@naga/ Signed-off-by: Michal Suchanek Reviewed-by: Arnd Bergmann --- v7: new patch --- arch/powerpc/include/asm/unistd.h | 1 + fs/re

[PATCH v11 0/8] Disable compat cruft on ppc64le v11

2020-03-19 Thread Michal Suchanek
v10: - rebase, sent together with the syscall cleanup Changes in v11: - rebase - add MAINTAINERS pattern for ppc perf Michal Suchanek (8): powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro powerpc: move common register copy functions from signal_32.c to signal.c powerpc/perf: consolidate

[PATCH v11 2/8] powerpc: move common register copy functions from signal_32.c to signal.c

2020-03-19 Thread Michal Suchanek
These functions are required for 64bit as well. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 141 arch/powerpc/kernel/signal_32.c | 140 --- 2 files changed, 141 insertions

[PATCH v11 3/8] powerpc/perf: consolidate read_user_stack_32

2020-03-19 Thread Michal Suchanek
There are two almost identical copies for 32bit and 64bit. The function is used only in 32bit code which will be split out in next patch so consolidate to one function. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v6: new patch v8: move the consolidated function out of

[PATCH v11 5/8] powerpc/64: make buildable without CONFIG_COMPAT

2020-03-19 Thread Michal Suchanek
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek --- v2: - fix 32bit ifdef condition in signal.c - simplify the compat ifdef condition in vdso.c - 64bit is redundant - simplify the compat ifdef condition in callchain.c

[PATCH v11 4/8] powerpc/perf: consolidate valid_user_sp

2020-03-19 Thread Michal Suchanek
valid 32bit area on 64bit: #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) #define STACK_TOP_USER32 TASK_SIZE_USER32 Signed-off-by: Michal Suchanek --- v8: new patch v11: simplify by using is_32bit_task() --- arch/powerpc/perf/callchain.c | 27 +++ 1

[PATCH v11 6/8] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.

2020-03-19 Thread Michal Suchanek
On bigendian ppc64 it is common to have 32bit legacy binaries but much less so on littleendian. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v3: make configurable --- arch/powerpc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH v11 8/8] MAINTAINERS: perf: Add pattern that matches ppc perf to the perf entry.

2020-03-19 Thread Michal Suchanek
Signed-off-by: Michal Suchanek --- v10: new patch --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bc8dbe4fe4c9..329bf4a31412 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13088,6 +13088,8 @@ F: arch/*/kernel/*/perf_event*.c F: arch

[PATCH v11 7/8] powerpc/perf: split callchain.c by bitness

2020-03-19 Thread Michal Suchanek
Building callchain.c with !COMPAT proved quite ugly with all the defines. Splitting out the 32bit and 64bit parts looks better. No code change intended. Signed-off-by: Michal Suchanek --- v6: - move current_is_64bit consolidetaion to earlier patch - move defines to the top of callchain_32.c

[PATCH v11 0/8] Disable compat cruft on ppc64le v11

2020-03-19 Thread Michal Suchanek
v10: - rebase, sent together with the syscall cleanup Changes in v11: - rebase - add MAINTAINERS pattern for ppc perf Michal Suchanek (8): powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro powerpc: move common register copy functions from signal_32.c to signal.c powerpc/perf: consolidate

[PATCH v11 1/8] powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro

2020-03-19 Thread Michal Suchanek
interface unconditionally. Link: https://lore.kernel.org/lkml/20190828151552.ga16...@infradead.org/ Link: https://lore.kernel.org/lkml/20190829214319.498c7de2@naga/ Signed-off-by: Michal Suchanek Reviewed-by: Arnd Bergmann --- v7: new patch --- arch/powerpc/include/asm/unistd.h | 1 + fs/re

[PATCH v11 2/8] powerpc: move common register copy functions from signal_32.c to signal.c

2020-03-19 Thread Michal Suchanek
These functions are required for 64bit as well. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 141 arch/powerpc/kernel/signal_32.c | 140 --- 2 files changed, 141 insertions

[PATCH v11 4/8] powerpc/perf: consolidate valid_user_sp

2020-03-19 Thread Michal Suchanek
valid 32bit area on 64bit: #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) #define STACK_TOP_USER32 TASK_SIZE_USER32 Signed-off-by: Michal Suchanek --- v8: new patch v11: simplify by using is_32bit_task() --- arch/powerpc/perf/callchain.c | 27 +++ 1

[PATCH v11 3/8] powerpc/perf: consolidate read_user_stack_32

2020-03-19 Thread Michal Suchanek
There are two almost identical copies for 32bit and 64bit. The function is used only in 32bit code which will be split out in next patch so consolidate to one function. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v6: new patch v8: move the consolidated function out of

[PATCH v11 5/8] powerpc/64: make buildable without CONFIG_COMPAT

2020-03-19 Thread Michal Suchanek
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek --- v2: - fix 32bit ifdef condition in signal.c - simplify the compat ifdef condition in vdso.c - 64bit is redundant - simplify the compat ifdef condition in callchain.c

[PATCH v11 6/8] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.

2020-03-19 Thread Michal Suchanek
On bigendian ppc64 it is common to have 32bit legacy binaries but much less so on littleendian. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v3: make configurable --- arch/powerpc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH v11 7/8] powerpc/perf: split callchain.c by bitness

2020-03-19 Thread Michal Suchanek
Building callchain.c with !COMPAT proved quite ugly with all the defines. Splitting out the 32bit and 64bit parts looks better. No code change intended. Signed-off-by: Michal Suchanek --- v6: - move current_is_64bit consolidetaion to earlier patch - move defines to the top of callchain_32.c

[PATCH v11 8/8] MAINTAINERS: perf: Add pattern that matches ppc perf to the perf entry.

2020-03-19 Thread Michal Suchanek
Signed-off-by: Michal Suchanek --- v10: new patch --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bc8dbe4fe4c9..329bf4a31412 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13088,6 +13088,8 @@ F: arch/*/kernel/*/perf_event*.c F: arch

[PATCH v12 1/8] powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro

2020-03-20 Thread Michal Suchanek
interface unconditionally. Link: https://lore.kernel.org/lkml/20190828151552.ga16...@infradead.org/ Link: https://lore.kernel.org/lkml/20190829214319.498c7de2@naga/ Signed-off-by: Michal Suchanek Reviewed-by: Arnd Bergmann --- v7: new patch --- arch/powerpc/include/asm/unistd.h | 1 + fs/re

[PATCH v12 0/8] Disable compat cruft on ppc64le v12

2020-03-20 Thread Michal Suchanek
v10: - rebase, sent together with the syscall cleanup Changes in v11: - rebase - add MAINTAINERS pattern for ppc perf Changes in v12: - simplify valid_user_sp and change to invalid_user_sp - remove superfluous perf patterns in MAINTAINERS Michal Suchanek (8): powerpc: Add back

[PATCH v12 2/8] powerpc: move common register copy functions from signal_32.c to signal.c

2020-03-20 Thread Michal Suchanek
These functions are required for 64bit as well. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 141 arch/powerpc/kernel/signal_32.c | 140 --- 2 files changed, 141 insertions

[PATCH v12 3/8] powerpc/perf: consolidate read_user_stack_32

2020-03-20 Thread Michal Suchanek
There are two almost identical copies for 32bit and 64bit. The function is used only in 32bit code which will be split out in next patch so consolidate to one function. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v6: new patch v8: move the consolidated function out of

[PATCH v12 4/8] powerpc/perf: consolidate valid_user_sp -> invalid_user_sp

2020-03-20 Thread Michal Suchanek
valid 32bit area on 64bit: #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) #define STACK_TOP_USER32 TASK_SIZE_USER32 Change return value to bool. It is inverted by users anyway. Change to invalid_user_sp to avoid inverting the return value twice. Signed-off-by: Michal Suchanek

[PATCH v12 5/8] powerpc/64: make buildable without CONFIG_COMPAT

2020-03-20 Thread Michal Suchanek
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek --- v2: - fix 32bit ifdef condition in signal.c - simplify the compat ifdef condition in vdso.c - 64bit is redundant - simplify the compat ifdef condition in callchain.c

[PATCH v12 6/8] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.

2020-03-20 Thread Michal Suchanek
On bigendian ppc64 it is common to have 32bit legacy binaries but much less so on littleendian. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v3: make configurable --- arch/powerpc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH v12 7/8] powerpc/perf: split callchain.c by bitness

2020-03-20 Thread Michal Suchanek
Building callchain.c with !COMPAT proved quite ugly with all the defines. Splitting out the 32bit and 64bit parts looks better. No code change intended. Signed-off-by: Michal Suchanek --- v6: - move current_is_64bit consolidetaion to earlier patch - move defines to the top of callchain_32.c

[PATCH v12 8/8] MAINTAINERS: perf: Add pattern that matches ppc perf to the perf entry.

2020-03-20 Thread Michal Suchanek
While at it also simplify the existing perf patterns. Signed-off-by: Michal Suchanek --- v10: new patch V12: remove redundant entries --- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index e1a99197fb34..578429d0 100644 --- a

[PATCH] powerpc/64: Fix section mismatch warnings.

2020-03-26 Thread Michal Suchanek
start_here_common lacks a __init annotation or the annotation of start_kernel is wrong. Signed-off-by: Michal Suchanek --- arch/powerpc/kernel/head_64.S | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index ad79fddb974d

[PATCH] powerpc/fadump: Remove duplicate message.

2019-10-23 Thread Michal Suchanek
There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Due to different capitalization it is clear that the one in setup_fadump is shown on boot. Remove the duplicate that is not shown. Signed-off-by: Michal Suchanek --- arch/powerpc/kernel/fadump.c

[PATCH v3] powerpc/fadump: when fadump is supported register the fadump sysfs files.

2019-11-07 Thread Michal Suchanek
future. With this patch sysfs files are available whenever fadump is supported by firmware. There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Remove the duplicate message in setup_fadump. Signed-off-by: Michal Suchanek --- v2: move the sysfs

[PATCH 00/33] exception cleanup, syscall in C and !COMPAT

2019-11-12 Thread Michal Suchanek
Hello, This is merge of https://patchwork.ozlabs.org/cover/1162376/ (except two last experimental patches) and https://patchwork.ozlabs.org/patch/1162079/ rebased on top of master. There was minor conflict in Makefile in the latter series. Thanks Michal Michal Suchanek (8): powerpc: Add

[PATCH 01/33] powerpc/64s/exception: Introduce INT_DEFINE parameter block for code generation

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The code generation macro arguments are difficult to read, and defaults can't easily be used. This introduces a block where parameters can be set for interrupt handler code generation by the subsequent macros, and adds the first generation macro for interrupt entry. One in

[PATCH 02/33] powerpc/64s/exception: Add GEN_COMMON macro that uses INT_DEFINE parameters

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S ind

[PATCH 03/33] powerpc/64s/exception: Add GEN_KVM macro that uses INT_DEFINE parameters

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 591ae2a73e

[PATCH 04/33] powerpc/64s/exception: Expand EXC_COMMON and EXC_COMMON_ASYNC macros

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin These don't provide a large amount of code sharing. Removing them makes code easier to shuffle around. For example, some of the common instructions will be moved into the common code gen macro. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/ker

[PATCH 05/33] powerpc/64s/exception: Move all interrupt handlers to new style code gen macros

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Aside from label names and BUG line numbers, the generated code change is an additional HMI KVM handler added for the "late" KVM handler, because early and late HMI generation is achieved by defining two different interrupt types. Signed-off-by: Nicholas Piggin --- arch/p

[PATCH 06/33] powerpc/64s/exception: Remove old INT_ENTRY macro

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index b5decc9a0cbf..ba2dc

[PATCH 08/33] powerpc/64s/exception: Remove old INT_KVM_HANDLER

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 55 +--- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index f318869607db..bef0c

[PATCH 07/33] powerpc/64s/exception: Remove old INT_COMMON macro

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 51 +--- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index ba2dcd91aaaf..f3188

[PATCH 09/33] powerpc/64s/exception: Add ISIDE option

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Rather than using DAR=2 to select the i-side registers, add an explicit option. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/excepti

[PATCH 10/33] powerpc/64s/exception: move real->virt switch into the common handler

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The real mode interrupt entry points currently use rfid to branch to the common handler in virtual mode. This is a significant amount of code, and forces other code (notably the KVM test) to live in the real mode handler. In the interest of minimising the amount of code tha

[PATCH 11/33] powerpc/64s/exception: move soft-mask test to common code

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin As well as moving code out of the unrelocated vectors, this allows the masked handlers to be moved to common code, and allows the soft_nmi handler to be generated more like a regular handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 106 ++

[PATCH 12/33] powerpc/64s/exception: move KVM test to common code

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin This allows more code to be moved out of unrelocated regions. The system call KVMTEST is changed to be open-coded and remain in the tramp area to avoid having to move it to entry_64.S. The custom nature of the system call entry code means the hcall case can be made more stre

[PATCH 13/33] powerpc/64s/exception: remove confusing IEARLY option

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Replace IEARLY=1 and IEARLY=2 with IBRANCH_COMMON, which controls if the entry code branches to a common handler; and IREALMODE_COMMON, which controls whether the common handler should remain in real mode. These special cases no longer avoid loading the SRR registers, there

[PATCH 14/33] powerpc/64s/exception: remove the SPR saving patch code macros

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin These are used infrequently enough they don't provide much help, so inline them. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 82 ++-- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kernel/

[PATCH 15/33] powerpc/64s/exception: trim unused arguments from KVMTEST macro

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index abf26db36427..9fa71d51ecf4 100644 --- a

[PATCH 16/33] powerpc/64s/exception: hdecrementer avoid touching the stack

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The hdec interrupt handler is reported to sometimes fire in Linux if KVM leaves it pending after a guest exists. This is harmless, so there is a no-op handler for it. The interrupt handler currently uses the regular kernel stack. Change this to avoid touching the stack enti

[PATCH 17/33] powerpc/64s/exception: re-inline some handlers

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The reduction in interrupt entry size allows some handlers to be re-inlined. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powe

[PATCH 18/33] powerpc/64s/exception: Clean up SRR specifiers

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Remove more magic numbers and replace with nicely named bools. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 +--- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH 19/33] powerpc/64s/exception: add more comments for interrupt handlers

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin A few of the non-standard handlers are left uncommented. Some more description could be added to some. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 391 --- 1 file changed, 353 insertions(+), 38 deletions(-) diff --git

[PATCH 20/33] powerpc/64s/exception: only test KVM in SRR interrupts when PR KVM is supported

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin Apart from SRESET, MCE, and syscall (hcall variant), the SRR type interrupts are not escalated to hypervisor mode, so delivered to the OS. When running PR KVM, the OS is the hypervisor, and the guest runs with MSR[PR]=1, so these interrupts must test if a guest was running

[PATCH 21/33] powerpc/64s/exception: soft nmi interrupt should not use ret_from_except

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The soft nmi handler does not reconcile interrupt state, so it should not return via the normal ret_from_except path. Return like other NMIs, using the EXCEPTION_RESTORE_REGS macro. This becomes important when the scv interrupt is implemented, which must handle soft-masked

[PATCH 22/33] powerpc/64: system call remove non-volatile GPR save optimisation

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin powerpc has an optimisation where interrupts avoid saving the non-volatile (or callee saved) registers to the interrupt stack frame if they are not required. Two problems with this are that an interrupt does not always know whether it will need non-volatiles; and if it does

[PATCH 23/33] powerpc/64: system call implement the bulk of the logic in C

2019-11-12 Thread Michal Suchanek
% faster after this patch, because the exit work is handled under local_irq_disable, and the hard mask and pending interrupt replay is handled after that, which avoids games with MSR. Signed-off-by: Nicholas Piggin [ms: add endian conversion for dtl_idx] Signed-off-by: Michal Suchanek v3: - Fix !KUAP

[PATCH 24/33] powerpc/64s: interrupt return in C

2019-11-12 Thread Michal Suchanek
ced mtmsrd. Signed-off-by: Nicholas Piggin [ms: move the FP restore functions to restore_math. They are not used anywhere else and when restore_math is not built gcc warns about them being unused.] Signed-off-by: Michal Suchanek --- .../powerpc/include/asm/book3s/64/kup-radix.h | 10 + ar

[PATCH 25/33] powerpc/64s/exception: remove lite interrupt return

2019-11-12 Thread Michal Suchanek
From: Nicholas Piggin The difference between lite and regular returns is that the lite case restores all NVGPRs, whereas lite skips that. This is quite clumsy though, most interrupts want the NVGPRs saved for debugging, not to modify in the caller, so the NVGPRs restore is not necessary most of t

[PATCH 26/33] powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro

2019-11-12 Thread Michal Suchanek
interface unconditionally. Link: https://lore.kernel.org/lkml/20190828151552.ga16...@infradead.org/ Link: https://lore.kernel.org/lkml/20190829214319.498c7de2@naga/ Signed-off-by: Michal Suchanek Reviewed-by: Arnd Bergmann --- arch/powerpc/include/asm/unistd.h | 1 + fs/read_write.c

[PATCH 27/33] powerpc: move common register copy functions from signal_32.c to signal.c

2019-11-12 Thread Michal Suchanek
These functions are required for 64bit as well. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 141 arch/powerpc/kernel/signal_32.c | 140 --- 2 files changed, 141 insertions

[PATCH 28/33] powerpc/perf: consolidate read_user_stack_32

2019-11-12 Thread Michal Suchanek
There are two almost identical copies for 32bit and 64bit. The function is used only in 32bit code which will be split out in next patch so consolidate to one function. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v6: new patch v8: move the consolidated function out of the

[PATCH 29/33] powerpc/perf: consolidate valid_user_sp

2019-11-12 Thread Michal Suchanek
Merge the 32bit and 64bit version. Halve the check constants on 32bit. Use STACK_TOP since it is defined. This removes a page from the valid 32bit area on 64bit: #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) #define STACK_TOP_USER32 TASK_SIZE_USER32 Signed-off-by: Michal

[PATCH 30/33] powerpc/perf: remove current_is_64bit()

2019-11-12 Thread Michal Suchanek
ggested-by: Christophe Leroy Signed-off-by: Michal Suchanek --- arch/powerpc/perf/callchain.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index 7863ee0a0e69..fbf76cb01026 100644 --- a/arch/powerpc/perf/c

[PATCH 31/33] powerpc/64: make buildable without CONFIG_COMPAT

2019-11-12 Thread Michal Suchanek
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek --- v2: - fix 32bit ifdef condition in signal.c - simplify the compat ifdef condition in vdso.c - 64bit is redundant - simplify the compat ifdef condition in callchain.c

[PATCH 32/33] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.

2019-11-12 Thread Michal Suchanek
On bigendian ppc64 it is common to have 32bit legacy binaries but much less so on littleendian. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v3: make configurable --- arch/powerpc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH 33/33] powerpc/perf: split callchain.c by bitness

2019-11-12 Thread Michal Suchanek
Building callchain.c with !COMPAT proved quite ugly with all the defines. Splitting out the 32bit and 64bit parts looks better. No code change intended. Signed-off-by: Michal Suchanek --- v6: - move current_is_64bit consolidetaion to earlier patch - move defines to the top of callchain_32.c

[PATCH] MAINTAINERS: Add pattern that matches ppc perf to the perf entry.

2019-11-13 Thread Michal Suchanek
Signed-off-by: Michal Suchanek --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index eb19fad370d7..2e6c187bc98c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12772,6 +12772,8 @@ F: arch/*/kernel/*/perf_event*.c F: arch/*/kernel

[PATCH v2 00/35] exception cleanup, syscall in C and !COMPAT

2019-11-26 Thread Michal Suchanek
ppc64e. Thanks Michal Michal Suchanek (10): powerpc/64: system call: Fix sparse warning about missing declaration powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro powerpc: move common register copy functions from signal_32.c to signal.c powerpc/perf: remove current_is_64bit() powerpc

[PATCH v2 01/35] powerpc/64s/exception: Introduce INT_DEFINE parameter block for code generation

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The code generation macro arguments are difficult to read, and defaults can't easily be used. This introduces a block where parameters can be set for interrupt handler code generation by the subsequent macros, and adds the first generation macro for interrupt entry. One in

[PATCH v2 02/35] powerpc/64s/exception: Add GEN_COMMON macro that uses INT_DEFINE parameters

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S ind

[PATCH v2 03/35] powerpc/64s/exception: Add GEN_KVM macro that uses INT_DEFINE parameters

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 591ae2a73e

[PATCH v2 04/35] powerpc/64s/exception: Expand EXC_COMMON and EXC_COMMON_ASYNC macros

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin These don't provide a large amount of code sharing. Removing them makes code easier to shuffle around. For example, some of the common instructions will be moved into the common code gen macro. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/ker

[PATCH v2 05/35] powerpc/64s/exception: Move all interrupt handlers to new style code gen macros

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Aside from label names and BUG line numbers, the generated code change is an additional HMI KVM handler added for the "late" KVM handler, because early and late HMI generation is achieved by defining two different interrupt types. Signed-off-by: Nicholas Piggin --- arch/p

[PATCH v2 06/35] powerpc/64s/exception: Remove old INT_ENTRY macro

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index b5decc9a0cbf..ba2dc

[PATCH v2 07/35] powerpc/64s/exception: Remove old INT_COMMON macro

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 51 +--- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index ba2dcd91aaaf..f3188

[PATCH v2 08/35] powerpc/64s/exception: Remove old INT_KVM_HANDLER

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 55 +--- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index f318869607db..bef0c

[PATCH v2 09/35] powerpc/64s/exception: Add ISIDE option

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Rather than using DAR=2 to select the i-side registers, add an explicit option. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/excepti

[PATCH v2 10/35] powerpc/64s/exception: move real->virt switch into the common handler

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The real mode interrupt entry points currently use rfid to branch to the common handler in virtual mode. This is a significant amount of code, and forces other code (notably the KVM test) to live in the real mode handler. In the interest of minimising the amount of code tha

[PATCH v2 11/35] powerpc/64s/exception: move soft-mask test to common code

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin As well as moving code out of the unrelocated vectors, this allows the masked handlers to be moved to common code, and allows the soft_nmi handler to be generated more like a regular handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 106 ++

[PATCH v2 12/35] powerpc/64s/exception: move KVM test to common code

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin This allows more code to be moved out of unrelocated regions. The system call KVMTEST is changed to be open-coded and remain in the tramp area to avoid having to move it to entry_64.S. The custom nature of the system call entry code means the hcall case can be made more stre

[PATCH v2 13/35] powerpc/64s/exception: remove confusing IEARLY option

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Replace IEARLY=1 and IEARLY=2 with IBRANCH_COMMON, which controls if the entry code branches to a common handler; and IREALMODE_COMMON, which controls whether the common handler should remain in real mode. These special cases no longer avoid loading the SRR registers, there

[PATCH v2 14/35] powerpc/64s/exception: remove the SPR saving patch code macros

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin These are used infrequently enough they don't provide much help, so inline them. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 82 ++-- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kernel/

[PATCH v2 15/35] powerpc/64s/exception: trim unused arguments from KVMTEST macro

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index abf26db36427..9fa71d51ecf4 100644 --- a

[PATCH v2 16/35] powerpc/64s/exception: hdecrementer avoid touching the stack

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The hdec interrupt handler is reported to sometimes fire in Linux if KVM leaves it pending after a guest exists. This is harmless, so there is a no-op handler for it. The interrupt handler currently uses the regular kernel stack. Change this to avoid touching the stack enti

[PATCH v2 17/35] powerpc/64s/exception: re-inline some handlers

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The reduction in interrupt entry size allows some handlers to be re-inlined. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powe

[PATCH v2 18/35] powerpc/64s/exception: Clean up SRR specifiers

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Remove more magic numbers and replace with nicely named bools. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 +--- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 19/35] powerpc/64s/exception: add more comments for interrupt handlers

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin A few of the non-standard handlers are left uncommented. Some more description could be added to some. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 391 --- 1 file changed, 353 insertions(+), 38 deletions(-) diff --git

[PATCH v2 20/35] powerpc/64s/exception: only test KVM in SRR interrupts when PR KVM is supported

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin Apart from SRESET, MCE, and syscall (hcall variant), the SRR type interrupts are not escalated to hypervisor mode, so delivered to the OS. When running PR KVM, the OS is the hypervisor, and the guest runs with MSR[PR]=1, so these interrupts must test if a guest was running

[PATCH v2 21/35] powerpc/64s/exception: soft nmi interrupt should not use ret_from_except

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The soft nmi handler does not reconcile interrupt state, so it should not return via the normal ret_from_except path. Return like other NMIs, using the EXCEPTION_RESTORE_REGS macro. This becomes important when the scv interrupt is implemented, which must handle soft-masked

[PATCH v2 22/35] powerpc/64: system call remove non-volatile GPR save optimisation

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin powerpc has an optimisation where interrupts avoid saving the non-volatile (or callee saved) registers to the interrupt stack frame if they are not required. Two problems with this are that an interrupt does not always know whether it will need non-volatiles; and if it does

[PATCH v2 24/35] powerpc/64s: interrupt return in C

2019-11-26 Thread Michal Suchanek
ced mtmsrd. Signed-off-by: Nicholas Piggin [ms: Move the FP restore functions to restore_math. They are not used anywhere else and when restore_math is not built gcc warns about them being unused. Add asm/context_tracking.h include to exceptions-64e.S for SCHEDULE_USER definition.] Signed-off-

[PATCH v2 23/35] powerpc/64: system call implement the bulk of the logic in C

2019-11-26 Thread Michal Suchanek
% faster after this patch, because the exit work is handled under local_irq_disable, and the hard mask and pending interrupt replay is handled after that, which avoids games with MSR. Signed-off-by: Nicholas Piggin [ms: add endian conversion for dtl_idx] Signed-off-by: Michal Suchanek v3: - Fix !KUAP

[PATCH v2 25/35] powerpc/64s/exception: remove lite interrupt return

2019-11-26 Thread Michal Suchanek
From: Nicholas Piggin The difference between lite and regular returns is that the lite case restores all NVGPRs, whereas lite skips that. This is quite clumsy though, most interrupts want the NVGPRs saved for debugging, not to modify in the caller, so the NVGPRs restore is not necessary most of t

[PATCH v2 26/35] powerpc/64: system call: Fix sparse warning about missing declaration

2019-11-26 Thread Michal Suchanek
atic? Add declaration for them. Signed-off-by: Michal Suchanek --- arch/powerpc/include/asm/asm-prototypes.h | 6 ++ arch/powerpc/kernel/syscall_64.c | 1 + 2 files changed, 7 insertions(+) diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-proto

[PATCH v2 27/35] powerpc: Add back __ARCH_WANT_SYS_LLSEEK macro

2019-11-26 Thread Michal Suchanek
interface unconditionally. Link: https://lore.kernel.org/lkml/20190828151552.ga16...@infradead.org/ Link: https://lore.kernel.org/lkml/20190829214319.498c7de2@naga/ Signed-off-by: Michal Suchanek Reviewed-by: Arnd Bergmann --- arch/powerpc/include/asm/unistd.h | 1 + fs/read_write.c

[PATCH v2 28/35] powerpc: move common register copy functions from signal_32.c to signal.c

2019-11-26 Thread Michal Suchanek
These functions are required for 64bit as well. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- arch/powerpc/kernel/signal.c| 141 arch/powerpc/kernel/signal_32.c | 140 --- 2 files changed, 141 insertions

[PATCH v2 29/35] powerpc/perf: remove current_is_64bit()

2019-11-26 Thread Michal Suchanek
ggested-by: Christophe Leroy Signed-off-by: Michal Suchanek --- arch/powerpc/perf/callchain.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index c84bbd4298a0..35d542515faf 100644 --- a/arch/powerpc/perf/c

[PATCH v2 30/35] powerpc/perf: consolidate read_user_stack_32

2019-11-26 Thread Michal Suchanek
There are two almost identical copies for 32bit and 64bit. The function is used only in 32bit code which will be split out in next patch so consolidate to one function. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v6: new patch v8: move the consolidated function out of the

[PATCH v2 31/35] powerpc/perf: consolidate valid_user_sp

2019-11-26 Thread Michal Suchanek
valid 32bit area on 64bit: #define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) #define STACK_TOP_USER32 TASK_SIZE_USER32 Signed-off-by: Michal Suchanek --- v8: new patch v11: simplify by using is_32bit_task() --- arch/powerpc/perf/callchain.c | 27 +++ 1

[PATCH v2 32/35] powerpc/64: make buildable without CONFIG_COMPAT

2019-11-26 Thread Michal Suchanek
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek --- v2: - fix 32bit ifdef condition in signal.c - simplify the compat ifdef condition in vdso.c - 64bit is redundant - simplify the compat ifdef condition in callchain.c

[PATCH v2 33/35] powerpc/64: Make COMPAT user-selectable disabled on littleendian by default.

2019-11-26 Thread Michal Suchanek
On bigendian ppc64 it is common to have 32bit legacy binaries but much less so on littleendian. Signed-off-by: Michal Suchanek Reviewed-by: Christophe Leroy --- v3: make configurable --- arch/powerpc/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

[PATCH v2 34/35] powerpc/perf: split callchain.c by bitness

2019-11-26 Thread Michal Suchanek
Building callchain.c with !COMPAT proved quite ugly with all the defines. Splitting out the 32bit and 64bit parts looks better. No code change intended. Signed-off-by: Michal Suchanek --- v6: - move current_is_64bit consolidetaion to earlier patch - move defines to the top of callchain_32.c

  1   2   3   4   >