[PATCH] powerpc/lib/sstep: Don't use __{get/put}_user() on kernel addresses

2021-09-16 Thread Christophe Leroy
. That allows refactoring userspace and kernelspace access. Reported-by: Stan Johnson Cc: Finn Thain Depends-on: 4fe5cda9f89d ("powerpc/uaccess: Implement user_read_access_begin and user_write_access_begin") Signed-off-by: Christophe Leroy --- arch/powerpc/lib/sst

[PATCH v2] powerpc: warn on emulation of dcbz instruction in kernel mode

2021-09-16 Thread Christophe Leroy
in kernel mode due to dcbz, so that the user is made aware that dcbz instruction has been used unexpectedly by the kernel. Reported-by: Stan Johnson Cc: Finn Thain Signed-off-by: Christophe Leroy --- v2: Warn only when emulating kernel mode --- arch/powerpc/kernel/align.c | 1 + 1 file changed, 1

Re: [PATCH] powerpc: warn on emulation of dcbz instruction

2021-09-16 Thread Christophe Leroy
Le 16/09/2021 à 09:16, Benjamin Herrenschmidt a écrit : On Thu, 2021-09-16 at 17:15 +1000, Benjamin Herrenschmidt wrote: On Wed, 2021-09-15 at 16:31 +0200, Christophe Leroy wrote: dcbz instruction shouldn't be used on non-cached memory. Using it on non-cached memory can result in alignment

Re: [PATCH v3 4/8] powerpc/pseries/svm: Add a powerpc version of cc_platform_has()

2021-09-15 Thread Christophe Leroy
Le 15/09/2021 à 12:08, Borislav Petkov a écrit : On Wed, Sep 15, 2021 at 10:28:59AM +1000, Michael Ellerman wrote: I don't love it, a new C file and an out-of-line call to then call back to a static inline that for most configuration will return false ... but whatever :) Yeah, hch thinks

[PATCH] powerpc: warn on emulation of dcbz instruction

2021-09-15 Thread Christophe Leroy
to dcbz, so that the user is made aware that dcbz instruction has been used unexpectedly. Reported-by: Stan Johnson Cc: Finn Thain Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/align.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel

[PATCH] powerpc/32s: Fix kuap_kernel_restore()

2021-09-15 Thread Christophe Leroy
was returned by kuap_get_and_assert_locked() Fixes: 16132529cee5 ("powerpc/32s: Rework Kernel Userspace Access Protection") Reported-by: Stan Johnson Cc: Finn Thain Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 8 1 file changed, 8 insertions(+) dif

[PATCH] video: fbdev: use memset_io() instead of memset()

2021-09-15 Thread Christophe Leroy
_PMAC_PBOOK") Reported-by: Stan Johnson Cc: Finn Thain Signed-off-by: Christophe Leroy --- drivers/video/fbdev/chipsfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 998067b701fa..393894af26f8 1006

Re: [PATCH v3 4/8] powerpc/pseries/svm: Add a powerpc version of cc_platform_has()

2021-09-14 Thread Christophe Leroy
Le 14/09/2021 à 13:58, Borislav Petkov a écrit : On Wed, Sep 08, 2021 at 05:58:35PM -0500, Tom Lendacky wrote: Introduce a powerpc version of the cc_platform_has() function. This will be used to replace the powerpc mem_encrypt_active() implementation, so the implementation will initially

[PATCH v4 2/5] powerpc/signal: Include the new stack frame inside the user access block

2021-09-14 Thread Christophe Leroy
Include the new stack frame inside the user access block and set it up using unsafe_put_user(). On an mpc 8321 (book3s/32) the improvment is about 4% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 29

