Re: [PATCH v3] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Christophe Leroy
Le 09/08/2022 à 04:44, Russell Currey a écrit : > The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) > through the execute-only pkey. A PROT_EXEC-only mapping will actually > map to RX, and then the pkey will be applied on top of it. I don't think XOM is a commonly understood

[PATCH] powerpc/kexec: Fix build failure from uninitialised variable

2022-08-08 Thread Russell Currey
clang 14 won't build because ret is uninitialised and can be returned if both prop and fdtprop are NULL. Fixes: b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window") Signed-off-by: Russell Currey --- Not sure what should be returned here, EINVAL seemed reasonable

Re: [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code

2022-08-08 Thread Christophe Leroy
Le 09/08/2022 à 02:55, Russell Currey a écrit : > On Mon, 2022-08-08 at 14:32 +, Christophe Leroy wrote: >> >> >> Le 08/08/2022 à 15:01, Russell Currey a écrit : >>> protection_map is about to be __ro_after_init instead of const, so >>> move >>> the only non-local function that consumes it

Re: [PATCH v4 3/8] dt-bindings: clock: Add ids for Lynx 10g PLLs

2022-08-08 Thread Krzysztof Kozlowski
On 08/08/2022 18:16, Sean Anderson wrote: > >> This entry here is not >> parsed for any tools and only sometimes people look at it. The questions >> are directed via entry in maintainers file or via git history, so you >> can put company email just there. > > As I understand it, the email is

[PATCH v3] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Russell Currey
The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) through the execute-only pkey. A PROT_EXEC-only mapping will actually map to RX, and then the pkey will be applied on top of it. Radix doesn't have pkeys, but it does have execute permissions built-in to the MMU, so all we have to

Re: [PATCH v2 2/2] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Russell Currey
On Mon, 2022-08-08 at 18:54 +0530, Aneesh Kumar K V wrote: > On 8/8/22 6:31 PM, Russell Currey wrote: > > The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) > > through the execute-only pkey.  A PROT_EXEC-only mapping will > > actually > > map to RX, and then the pkey will be

Re: [PATCH] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Russell Currey
On Mon, 2022-08-08 at 18:28 +0530, Aneesh Kumar K V wrote: > On 8/8/22 5:28 PM, Russell Currey wrote: > > The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) > > through the execute-only pkey.  A PROT_ONLY mapping will actually > > map to > > RX, and then the pkey will be applied on

