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

2022-05-31 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

[PATCH 5/6] powerpc: Move syscall handler prototypes to header

2022-05-31 Thread Rohan McLure
Since some power syscall handlers call into other syscall handlers with the usual in-register calling convention, emit symbols for both conventions when required. The prototypes for handlers supporting in-register parameters should exist in a header rather than immediately preceding their usage.

[PATCH 4/6] powerpc: Fix comment, use clear and restore macros

2022-05-31 Thread Rohan McLure
Only r10 is saved to the PACA. Reflect this in the inline comment. Replace instructions for restoring gprs from the stack and clearing them with the REST_GPRS and ZERO_GPRS convenience macros. Signed-off-by: Rohan McLure --- arch/powerpc/kernel/exceptions-64s.S | 2 +-

[PATCH 3/6] powerpc: Make syscalls save and restore gprs

2022-05-31 Thread Rohan McLure
Clears user state in gprs to reduce the influence of user registers on speculation within kernel syscall handlers. Remove conditional branches on result of `syscall_exit_prepare` to restore non-volatile gprs, as these registers are always cleared and hence always must be restored. Signed-off-by:

[PATCH 2/6] powerpc: Provide syscall wrapper

2022-05-31 Thread Rohan McLure
Syscall wrapper implemented as per s390, x86, arm64, providing the option for gprs to be cleared on entry to the kernel, reducing caller influence influence on speculation within syscall routine. The wrapper is a macro that emits syscall handler implementations with parameters passed by stack

[PATCH 1/6] powerpc: Add ZERO_GPRS macros for register clears

2022-05-31 Thread Rohan McLure
Macros for restoring saving registers to and from the stack exist. Provide a macro for simply zeroing a range of gprs, or an individual gpr. Signed-off-by: Rohan McLure --- arch/powerpc/include/asm/ppc_asm.h | 17 + 1 file changed, 17 insertions(+) diff --git

[PATCH kernel] powerpc/pseries/iommu: Print ibm,query-pe-dma-windows parameters

2022-05-31 Thread Alexey Kardashevskiy
PowerVM has a stricter policy about allocating TCEs for LPARs and often there is not enough TCEs for 1:1 mapping, this adds the supported numbers into dev_info() to help analyzing bugreports. Signed-off-by: Alexey Kardashevskiy --- A PowerVM admin can enable "enlarged IO capacity" for a passed

Re: [PATCH] powerpc/64: Drop ppc_inst_as_str()

2022-05-31 Thread Bagas Sanjaya
On 6/1/22 10:03, Bagas Sanjaya wrote: >> >> Reported-by: Bagas Sanjaya >> Reported-by: Petr Mladek >> Signed-off-by: Michael Ellerman > > The arch/powerpc/kernel/trace/ftrace.c builds successfully, however > there is also other build error for which I have reported at [1]. > > Thanks. > >

Re: [PATCH] powerpc/64: Drop ppc_inst_as_str()

2022-05-31 Thread Bagas Sanjaya
Hi, On Tue, May 31, 2022 at 04:59:36PM +1000, Michael Ellerman wrote: > The ppc_inst_as_str() macro tries to make printing variable length, > aka "prefixed", instructions convenient. It mostly succeeds, but it does > hide an on-stack buffer, which triggers stack protector. > > More

outside array bounds error on ppc64_defconfig, GCC 12.1.0

2022-05-31 Thread Bagas Sanjaya
Hi, I'm trying to verify Drop ppc_inst_as_str() patch on [1] by performing ppc64_defconfig build with powerpc64-unknown-linux-gnu-gcc (GCC 12.1.0). The patch is applied on top of powerpc tree, next branch. I got outside array bounds error: CC arch/powerpc/kernel/dbell.o In function

Re: [FSL P50x0] Keyboard and mouse don't work anymore after the devicetree updates for 5.19

2022-05-31 Thread Christian Zigotzky
On 31. May 2022, at 15:46, Rob Herring wrote: Do you have a dmesg log? The other way to fix is creating a IRQ resource and adding it to the child device resources. Rob —— Rob, Do you mean a dmesg from the boot loop? The other way is a good idea. Cheers, Christian

Re: [PATCH] xen: replace xen_remap() with memremap()