[PATCH v4 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-14 Thread Christophe Leroy
c fallback for unsafe_clear_user(). Architectures wanting to use unsafe_copy_siginfo_to_user() within a user_access_begin() section have to make sure they have their own unsafe_clear_user(). Signed-off-by: Christophe Leroy --- v3: Added precision about unsafe_clear_user() in commit message. --- include/linu

[PATCH v4 5/5] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-14 Thread Christophe Leroy
Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- v4: Use another approach for compat: drop the unsafe_copy_siginfo_to_user32

[PATCH v4 4/5] powerpc/uaccess: Add unsafe_clear_user()

2021-09-14 Thread Christophe Leroy
Implement unsafe_clear_user() for powerpc. It's a copy/paste of unsafe_copy_to_user() with value 0 as source. It may be improved in a later patch by using 'dcbz' instruction to zeroize full cache lines at once. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 20

[PATCH v4 1/5] powerpc/signal64: Access function descriptor with user access block

2021-09-14 Thread Christophe Leroy
Access the function descriptor of the handler within a user access block. Signed-off-by: Christophe Leroy --- v3: Flatten the change to avoid nested gotos. --- arch/powerpc/kernel/signal_64.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

Re: [PATCH RESEND v3 6/6] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-14 Thread Christophe Leroy
Le 13/09/2021 à 21:11, Eric W. Biederman a écrit : Christophe Leroy writes: Le 13/09/2021 à 18:21, Eric W. Biederman a écrit : ebied...@xmission.com (Eric W. Biederman) writes: Christophe Leroy writes: Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access

Re: [RFC PATCH 0/8] Move task_struct::cpu back into thread_info

2021-09-14 Thread Christophe Leroy
Le 14/09/2021 à 14:10, Ard Biesheuvel a écrit : Commit c65eacbe290b ("sched/core: Allow putting thread_info into task_struct") mentions that, along with moving thread_info into task_struct, the cpu field is moved out of the former into the latter, but does not explain why. I think it does

Re: [PATCH RESEND v3 6/6] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Le 13/09/2021 à 18:21, Eric W. Biederman a écrit : ebied...@xmission.com (Eric W. Biederman) writes: Christophe Leroy writes: Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process

Re: [PATCH RESEND v3 6/6] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Le 13/09/2021 à 17:57, Eric W. Biederman a écrit : Christophe Leroy writes: Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe

Re: [PATCH RESEND v3 4/6] signal: Add unsafe_copy_siginfo_to_user32()

2021-09-13 Thread Christophe Leroy
Le 13/09/2021 à 17:54, Eric W. Biederman a écrit : Christophe Leroy writes: In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_siginfo_to_user32() in order to use it within user access blocks. To do s

[PATCH RESEND v3 4/6] signal: Add unsafe_copy_siginfo_to_user32()

2021-09-13 Thread Christophe Leroy
all inside user access blocks. Signed-off-by: Christophe Leroy --- include/linux/compat.h | 83 +- include/linux/signal.h | 58 + kernel/signal.c| 114 + 3 files changed, 141 insertions(+), 114

[PATCH RESEND v3 6/6] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- v3: Don't leave compat aside, use the new unsafe_copy_siginfo_to_user32

[PATCH RESEND v3 2/6] powerpc/signal: Include the new stack frame inside the user access block

2021-09-13 Thread Christophe Leroy
Include the new stack frame inside the user access block and set it up using unsafe_put_user(). On an mpc 8321 (book3s/32) the improvment is about 4% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 29

[PATCH RESEND v3 3/6] signal: Add unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
c fallback for unsafe_clear_user(). Architectures wanting to use unsafe_copy_siginfo_to_user() within a user_access_begin() section have to make sure they have their own unsafe_clear_user(). Signed-off-by: Christophe Leroy --- v3: Added precision about unsafe_clear_user() in commit message. --- include/linu

[PATCH RESEND v3 1/6] powerpc/signal64: Access function descriptor with user access block

2021-09-13 Thread Christophe Leroy
Access the function descriptor of the handler within a user access block. Signed-off-by: Christophe Leroy --- Resending with correct date, sorry for the noise, my new PC seems to have used the fake date from Git instead of adding proper Date: from current date/time. v3: Flatten the change

[PATCH RESEND v3 5/6] powerpc/uaccess: Add unsafe_clear_user()

2021-09-13 Thread Christophe Leroy
Implement unsafe_clear_user() for powerpc. It's a copy/paste of unsafe_copy_to_user() with value 0 as source. It may be improved in a later patch by using 'dcbz' instruction to zeroize full cache lines at once. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 20

[PATCH] powerpc/mem: Fix arch/powerpc/mm/mem.c:53:12: error: no previous prototype for 'create_section_mapping'

2021-09-13 Thread Christophe Leroy
) prototype from asm/sparsemem.h to asm/mmzone.h Reported-by: kernel test robot Fixes: 8e11d62e2e87 ("powerpc/mem: Add back missing header to fix 'no previous prototype' error") Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH v2 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Le 02/09/2021 à 08:54, Christoph Hellwig a écrit : On Mon, Aug 23, 2021 at 03:35:53PM +, Christophe Leroy wrote: In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_siginfo_to_user() in order to use it w