Re: [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code

2022-08-08 Thread Russell Currey
On Mon, 2022-08-08 at 14:32 +, Christophe Leroy wrote: > > > Le 08/08/2022 à 15:01, Russell Currey a écrit : > > protection_map is about to be __ro_after_init instead of const, so > > move > > the only non-local function that consumes it to the same file so it > > can > > at least be static.

Re: [PATCH v2 01/14] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-08-08 Thread Rohan McLure
> Well, of course we need the patch build, so SYSCALL_DEFINE and > COMPAT_SYSCALL_DEFINE have to go with the name changes, that's obvious. > > My comment was more related to changes like the renaming of > ppc64_personality() to do_ppc64_personality() and the creation of >

Re: [PATCH 11/12] powerpc: wiiu: don't enforce flat memory

2022-08-08 Thread Pali Rohár
On Friday 10 June 2022 00:24:20 Pali Rohár wrote: > On Friday 20 May 2022 14:30:02 Pali Rohár wrote: > > + linux-mm > > > > Do you know what are requirements for kernel to support non-contiguous > > memory support and what is needed to enable it for 32-bit powerpc? > > Any hints? PING? > >

Re: [PATCH kernel v2] pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window

2022-08-08 Thread Nathan Chancellor
Hi Alexey, This change is now in mainline as commit b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window"). > diff --git a/arch/powerpc/kexec/file_load_64.c > b/arch/powerpc/kexec/file_load_64.c > index b4981b651d9a..5d2c22aa34fb 100644 > ---

Re: [PATCH v3a 1/2] lib: generic accessor functions for arch keystore

2022-08-08 Thread Michal Suchánek
On Mon, Aug 08, 2022 at 04:31:06PM +, Christophe Leroy wrote: > > > Le 08/08/2022 à 17:43, gjo...@linux.vnet.ibm.com a écrit : > > From: Greg Joyce > > > > Generic kernel subsystems may rely on platform specific persistent > > KeyStore to store objects containing sensitive key material. In

Re: [PATCH v3a 2/2] powerpc/pseries: Override lib/arch_vars.c functions

2022-08-08 Thread Christophe Leroy
Le 08/08/2022 à 17:43, gjo...@linux.vnet.ibm.com a écrit : > From: Greg Joyce > > Self Encrypting Drives(SED) make use of POWER LPAR Platform KeyStore > for storing its variables. Thus the block subsystem needs to access > PowerPC specific functions to read/write objects in PLPKS. > >

Re: [PATCH v3a 1/2] lib: generic accessor functions for arch keystore

2022-08-08 Thread Christophe Leroy
Le 08/08/2022 à 17:43, gjo...@linux.vnet.ibm.com a écrit : > From: Greg Joyce > > Generic kernel subsystems may rely on platform specific persistent > KeyStore to store objects containing sensitive key material. In such case, > they need to access architecture specific functions to perform

[PATCH v3a 1/2] lib: generic accessor functions for arch keystore

2022-08-08 Thread gjoyce
From: Greg Joyce Generic kernel subsystems may rely on platform specific persistent KeyStore to store objects containing sensitive key material. In such case, they need to access architecture specific functions to perform read/write operations on these variables. Define the generic variable

[PATCH v3a 2/2] powerpc/pseries: Override lib/arch_vars.c functions

2022-08-08 Thread gjoyce
From: Greg Joyce Self Encrypting Drives(SED) make use of POWER LPAR Platform KeyStore for storing its variables. Thus the block subsystem needs to access PowerPC specific functions to read/write objects in PLPKS. Override the default implementations in lib/arch_vars.c file with PowerPC specific

[PATCH v3a 0/2] generic and PowerPC accessor functions for arch keystore

2022-08-08 Thread gjoyce
From: Greg Joyce Changelog v3a: - No code changes, but per reviewer requests, adding additional mailing lists(keyring, EFI) for wider review. Architectural neutral functions have been defined for accessing architecture specific variable store. The neutral functions are defined

Re: [PATCH v4 3/8] dt-bindings: clock: Add ids for Lynx 10g PLLs

2022-08-08 Thread Sean Anderson
On 8/8/22 1:46 AM, Krzysztof Kozlowski wrote: > On 05/08/2022 17:17, Sean Anderson wrote: >> >> >> On 8/5/22 2:53 AM, Krzysztof Kozlowski wrote: >>> On 05/08/2022 00:05, Sean Anderson wrote: This adds ids for the Lynx 10g SerDes's internal PLLs. These may be used witn

Re: [PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code

2022-08-08 Thread Christophe Leroy
Le 08/08/2022 à 15:01, Russell Currey a écrit : > protection_map is about to be __ro_after_init instead of const, so move > the only non-local function that consumes it to the same file so it can > at least be static. What's the advantage of doing that ? Why does it need to be static ?

Re: [PATCH v2 2/2] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Aneesh Kumar K V
On 8/8/22 6:31 PM, Russell Currey wrote: > The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) > through the execute-only pkey. A PROT_EXEC-only mapping will actually > map to RX, and then the pkey will be applied on top of it. > > Radix doesn't have pkeys, but it does have execute

[PATCH v3 1/4] proc: Add get_task_cmdline_kernel() function

2022-08-08 Thread Helge Deller
Add a new function get_task_cmdline_kernel() which reads the command line of a process into a kernel buffer. This command line can then be dumped by arch code to give additional debug info via the parameters with which a faulting process was started. The new function re-uses the existing code

[PATCH v3 0/4] Dump command line of faulting process to syslog

2022-08-08 Thread Helge Deller
This patch series dumps the command line (including the program parameters) of a faulting process to the syslog. The motivation for this patch is that it's sometimes quite hard to find out and annoying to not know which program *exactly* faulted when looking at the syslog. For example, a dump on

[PATCH v3 2/4] lib/dump_stack: Add dump_stack_print_cmdline() and wire up in dump_stack_print_info()

2022-08-08 Thread Helge Deller
Add the function dump_stack_print_cmdline() which can be used by arch code to print the command line of the current processs. This function is useful in arch code when dumping information for a faulting process. Wire this function up in the dump_stack_print_info() function to include the dumping

[PATCH v3 3/4] x86/fault: Dump command line of faulting process to syslog

2022-08-08 Thread Helge Deller
If a process segfaults, include the command line of the faulting process in the syslog. In the example below, the "crash" program (which simply writes zero to address 0) was called with the parameters "this is a test": crash[2326]: segfault at 0 ip 561a7969c12e sp 7ffe97a05630 error 6

[PATCH v3 4/4] arc: Use generic dump_stack_print_cmdline() implementation

2022-08-08 Thread Helge Deller
The process program name and command line is now shown in generic code in dump_stack_print_info(), so drop the arc-specific implementation. Signed-off-by: Helge Deller --- arch/arc/kernel/troubleshoot.c | 24 1 file changed, 24 deletions(-) diff --git

[PATCH v2 2/2] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Russell Currey
The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) through the execute-only pkey. A PROT_EXEC-only mapping will actually map to RX, and then the pkey will be applied on top of it. Radix doesn't have pkeys, but it does have execute permissions built-in to the MMU, so all we have to