2022-05-31 Thread Stefano Stabellini
On Mon, 30 May 2022, Juergen Gross wrote: > xen_remap() is used to establish mappings for frames not under direct > control of the kernel: for Xenstore and console ring pages, and for > grant pages of non-PV guests. > > Today xen_remap() is defined to use ioremap() on x86 (doing uncached >

Re: [PATCH] powerpc/64: Drop ppc_inst_as_str()

2022-05-31 Thread Segher Boessenkool
Hi! On Tue, May 31, 2022 at 04:59:36PM +1000, Michael Ellerman wrote: > More problematically it doesn't compile at all with GCC 12, due to the > fact that it returns the char buffer declared inside the macro: It returns a pointer to a buffer on stack. It is not valid C to access that buffer

Re: [PATCH v5] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-31 Thread Heiko Carstens
hal Simek , Thomas Bogendoerfer , linux-par...@vger.kernel.org, Max Filippov , linux-ker...@vger.kernel.org, Dinh Nguyen , linux-ri...@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , Guo Ren , linux-hexa...@vger.kernel.org, Ivan Kokshaysky , Johannes Berg ,

Re: [PATCH v5] mm: Avoid unnecessary page fault retires on shared memory types

2022-05-31 Thread Russell King (Oracle)
l Simek , Thomas Bogendoerfer , linux-par...@vger.kernel.org, Max Filippov , linux-ker...@vger.kernel.org, Dinh Nguyen , linux-ri...@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , Guo Ren , linux-hexa...@vger.kernel.org, Ivan Kokshaysky , Johannes Berg , linuxppc-dev@lists.ozlabs.org,

Re: [PATCH] xen: replace xen_remap() with memremap()

2022-05-31 Thread Boris Ostrovsky
On 5/30/22 4:26 AM, Juergen Gross wrote: xen_remap() is used to establish mappings for frames not under direct control of the kernel: for Xenstore and console ring pages, and for grant pages of non-PV guests. Today xen_remap() is defined to use ioremap() on x86 (doing uncached mappings), and

[PATCH 2/2] powerpc/irq: Perform stack_overflow detection after switching to IRQ stack

2022-05-31 Thread Christophe Leroy
When KASAN is enabled, as shown by the Oops below, the 2k limit is not enough to allow stack dump after a stack overflow detection when CONFIG_DEBUG_STACKOVERFLOW is selected: do_IRQ: stack overflow: 1984 CPU: 0 PID: 126 Comm: systemd-udevd Not tainted 5.18.0-gentoo-PMacG4 #1

[PATCH 1/2] powerpc/irq: Make __do_irq() static

2022-05-31 Thread Christophe Leroy
Since commit 48cf12d88969 ("powerpc/irq: Inline call_do_irq() and call_do_softirq()"), __do_irq() is not used outside irq.c Reorder functions and make __do_irq() static and drop the declaration in irq.h. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/irq.h | 1 -

Re: [FSL P50x0] Keyboard and mouse don't work anymore after the devicetree updates for 5.19

2022-05-31 Thread Christian Zigotzky
> On 31. May 2022, at 15:46, Rob Herring wrote: > > On Mon, May 30, 2022 at 12:26 AM Christian Zigotzky > wrote: >> >>> On 27 May 2022 at 04:23 pm, Rob Herring wrote: >>> The issue is in drivers/usb/host/fsl-mph-dr-of.c which copies the >>> resources to a child platform device. Can you try

Re: [PATCH] RISC-V: Prepare dropping week attribute from arch_kexec_apply_relocations[_add]

2022-05-31 Thread Palmer Dabbelt
On Mon, 30 May 2022 22:58:03 PDT (-0700), u.kleine-koe...@pengutronix.de wrote: On Mon, May 30, 2022 at 04:11:27PM -0700, Palmer Dabbelt wrote: On Mon, 30 May 2022 12:41:33 PDT (-0700), u.kleine-koe...@pengutronix.de wrote: > Hello, > > On Mon, May 30, 2022 at 11:58:16AM -0700, Palmer Dabbelt

Re: [FSL P50x0] Keyboard and mouse don't work anymore after the devicetree updates for 5.19

2022-05-31 Thread Rob Herring
On Mon, May 30, 2022 at 12:26 AM Christian Zigotzky wrote: > > On 27 May 2022 at 04:23 pm, Rob Herring wrote: > > The issue is in drivers/usb/host/fsl-mph-dr-of.c which copies the > > resources to a child platform device. Can you try the following > > change: > > > > diff --git

Re: [PATCH] powerpc/Kconfig: Force THREAD_SHIFT to at least 14 with KASAN

2022-05-31 Thread Christophe Leroy
Le 31/05/2022 à 09:41, Christoph Hellwig a écrit : > On Tue, May 31, 2022 at 04:16:19PM +1000, Michael Ellerman wrote: >> I was thinking of doing it in C, similar to the way arm64 handles it. >> >> Something like below. It means we always double the stack size when >> KASAN is enabled. I think

[PATCH] powerpc/papr_scm: use dev_get_drvdata

2022-05-31 Thread Haowen Bai
Eliminate direct accesses to the driver_data field. Signed-off-by: Haowen Bai --- arch/powerpc/platforms/pseries/papr_scm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index

Re: [PATCH] powerpc/perf: Give generic PMU a nice name

2022-05-31 Thread Madhavan Srinivasan
On 5/26/22 12:07 PM, Joel Stanley wrote: When booting on a machine that uses the compat pmu driver we see this: [0.071192] GENERIC_COMPAT performance monitor hardware support registered Sorry that was my mistake. I agree having it as ISAv3 is better. Maddy Which is a bit shouty.

Re: [PATCH] powerpc/Kconfig: Force THREAD_SHIFT to at least 14 with KASAN

2022-05-31 Thread Christoph Hellwig
On Tue, May 31, 2022 at 04:16:19PM +1000, Michael Ellerman wrote: > I was thinking of doing it in C, similar to the way arm64 handles it. > > Something like below. It means we always double the stack size when > KASAN is enabled. I think it's preferable, as it will always work > regardless of

[PATCH] powerpc/64: Drop ppc_inst_as_str()

2022-05-31 Thread Michael Ellerman
The ppc_inst_as_str() macro tries to make printing variable length, aka "prefixed", instructions convenient. It mostly succeeds, but it does hide an on-stack buffer, which triggers stack protector. More problematically it doesn't compile at all with GCC 12, due to the fact that it returns the

Re: [PATCH] powerpc/irq: Increase stack_overflow detection limit when KASAN is enabled

2022-05-31 Thread Christophe Leroy
Le 31/05/2022 à 08:21, Michael Ellerman a écrit : > Christophe Leroy writes: >> When KASAN is enabled, as shown by the Oops below, the 2k limit is not >> enough to allow stack dump after a stack overflow detection when >> CONFIG_DEBUG_STACKOVERFLOW is selected: >> >> do_IRQ: stack

Re: [PATCH] powerpc/Kconfig: Force THREAD_SHIFT to at least 14 with KASAN

2022-05-31 Thread Christophe Leroy
Le 31/05/2022 à 08:16, Michael Ellerman a écrit : > Christophe Leroy writes: >> Allthough 14 is the default THREAD_SHIFT when KASAN is selected, >> taking an old config may keep 13 when CONFIG_EXPERT is selected. >> >> Force it to 14 as a minimum when KASAN is selected. >> >> Also default to 15

Re: [PATCH v1 0/4] Kill the time spent in patch_instruction()

2022-05-31 Thread Christophe Leroy
Le 17/05/2022 à 14:37, Michael Ellerman a écrit : > Christophe Leroy writes: >> Le 15/05/2022 à 12:28, Michael Ellerman a écrit : >>> On Tue, 22 Mar 2022 16:40:17 +0100, Christophe Leroy wrote: This series reduces by 70% the time required to activate ftrace on an 8xx with

Re: [PATCH] powerpc/irq: Increase stack_overflow detection limit when KASAN is enabled

2022-05-31 Thread Michael Ellerman
Christophe Leroy writes: > When KASAN is enabled, as shown by the Oops below, the 2k limit is not > enough to allow stack dump after a stack overflow detection when > CONFIG_DEBUG_STACKOVERFLOW is selected: > > do_IRQ: stack overflow: 1984 > CPU: 0 PID: 126 Comm: systemd-udevd Not

Re: [RFC PATCH 4/4] objtool/powerpc: Add --mcount specific implementation

2022-05-31 Thread Christophe Leroy
Le 25/05/2022 à 19:27, Christophe Leroy a écrit : Le 24/05/2022 à 15:33, Christophe Leroy a écrit : Le 24/05/2022 à 13:00, Sathvika Vasireddy a écrit : +{ +    switch (elf->ehdr.e_machine) { +    case EM_X86_64: +    return R_X86_64_64; +    case EM_PPC64: +    return

Re: [PATCH] powerpc/Kconfig: Force THREAD_SHIFT to at least 14 with KASAN

2022-05-31 Thread Michael Ellerman
Christophe Leroy writes: > Allthough 14 is the default THREAD_SHIFT when KASAN is selected, > taking an old config may keep 13 when CONFIG_EXPERT is selected. > > Force it to 14 as a minimum when KASAN is selected. > > Also default to 15 when KASAN on PPC64. > > Reported-by: Erhard Furtner >

Fwd: [PATCH 0/4] objtool: Reorganize x86 arch-specific code

2022-05-31 Thread Christophe Leroy
All available at https://lore.kernel.org/lkml/20220531020744.236970-1-chenzhong...@huawei.com/T/#t Chen, can you please copy linuxppc-dev list next time, as powerpc is interested in objtool. Message transféré Sujet : [PATCH 0/4] objtool: Reorganize x86 arch-specific code