Re: [PATCH v2 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Le 11/09/2021 à 17:58, Eric W. Biederman a écrit : Christophe Leroy writes: On 9/8/21 6:17 PM, Eric W. Biederman wrote: Christophe Leroy writes: Le 02/09/2021 à 20:43, Eric W. Biederman a écrit : Christophe Leroy writes: In the same spirit as commit fb05121fd6a2 ("signal

[PATCH v3 6/6] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- v3: Don't leave compat aside, use the new unsafe_copy_siginfo_to_user32

[PATCH v3 5/6] powerpc/uaccess: Add unsafe_clear_user()

2021-09-13 Thread Christophe Leroy
Implement unsafe_clear_user() for powerpc. It's a copy/paste of unsafe_copy_to_user() with value 0 as source. It may be improved in a later patch by using 'dcbz' instruction to zeroize full cache lines at once. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 20

[PATCH v3 4/6] signal: Add unsafe_copy_siginfo_to_user32()

2021-09-13 Thread Christophe Leroy
all inside user access blocks. Signed-off-by: Christophe Leroy --- include/linux/compat.h | 83 +- include/linux/signal.h | 58 + kernel/signal.c| 114 + 3 files changed, 141 insertions(+), 114

[PATCH v3 3/6] signal: Add unsafe_copy_siginfo_to_user()

2021-09-13 Thread Christophe Leroy
c fallback for unsafe_clear_user(). Architectures wanting to use unsafe_copy_siginfo_to_user() within a user_access_begin() section have to make sure they have their own unsafe_clear_user(). Signed-off-by: Christophe Leroy --- v3: Added precision about unsafe_clear_user() in commit message. --- include/linu

[PATCH v3 2/6] powerpc/signal: Include the new stack frame inside the user access block

2021-09-13 Thread Christophe Leroy
Include the new stack frame inside the user access block and set it up using unsafe_put_user(). On an mpc 8321 (book3s/32) the improvment is about 4% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 29

[PATCH v3 1/6] powerpc/signal64: Access function descriptor with user access block

2021-09-13 Thread Christophe Leroy
Access the function descriptor of the handler within a user access block. Signed-off-by: Christophe Leroy --- v3: Flatten the change to avoid nested gotos. --- arch/powerpc/kernel/signal_64.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/powerpc

Re: [PATCH 06/10] powerpc: remove GCC version check for UPD_CONSTR

2021-09-11 Thread Christophe Leroy
is still 4.9, see https://github.com/torvalds/linux/blob/master/Documentation/process/changes.rst Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Segher Boessenkool Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nick Desaulniers --- arch

Re: [PATCH v2 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-10 Thread Christophe Leroy
On 9/8/21 6:17 PM, Eric W. Biederman wrote: Christophe Leroy writes: Le 02/09/2021 à 20:43, Eric W. Biederman a écrit : Christophe Leroy writes: In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_sigin

Re: [PATCH v3 4/8] powerpc/pseries/svm: Add a powerpc version of cc_platform_has()

2021-09-09 Thread Christophe Leroy
On 9/8/21 10:58 PM, Tom Lendacky wrote: Introduce a powerpc version of the cc_platform_has() function. This will be used to replace the powerpc mem_encrypt_active() implementation, so the implementation will initially only support the CC_ATTR_MEM_ENCRYPT attribute. Cc: Michael Ellerman Cc:

Re: [PATCH v3 2/8] mm: Introduce a function to check for confidential computing features

2021-09-09 Thread Christophe Leroy
On 9/8/21 10:58 PM, Tom Lendacky wrote: In prep for other confidential computing technologies, introduce a generic helper function, cc_platform_has(), that can be used to check for specific I have little problem with that naming. For me CC has always meant Compiler Collection. active

Re: [PATCH v3 8/8] treewide: Replace the use of mem_encrypt_active() with cc_platform_has()

2021-09-09 Thread Christophe Leroy
On 9/8/21 10:58 PM, Tom Lendacky wrote: diff --git a/arch/powerpc/include/asm/mem_encrypt.h b/arch/powerpc/include/asm/mem_encrypt.h index ba9dab07c1be..2f26b8fc8d29 100644 --- a/arch/powerpc/include/asm/mem_encrypt.h +++ b/arch/powerpc/include/asm/mem_encrypt.h @@ -10,11 +10,6 @@

[RFC PATCH v1 11/11] powerpc/machdep: Convert ppc_md to static calls

2021-09-03 Thread Christophe Leroy
in kernel/setup-common.c as a replacement of ppc_md instance. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/machdep.h | 101 +++-- arch/powerpc/kernel/setup-common.c | 2 + 2 files changed, 98 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include

[RFC PATCH v1 09/11] powerpc/platforms: Use ppc_md. helpers

2021-09-03 Thread Christophe Leroy
Instead of playing directly with ppc_md. structure fields, use the newly defined helpers. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/archrandom.h | 4 +- arch/powerpc/include/asm/iommu.h | 3 +- arch/powerpc/include/asm/machdep.h| 3 +- arch

[RFC PATCH v1 08/11] powerpc/corenet: Change criteria to set MPIC_ENABLE_COREINT

2021-09-03 Thread Christophe Leroy
Don't use ppc_md function comparison. Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/85xx/corenet_generic.c | 2 +- arch/powerpc/sysdev/mpic.c| 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b

[RFC PATCH v1 07/11] powerpc/mpc86xx_hpcn: Remove obsolete statement

2021-09-03 Thread Christophe Leroy
Comment says "Delete this in 2.6.27". Do so now. Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index b6

[RFC PATCH v1 06/11] powerpc/machdep: Add helpers to use ppc_md. functions

2021-09-03 Thread Christophe Leroy
As a preparation to converting ppc_md functions to static calls, add helpers to play with ppc_md. functions. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/machdep.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include

[RFC PATCH v1 05/11] powerpc/machdep: Move sys_ctrler_t definition into pmac.h

2021-09-03 Thread Christophe Leroy
sys_ctrler_t definitions are tied to pmac. Move it in pmac.h Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/machdep.h | 15 --- arch/powerpc/platforms/powermac/pmac.h | 12 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch/powerpc

[RFC PATCH v1 04/11] powerpc/machdep: Make probe_machine() static

2021-09-03 Thread Christophe Leroy
Since commit b1923caa6e64 ("powerpc: Merge 32-bit and 64-bit setup_arch()") probe_machine has only been called from the file in which it is defined. So it can be static. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/machdep.h | 2 -- arch/powerpc/kernel/setup-common.c

[RFC PATCH v1 03/11] powerpc/machdep: Remove CONFIG_PPC_HAS_FEATURE_CALLS

2021-09-03 Thread Christophe Leroy
Last user was removed by commit 7bbd827750e6 ("[PATCH] ppc64: very basic desktop g5 sound support"). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/machdep.h | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/i

[RFC PATCH v1 02/11] powerpc/machdep: Remove stale functions from ppc_md structure

2021-09-03 Thread Christophe Leroy
arch specific powerpc kgdb support"). ppc.machine_kexec_prepare() has not been used since commit 8ee3e0d69623 ("powerpc: Remove the main legacy iSerie platform code"). This allows the removal of machine_kexec_prepare() and the rename of default_machine_kexec_prepare() into machine_kexec_prepare() Rev

[RFC PATCH v1 00/11] powerpc/machdep: Remove dust and convert to static calls

2021-09-03 Thread Christophe Leroy
those helpers instead of accessing ppc_md structure directly. The last patch rewrites the new helpers to use static calls. Christophe Leroy (11): powerpc/time: Remove generic_suspend_{dis/en}able_irqs() powerpc/machdep: Remove stale functions from ppc_md structure powerpc/machdep: Remove

Re: [PATCH -next] powerpc/mm: check base flags in ioremap_prot

2021-09-03 Thread Christophe Leroy
Le 03/09/2021 à 11:03, Nanyong Sun a écrit : Some drivers who call ioremap_prot without setting base flags like ioremap_prot(addr, len, 0) may work well before commit 56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL flags in ioremap()"), but now they will get a virtual address

Re: [PATCH v2 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-09-03 Thread Christophe Leroy
Le 02/09/2021 à 20:43, Eric W. Biederman a écrit : Christophe Leroy writes: In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_siginfo_to_user() in order to use it within user access blocks. For that

Re: [PATCH v2 5/5] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-09-03 Thread Christophe Leroy
Le 02/09/2021 à 20:38, Eric W. Biederman a écrit : Christophe Leroy writes: Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Nacked-by: "E

[PATCH] powerpc/powermac: Remove stale declaration of pmac_md

2021-09-03 Thread Christophe Leroy
pmac_md doesn't exist anymore, remove stall declaration. Fixes: e8222502ee61 ("[PATCH] powerpc: Kill _machine and hard-coded platform numbers") Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/powermac/setup.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ar

[PATCH] powerpc/code-patching: Return error on patch_branch() out-of-range failure

2021-09-03 Thread Christophe Leroy
Do not silentely ignore a failure of create_branch() in patch_branch(). Return -ERANGE. Signed-off-by: Christophe Leroy --- arch/powerpc/lib/code-patching.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c

Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-02 Thread Christophe Leroy
Le 03/09/2021 à 00:20, Segher Boessenkool a écrit : On Thu, Sep 02, 2021 at 04:52:03PM -0500, Segher Boessenkool wrote: On Thu, Sep 02, 2021 at 01:33:10PM +1000, Nicholas Piggin wrote: Excerpts from Christophe Leroy's message of September 2, 2021 3:21 am: - /* Firstly we need to

Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state

2021-09-01 Thread Christophe Leroy
Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : If a system call is made with a transaction active, the kernel immediately aborts it and returns. scv system calls disable irqs even earlier in their interrupt handler, and tabort_syscall does not fix this up. This can result in irq soft-mask

Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

2021-09-01 Thread Christophe Leroy
Le 01/09/2021 à 18:54, Nicholas Piggin a écrit : The basic TM vs syscall test code hard codes an sc instruction for the system call, which fails to cover scv even when the userspace libc has support for it. Duplicate the tests with hard coded scv variants so both are tested when possible.

[PATCH v3] powerpc/32: Add support for out-of-line static calls

2021-09-01 Thread Christophe Leroy
o see that we get one less register on the stack. Signed-off-by: Christophe Leroy --- v3: Adding the special case of __static_call_return0() v2: Use indirect load in long jump sequence to cater with parallele execution and preemption. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig

[PATCH v2] powerpc/32: Add support for out-of-line static calls

2021-08-31 Thread Christophe Leroy
ff e4 bne c000576c <__do_irq+0x6c> Behind the fact of now using a direct 'bl' instead of a 'load/mtctr/bctr' sequence, we can also see that we get one less register on the stack. Signed-off-by: Christophe Leroy --- v2: Use indirect load in long jump sequence to cater with parall

Re: [PATCH] powerpc/64: Avoid link stack corruption in kexec_wait()

2021-08-31 Thread Christophe Leroy
situation? AFAICS the main benefit is to keep things consistent over the kernel and not have to wonder "is it a hot path or not ? If it is I use bcl 20,31, if it is not I use bl". The best way to keep things in order is to always use the right instruction. Signed-off-by: Christop

[PATCH] powerpc/machdep: Remove stale functions from ppc_md structure

2021-08-31 Thread Christophe Leroy
arch specific powerpc kgdb support"). ppc.machine_kexec_prepare() has not been used since commit 8ee3e0d69623 ("powerpc: Remove the main legacy iSerie platform code"). This allows the removal of machine_kexec_prepare() and the rename of default_machine_kexec_prepare() into machine_kexec_prepare()

[PATCH] powerpc/time: Remove generic_suspend_{dis/en}able_irqs()

2021-08-31 Thread Christophe Leroy
Commit d75d68cfef49 ("powerpc: Clean up obsolete code relating to decrementer and timebase") made generic_suspend_enable_irqs() and generic_suspend_disable_irqs() static. Fold them into their only caller. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/t

[PATCH] powerpc/32: Add support for out-of-line static calls

2021-08-31 Thread Christophe Leroy
c0005778: 7f c4 f3 78 mr r4,r30 c000577c: 4e 80 04 21 bctrl c0005780: 85 3f 00 0c lwzur9,12(r31) c0005784: 2c 09 00 00 cmpwi r9,0 c0005788: 40 82 ff e4 bne c000576c <__do_irq+0x6c> Signed-off

Re: [PATCH v4 4/4] powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP

2021-08-30 Thread Christophe Leroy
Le 30/08/2021 à 13:55, Michael Ellerman a écrit : Christophe Leroy writes: Le 30/08/2021 à 09:52, Michael Ellerman a écrit : Christophe Leroy writes: Le 29/08/2021 à 20:55, Nathan Chancellor a écrit : On Thu, Jul 08, 2021 at 04:49:43PM +, Christophe Leroy wrote: This patch converts

Re: [PATCH v4 4/4] powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP

2021-08-30 Thread Christophe Leroy
Le 30/08/2021 à 09:52, Michael Ellerman a écrit : Christophe Leroy writes: Hi Nathan, Le 29/08/2021 à 20:55, Nathan Chancellor a écrit : Hi Christophe, On Thu, Jul 08, 2021 at 04:49:43PM +, Christophe Leroy wrote: This patch converts powerpc to the generic PTDUMP implementation

Re: [RFC PATCH 4/6] powerpc/64s: Make hash MMU code build configurable

2021-08-30 Thread Christophe Leroy
Le 30/08/2021 à 08:55, Nicholas Piggin a écrit : Excerpts from Christophe Leroy's message of August 28, 2021 7:59 pm: Le 27/08/2021 à 18:34, Nicholas Piggin a écrit : Introduce a new option CONFIG_PPC_64S_HASH_MMU which allows the 64s hash MMU code to be compiled out if radix is selected

Re: [PATCH v4 4/4] powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP

2021-08-29 Thread Christophe Leroy
Hi Nathan, Le 29/08/2021 à 20:55, Nathan Chancellor a écrit : Hi Christophe, On Thu, Jul 08, 2021 at 04:49:43PM +, Christophe Leroy wrote: This patch converts powerpc to the generic PTDUMP implementation. Signed-off-by: Christophe Leroy This patch as commit e084728393a5 ("po

Re: [PATCH] net: spider_net: switch from 'pci_' to 'dma_' API

2021-08-29 Thread Christophe Leroy
Le 27/08/2021 à 21:56, Christophe JAILLET a écrit : --- It has *not* been compile tested because I don't have the needed configuration or cross-compiler. However, the modification is completely mechanical and done by coccinelle. All you need is at

Re: [RFC PATCH 4/6] powerpc/64s: Make hash MMU code build configurable

2021-08-28 Thread Christophe Leroy
Le 27/08/2021 à 18:34, Nicholas Piggin a écrit : Introduce a new option CONFIG_PPC_64S_HASH_MMU which allows the 64s hash MMU code to be compiled out if radix is selected and the minimum supported CPU type is POWER9 or higher, and KVM is not selected. This saves 128kB kernel image size (90kB

Re: [RFC PATCH 6/6] powerpc/microwatt: Stop building the hash MMU code

2021-08-28 Thread Christophe Leroy
Le 27/08/2021 à 18:34, Nicholas Piggin a écrit : Microwatt is radix-only, so stop selecting the hash MMU code. This saves 20kB compressed dtbImage and 56kB vmlinux size. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 1 -

Re: [RFC PATCH 5/6] powerpc/microwatt: select POWER9_CPU

2021-08-28 Thread Christophe Leroy
Le 27/08/2021 à 18:34, Nicholas Piggin a écrit : Microwatt implements a subset of ISA v3.0 which is equivalent to the POWER9_CPU selection. Signed-off-by: Nicholas Piggin --- arch/powerpc/configs/microwatt_defconfig | 1 + arch/powerpc/platforms/microwatt/Kconfig | 1 + 2 files changed,

Re: [RFC PATCH 4/6] powerpc/64s: Make hash MMU code build configurable

2021-08-28 Thread Christophe Leroy
Le 27/08/2021 à 18:34, Nicholas Piggin a écrit : Introduce a new option CONFIG_PPC_64S_HASH_MMU which allows the 64s hash MMU code to be compiled out if radix is selected and the minimum supported CPU type is POWER9 or higher, and KVM is not selected. This saves 128kB kernel image size (90kB

[RFC PATCH] powerpc: Investigate static_call concept

2021-08-27 Thread Christophe Leroy
ctr r9 50: 4e 80 04 21 bctrl ... Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/machdep.h | 3 +++ arch/powerpc/include/asm/static_call.h | 25 + arch/powerpc/kernel/Makefile |

Re: [PATCH v2 2/2] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto

2021-08-26 Thread Christophe Leroy
Le 26/08/2021 à 16:45, Michael Ellerman a écrit : Christophe Leroy writes: Le 26/08/2021 à 05:21, Michael Ellerman a écrit : Nathan Chancellor writes: On Tue, Apr 13, 2021 at 04:38:10PM +, Christophe Leroy wrote: Using asm goto in __WARN_FLAGS() and WARN_ON() allows more flexibility

Re: [PATCH v2 2/2] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto

2021-08-26 Thread Christophe Leroy
Le 26/08/2021 à 05:21, Michael Ellerman a écrit : Nathan Chancellor writes: On Tue, Apr 13, 2021 at 04:38:10PM +, Christophe Leroy wrote: Using asm goto in __WARN_FLAGS() and WARN_ON() allows more flexibility to GCC. ... This patch as commit 1e688dd2a3d6 ("powerpc/bug: Pr

Re: [PATCH] powerpc: Make set_endian() return EINVAL when not supporting little endian

2021-08-25 Thread Christophe Leroy
Le 26/08/2021 à 05:41, Michael Ellerman a écrit : Christophe Leroy writes: There is no point in modifying MSR_LE bit on CPUs not supporting little endian. Isn't that an ABI break? Or an ABI fix ? I don't know. My first thought was that all other 32 bits architectures were returning

[PATCH] powerpc: Make set_endian() return EINVAL when not supporting little endian

2021-08-25 Thread Christophe Leroy
There is no point in modifying MSR_LE bit on CPUs not supporting little endian. Just like done for get_endian(), make set_endian() return EINVAL in that case. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/process.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc

[PATCH] powerpc: Redefine HMT_xxx macros as empty on PPC32

2021-08-25 Thread Christophe Leroy
them empty on PPC32 to avoid those instructions. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/vdso/processor.h | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h index e072577bc7c0..8d

Re: [PATCH] powerpc/32: Don't use lmw/stmw for saving/restoring non volatile regs

2021-08-25 Thread Christophe Leroy
Le 24/08/2021 à 15:16, Segher Boessenkool a écrit : Hi! On Tue, Aug 24, 2021 at 07:54:22AM +0200, Christophe Leroy wrote: Le 23/08/2021 à 20:46, Segher Boessenkool a écrit : On Mon, Aug 23, 2021 at 03:29:12PM +, Christophe Leroy wrote: Instructions lmw/stmw are interesting

[PATCH v4 2/2] powerpc: Remove remaining parts of oprofile

2021-08-25 Thread Christophe Leroy
Commit 9850b6c69356 ("arch: powerpc: Remove oprofile") removed oprofile. Remove all remaining parts of it. Signed-off-by: Christophe Leroy Acked-by: Viresh Kumar --- arch/powerpc/include/asm/cputable.h | 3 -- arch/powerpc/kernel/cputable.c| 66 +--

[PATCH v4 1/2] powerpc/perf: Use PVR rather than oprofile field to determine CPU version

2021-08-25 Thread Christophe Leroy
ded power10 and fixed checkpatch issues] Signed-off-by: Christophe Leroy Reviewed-and-tested-by: Athira Rajeev Reviewed-and-tested-By: Kajol Jain [For 24x7 side changes] --- v4: - No change to the series - Added additional Reviewed-by/Tested-by. - Rebased - Resending to get some CI result this t

Re: [PATCH linux-next] powerpc:security: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-08-25 Thread Christophe Leroy
Hi, Le 25/08/2021 à 08:40, CGEL a écrit : From: Jing Yangyang Fix the following coccicheck warning: ./arch/powerpc/kernel/security.c:807:0-23: WARNING: fops_entry_flush should be defined with DEFINE_DEBUGFS_ATTRIBUTE ./arch/powerpc/kernel/security.c:781:0-23:WARNING: fops_rfi_flush should

Re: [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x

2021-08-25 Thread Christophe Leroy
Le 25/08/2021 à 06:54, Michael Ellerman a écrit : Christophe Leroy writes: 40x and BOOKE don't have MSR_RI. Define MSR_RI only for platforms where it exists. For the other ones, defines it as BUILD_BUG for C and do not define it for ASM. Signed-off-by: Christophe Leroy --- v3: Fixes

Re: [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare()

2021-08-24 Thread Christophe Leroy
Le 25/08/2021 à 07:27, Michael Ellerman a écrit : Christophe Leroy writes: In those hot functions that are called at every interrupt, any saved cycle is worth it. interrupt_exit_user_prepare() and interrupt_exit_kernel_prepare() are called from three places: - From entry_32.S - From

Re: [PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC

2021-08-24 Thread Christophe Leroy
Le 24/08/2021 à 16:47, Paul Moore a écrit : On Tue, Aug 24, 2021 at 9:36 AM Christophe Leroy wrote: Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal targets") added generic support for AUDIT but that didn't include support for bi-arch like powerpc. Commit 4b

Re: [PATCH linux-next] selftests/powerpc: remove duplicate include

2021-08-24 Thread Christophe Leroy
Le 24/08/2021 à 16:41, Shuah Khan a écrit : On 8/23/21 9:05 PM, CGEL wrote: From: Changcheng Deng Clean up the following includecheck warning: ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included more than once. No functional change. Reported-by: Zeal Robot

Re: [PATCH linux-next] powerpc/tm: remove duplicate include in tm-poison.c

2021-08-24 Thread Christophe Leroy
Le 24/08/2021 à 16:40, Shuah Khan a écrit : On 8/5/21 12:52 AM, cgel@gmail.com wrote: From: yong yiran 'inttypes.h' included in 'tm-poison.c' is duplicated. Remove all but the first include of inttypes.h from tm-poison.c. Reported-by: Zeal Robot Signed-off-by: yong yiran ---  

[PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC

2021-08-24 Thread Christophe Leroy
t powerpc to that bi-arch generic audit support. Cc: Paul Moore Cc: Eric Paris Signed-off-by: Christophe Leroy --- Resending v2 with Audit people in Cc v2: - Missing 'git add' for arch/powerpc/include/asm/unistd32.h - Finalised commit description --- arch/powerpc/Kconfig| 5 +-

Re: [PATCH v2] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC

2021-08-24 Thread Christophe Leroy
Le 24/08/2021 à 15:24, Michael Ellerman a écrit : Christophe Leroy writes: Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal targets") added generic support for AUDIT but that didn't include support for bi-arch like powerpc. Commit 4b58841149dc ("audit: Add

[PATCH v2] powerpc: Avoid link stack corruption in misc asm functions

2021-08-24 Thread Christophe Leroy
bl;mflr is used at several places to get code position. Use bcl 20,31,+4 instead of bl in order to preserve link stack. See commit c974809a26a1 ("powerpc/vdso: Avoid link stack corruption in __get_datapage()") for details. Signed-off-by: Christophe Leroy --- v2: Use $+4 instea

[PATCH v3] powerpc/booke: Avoid link stack corruption in several places

2021-08-24 Thread Christophe Leroy
Use bcl 20,31,+4 instead of bl in order to preserve link stack. See commit c974809a26a1 ("powerpc/vdso: Avoid link stack corruption in __get_datapage()") for details. Signed-off-by: Christophe Leroy --- v3: Use $+4 as destination instead of label v2: Added missing ; in LOAD_RE

Re: [PATCH] powerpc/32: Don't use lmw/stmw for saving/restoring non volatile regs

2021-08-23 Thread Christophe Leroy
Le 23/08/2021 à 20:46, Segher Boessenkool a écrit : On Mon, Aug 23, 2021 at 03:29:12PM +, Christophe Leroy wrote: Instructions lmw/stmw are interesting for functions that are rarely used and not in the cache, because only one instruction is to be copied into the instruction cache instead

Re: [PATCH] powerpc/booke: Avoid link stack corruption in several places

2021-08-23 Thread Christophe Leroy
Le 23/08/2021 à 17:58, Segher Boessenkool a écrit : On Mon, Aug 23, 2021 at 07:53:01AM +, Christophe Leroy wrote: /* Be careful, this will clobber the lr register. */ #define LOAD_REG_ADDR_PIC(reg, name) \ - bl 0f; \ + bcl

[PATCH v2 5/5] powerpc/signal: Use unsafe_copy_siginfo_to_user()

2021-08-23 Thread Christophe Leroy
Use unsafe_copy_siginfo_to_user() in order to do the copy within the user access block. On an mpc 8321 (book3s/32) the improvment is about 5% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 13 ++--- arch/powerpc/kernel

[PATCH v2 4/5] powerpc/uaccess: Add unsafe_clear_user()

2021-08-23 Thread Christophe Leroy
Implement unsafe_clear_user() for powerpc. It's a copy/paste of unsafe_copy_to_user() with value 0 as source. It may be improved in a later patch by using 'dcbz' instruction to zeroize full cache lines at once. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 20

[PATCH v2 3/5] signal: Add unsafe_copy_siginfo_to_user()

2021-08-23 Thread Christophe Leroy
In the same spirit as commit fb05121fd6a2 ("signal: Add unsafe_get_compat_sigset()"), implement an 'unsafe' version of copy_siginfo_to_user() in order to use it within user access blocks. For that, also add an 'unsafe' version of clear_user(). Signed-off-by: Christophe Leroy --- inc

[PATCH v2 2/5] powerpc/signal: Include the new stack frame inside the user access block

2021-08-23 Thread Christophe Leroy
Include the new stack frame inside the user access block and set it up using unsafe_put_user(). On an mpc 8321 (book3s/32) the improvment is about 4% on a process sending a signal to itself. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_32.c | 29

[PATCH v2 1/5] powerpc/signal64: Access function descriptor with user access block

2021-08-23 Thread Christophe Leroy
Access the function descriptor of the handler within a user access block. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/signal_64.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c

[PATCH] powerpc/32: Don't use lmw/stmw for saving/restoring non volatile regs

2021-08-23 Thread Christophe Leroy
additional cycle. SAVE_NVGPRS / REST_NVGPRS are used in only a few places which are mostly in interrupts entries/exits and in task switch so they are likely already in the cache. Using standard lwz improves null_syscall selftest by: - 10 cycles on mpc832x. - 2 cycles on mpc8xx. Signed-off-by: Christophe

[PATCH v2] powerpc/booke: Avoid link stack corruption in several places

2021-08-23 Thread Christophe Leroy
Use bcl 20,31,+4 instead of bl in order to preserve link stack. See commit c974809a26a1 ("powerpc/vdso: Avoid link stack corruption in __get_datapage()") for details. Signed-off-by: Christophe Leroy --- v2: Added missing ; in LOAD_REG_ADDR_PIC() --- arch/powerpc/include/asm

[PATCH v3 2/2] powerpc/32s: Save content of sr0 to avoid 'mfsr'

2021-08-23 Thread Christophe Leroy
as is. For unlocking, the only thing to do is to clear SR_NX. This improves null_syscall selftest by 12 cycles, ie 4%. Capability to deactive KUEP at boot time is re-enabled by this patch. Signed-off-by: Christophe Leroy --- v3: Simplified patching implied by simplified preceding patch --- arch

  1   2   3   4   5   6   7   8   9   10   >