[PATCH v2 1/2] powerpc/mm: Move vm_get_page_prot() out of book3s64 code

2022-08-08 Thread Russell Currey
protection_map is about to be __ro_after_init instead of const, so move the only non-local function that consumes it to the same file so it can at least be static. Signed-off-by: Russell Currey --- v2: new arch/powerpc/mm/book3s64/pgtable.c | 16 arch/powerpc/mm/pgtable.c

Re: [PATCH] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Aneesh Kumar K V
On 8/8/22 5:28 PM, Russell Currey wrote: > The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) > through the execute-only pkey. A PROT_ONLY mapping will actually map to > RX, and then the pkey will be applied on top of it. > > Radix doesn't have pkeys, but it does have execute

[PATCH 07/16] powerpc: Skip objtool from running on VDSO files

2022-08-08 Thread Sathvika Vasireddy
Do not run objtool on VDSO files, by using OBJECT_FILES_NON_STANDARD Suggested-by: Christophe Leroy Signed-off-by: Sathvika Vasireddy --- arch/powerpc/kernel/vdso/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/vdso/Makefile

[PATCH] powerpc/mm: Support execute-only memory on the Radix MMU

2022-08-08 Thread Russell Currey
The Hash MMU already supports XOM (i.e. mmap with PROT_EXEC only) through the execute-only pkey. A PROT_ONLY mapping will actually map to RX, and then the pkey will be applied on top of it. Radix doesn't have pkeys, but it does have execute permissions built-in to the MMU, so all we have to do

[PATCH 16/16] objtool/powerpc: Add --mcount specific implementation

2022-08-08 Thread Sathvika Vasireddy
This patch enables objtool --mcount on powerpc, and adds implementation specific to powerpc. Signed-off-by: Sathvika Vasireddy --- arch/powerpc/Kconfig | 1 + tools/objtool/arch/powerpc/decode.c | 22 +++

[PATCH 15/16] objtool/powerpc: Enable objtool to be built on ppc

2022-08-08 Thread Sathvika Vasireddy
This patch adds [stub] implementations for required functions, inorder to enable objtool build on powerpc. Signed-off-by: Sathvika Vasireddy [Christophe Leroy: powerpc: Add missing asm/asm.h for objtool] Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 +

[PATCH 14/16] objtool: Add arch specific function arch_ftrace_match()

2022-08-08 Thread Sathvika Vasireddy
Add architecture specific function to look for relocation records pointing to arch specific symbols. Suggested-by: Christophe Leroy Signed-off-by: Sathvika Vasireddy --- tools/objtool/arch/x86/decode.c | 8 tools/objtool/check.c| 2 +-

[PATCH 13/16] objtool: Use macros to define arch specific reloc types

2022-08-08 Thread Sathvika Vasireddy
Make relocation types architecture specific. Signed-off-by: Sathvika Vasireddy --- tools/objtool/arch/x86/include/arch/elf.h | 2 ++ tools/objtool/check.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/objtool/arch/x86/include/arch/elf.h

[PATCH 12/16] objtool: Read special sections with alts only when specific options are selected

2022-08-08 Thread Sathvika Vasireddy
This patch reads special sections which have alternate instructions, only when stackval or orc or uaccess or noinstr options are passed to objtool. Signed-off-by: Sathvika Vasireddy --- tools/objtool/check.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH 11/16] objtool: Add --mnop as an option to --mcount

2022-08-08 Thread Sathvika Vasireddy
Architectures can select HAVE_NOP_MCOUNT if they choose to nop out mcount call sites. If that config option is selected, then --mnop is passed as an option to objtool, along with --mcount. Also, make sure that --mnop can be passed as an option to objtool only when --mcount is passed.

[PATCH 10/16] objtool: Use target file class size instead of a compiled constant

2022-08-08 Thread Sathvika Vasireddy
From: Christophe Leroy In order to allow using objtool on cross-built kernels, determine size of long from elf data instead of using sizeof(long) at build time. For the time being this covers only mcount. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 16

[PATCH 09/16] objtool: Use target file endianness instead of a compiled constant

2022-08-08 Thread Sathvika Vasireddy
From: Christophe Leroy Some architectures like powerpc support both endianness, it's therefore not possible to fix the endianness via arch/endianness.h because there is no easy way to get the target endianness at build time. Use the endianness recorded in the file objtool is working on.

[PATCH 08/16] objtool: Fix SEGFAULT

2022-08-08 Thread Sathvika Vasireddy
From: Christophe Leroy find_insn() will return NULL in case of failure. Check insn in order to avoid a kernel Oops for NULL pointer dereference. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/check.c

[PATCH 06/16] powerpc: Fix objtool unannotated intra-function call warnings on PPC32

2022-08-08 Thread Sathvika Vasireddy
From: Christophe Leroy Fix several annotations in assembly files on PPC32. Signed-off-by: Christophe Leroy [Sathvika Vasireddy: Changed subject line from objtool/powerpc: Activate objtool on PPC32 to powerpc: Fix objtool unannotated intra-function call warnings on PPC32, and removed Kconfig

[PATCH 05/16] powerpc: Skip objtool from running on drivers/crypto/vmx/aesp8-ppc.o

2022-08-08 Thread Sathvika Vasireddy
With objtool enabled, below warnings are seen when trying to build: drivers/crypto/vmx/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: unannotated intra-function call drivers/crypto/vmx/aesp8-ppc.o: warning: objtool: .text+0x2448: unannotated intra-function call

[PATCH 03/16] powerpc: Fix objtool unannotated intra-function call warnings

2022-08-08 Thread Sathvika Vasireddy
objtool throws unannotated intra-function call warnings in the following assembly files. arch/powerpc/kernel/vector.o: warning: objtool: .text+0x53c: unannotated intra-function call arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x60: unannotated intra-function call

[PATCH 04/16] powerpc: curb objtool unannotated intra-function call warnings

2022-08-08 Thread Sathvika Vasireddy
objtool throws the following unannotated intra-function call warnings: arch/powerpc/kernel/entry_64.o: warning: objtool: .text+0x4: unannotated intra-function call arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0xe64: unannotated intra-function call

[PATCH 02/16] powerpc: override __ALIGN() and __ALIGN_STR() macros

2022-08-08 Thread Sathvika Vasireddy
Since we need an alignment of 4 bytes, override __ALIGN() and __ALIGN_STR() accordingly. Signed-off-by: Sathvika Vasireddy --- arch/powerpc/include/asm/linkage.h | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h

[PATCH 01/16] powerpc: Replace unreachable() with it's builtin variant in WARN_ON()

2022-08-08 Thread Sathvika Vasireddy
objtool is throwing *unannotated intra-function call* warnings with a few instructions that are marked unreachable. Replace unreachable() with __builtin_unreachable() to fix these warnings, as the codegen remains same with unreachable() and __builtin_unreachable(). Signed-off-by: Sathvika

[PATCH 00/16] objtool: Enable and implement --mcount option on powerpc

2022-08-08 Thread Sathvika Vasireddy
This patchset enables and implements objtool --mcount option on powerpc. This applies atop powerpc/merge branch. Christophe Leroy (4): objtool: Fix SEGFAULT objtool: Use target file endianness instead of a compiled constant objtool: Use target file class size instead of a compiled constant

Re: [PATCH v2 13/14] powerpc/64s: Fix comment on interrupt handler prologue

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:31, Rohan McLure a écrit : > Interrupt handlers on 64s systems will often need to save register state > from the interrupted process to make space for loading special purpose > registers or for internal state. > > Fix a comment documenting a common code path macro in the

Re: [PATCH v2 12/14] powerpc/64s: Use {NULLIFY,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:31, Rohan McLure a écrit : > Use the convenience macros for saving/clearing/restoring gprs in keeping > with syscall calling conventions. The plural variants of these macros > can store a range of registers for concision. > > This works well when the save-to-stack logic is

Re: [PATCH v2 09/14] powerpc: Add NULLIFY_GPRS macros for register clears

2022-08-08 Thread Christophe Leroy
Le 08/08/2022 à 09:42, Andrew Donnellan a écrit : > On Mon, 2022-07-25 at 16:29 +1000, Rohan McLure wrote: >> Macros for restoring and saving registers to and from the stack >> exist. >> Provide macros with the same interface for clearing a range of gprs >> by >> setting each register's value in

Re: [PATCH v2 04/14] powerpc/32: Remove powerpc select specialisation

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:26, Rohan McLure a écrit : > Syscall #82 has been implemented for 32-bit platforms in a unique way on > powerpc systems. This hack will in effect guess whether the caller is > expecting new select semantics or old select semantics. It does so via a > guess, based off the first

Re: [PATCH v2 06/14] powerpc: Include all arch-specific syscall prototypes

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:27, Rohan McLure a écrit : > Forward declare all syscall handler prototypes where a generic prototype > is not provided in either linux/syscalls.h or linux/compat.h in > asm/syscalls.h. This is required for compile-time type-checking for > syscall handlers, which is

Re: [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:25, Rohan McLure a écrit : > Syscall handlers should not be invoked internally by their symbol names, > as these symbols defined by the architecture-defined SYSCALL_DEFINE > macro. Move the compatibility syscall definition for mmap2 to > syscalls.c, so that all mmap

Re: [PATCH v2 01/14] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-08-08 Thread Christophe Leroy
Le 08/08/2022 à 08:04, Rohan McLure a écrit : > Thanks for reviewing my patches. > >> I think this patch should be split in two patches. One where you just >> change to using SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE, and a second >> patch for everything else. >> >> The first patch could then be

Re: [PATCH v2 12/14] powerpc/64s: Use {NULLIFY,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-08-08 Thread Andrew Donnellan
On Mon, 2022-07-25 at 16:31 +1000, Rohan McLure wrote: > Use the convenience macros for saving/clearing/restoring gprs in > keeping > with syscall calling conventions. The plural variants of these macros > can store a range of registers for concision. > > This works well when the save-to-stack

Re: [PATCH v2 10/14] powerpc: Provide syscall wrapper

2022-08-08 Thread Christophe Leroy
Le 25/07/2022 à 08:30, Rohan McLure a écrit : > Implement syscall wrapper as per s390, x86, arm64. When enabled > cause handlers to accept parameters from a stack frame rather than > from user scratch register state. This allows for user registers to be > safely cleared in order to reduce caller

Re: [PATCH v2 09/14] powerpc: Add NULLIFY_GPRS macros for register clears

2022-08-08 Thread Andrew Donnellan
On Mon, 2022-07-25 at 16:29 +1000, Rohan McLure wrote: > Macros for restoring and saving registers to and from the stack > exist. > Provide macros with the same interface for clearing a range of gprs > by > setting each register's value in that range to zero. > > The resulting macros are called

Re: [PATCH v2 08/14] powerpc: Use common syscall handler type

2022-08-08 Thread Andrew Donnellan
On Mon, 2022-07-25 at 16:28 +1000, Rohan McLure wrote: > Cause syscall handlers to be typed as follows when called indirectly > throughout the kernel. > > typedef long (*syscall_fn)(unsigned long, unsigned long, unsigned > long, >    unsigned long, unsigned long, unsigned

Re: [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall

2022-08-08 Thread Rohan McLure
>> --- a/arch/powerpc/kernel/asm-offsets.c >> +++ b/arch/powerpc/kernel/asm-offsets.c >> @@ -9,6 +9,7 @@ >> * #defines from the assembly-language output. >> */ >> >> +#include > > What's this for? Good spot.

Re: [PATCH v2 01/14] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-08-08 Thread Rohan McLure
Thanks for reviewing my patches. > I think this patch should be split in two patches. One where you just > change to using SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE, and a second > patch for everything else. > > The first patch could then be linked to >