[PATCH v5 03/10] powerpc/pmem: Add flush routines using new pmem store and sync instruction

2020-06-10 Thread Aneesh Kumar K.V
Start using dcbstps; phwsync; sequence for flushing persistent memory range. The new instructions are implemented as a variant of dcbf and hwsync and on P8 and P9 they will be executed as those instructions. We avoid using them on older hardware. This helps to avoid difficult to debug bugs.

[PATCH v5 08/10] libnvdimm/dax: Add a dax flag to control synchronous fault support

2020-06-10 Thread Aneesh Kumar K.V
With POWER10, architecture is adding new pmem flush and sync instructions. The kernel should prevent the usage of MAP_SYNC if applications are not using the new instructions on newer hardware This patch adds a dax attribute (/sys/bus/nd/devices/region0/pfn0.1/block/pmem0/dax/sync_fault) which

[PATCH v5 09/10] powerpc/pmem: Disable synchronous fault by default

2020-06-10 Thread Aneesh Kumar K.V
This adds a kernel config option that controls whether MAP_SYNC is enabled by default. With POWER10, architecture is adding new pmem flush and sync instructions. The kernel should prevent the usage of MAP_SYNC if applications are not using the new instructions on newer hardware. This config

[PATCH v5 02/10] powerpc/pmem: Add new instructions for persistent storage and sync

2020-06-10 Thread Aneesh Kumar K.V
POWER10 introduces two new variants of dcbf instructions (dcbstps and dcbfps) that can be used to write modified locations back to persistent storage. Additionally, POWER10 also introduce phwsync and plwsync which can be used to establish order of these writes to persistent storage. This patch

[PATCH v5 06/10] powerpc/pmem: Avoid the barrier in flush routines

2020-06-10 Thread Aneesh Kumar K.V
nvdimm expect the flush routines to just mark the cache clean. The barrier that mark the store globally visible is done in nvdimm_flush(). Update the papr_scm driver to a simplified nvdim_flush callback that do only the required barrier. Signed-off-by: Aneesh Kumar K.V ---

[PATCH v5 07/10] powerpc/book3s/pmem: Add WARN_ONCE to catch the wrong usage of pmem flush functions.

2020-06-10 Thread Aneesh Kumar K.V
We only support persistent memory on P8 and above. This is enforced by the firmware and further checked on virtualzied platform during platform init. Add WARN_ONCE in pmem flush routines to catch the wrong usage of these. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/cacheflush.h

[PATCH v5 00/10] Support new pmem flush and sync instructions for POWER

2020-06-10 Thread Aneesh Kumar K.V
This patch series enables the usage os new pmem flush and sync instructions on POWER architecture. POWER10 introduces two new variants of dcbf instructions (dcbstps and dcbfps) that can be used to write modified locations back to persistent storage. Additionally, POWER10 also introduce phwsync

[PATCH v5 10/10] powerpc/pmem: Initialize pmem device on newer hardware

2020-06-10 Thread Aneesh Kumar K.V
With kernel now supporting new pmem flush/sync instructions, we can now enable the kernel to initialize the device. On P10 these devices would appear with a new compatible string. For PAPR device we have compatible "ibm,pmemory-v2" and for OF pmem device we have compatible

[PATCH v5 05/10] powerpc/pmem/of_pmem: Update of_pmem to use the new barrier instruction.

2020-06-10 Thread Aneesh Kumar K.V
of_pmem on POWER10 can now use phwsync instead of hwsync to ensure all previous writes are architecturally visible for the platform buffer flush. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/cacheflush.h | 7 +++ 1 file changed, 7 insertions(+) diff --git

[PATCH v5 04/10] libnvdimm/nvdimm/flush: Allow architecture to override the flush barrier

2020-06-10 Thread Aneesh Kumar K.V
Architectures like ppc64 provide persistent memory specific barriers that will ensure that all stores for which the modifications are written to persistent storage by preceding dcbfps and dcbstps instructions have updated persistent storage before any data access or data transfer caused by

[PATCH v5 01/10] powerpc/pmem: Restrict papr_scm to P8 and above.

2020-06-10 Thread Aneesh Kumar K.V
The PAPR based virtualized persistent memory devices are only supported on POWER9 and above. In the followup patch, the kernel will switch the persistent memory cache flush functions to use a new `dcbf` variant instruction. The new instructions even though added in ISA 3.1 works even on P8 and P9

[PATCH v3 08/41] powerpc/book3s64/pkeys: Convert execute key support to static key

2020-06-10 Thread Aneesh Kumar K.V
Convert the bool to a static key like pkey_disabled. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index

[PATCH v3 15/41] powerpc/book3s64/pkeys: Use execute_pkey_disable static key

2020-06-10 Thread Aneesh Kumar K.V
Use execute_pkey_disabled static key to check for execute key support instead of pkey_disabled. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pkeys.h | 10 +- arch/powerpc/mm/book3s64/pkeys.c | 5 - 2 files changed, 5 insertions(+), 10 deletions(-) diff --git

[PATCH v3 19/41] powerpc/book3s64/kuap: Rename MMU_FTR_RADIX_KUAP to MMU_FTR_KUAP

2020-06-10 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 18 +- arch/powerpc/include/asm/mmu.h | 6

[PATCH v3 28/41] powerpc/ptrace-view: Use pt_regs values instead of thread_struct based one.

2020-06-10 Thread Aneesh Kumar K.V
We will remove thread.amr/iamr/uamor in a later patch Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/ptrace/ptrace-view.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c

Re: [PATCH v11 5/6] ndctl/papr_scm, uapi: Add support for PAPR nvdimm specific methods

2020-06-10 Thread Dan Williams
On Wed, Jun 10, 2020 at 5:10 AM Vaibhav Jain wrote: > > Dan Williams writes: > > > On Tue, Jun 9, 2020 at 10:54 AM Vaibhav Jain wrote: > >> > >> Thanks Dan for the consideration and taking time to look into this. > >> > >> My responses below: > >> > >> Dan Williams writes: > >> > >> > On Mon,

Re: [PATCH? v2] powerpc: Hard wire PT_SOFTE value to 1 in gpr_get() too

2020-06-10 Thread Oleg Nesterov
Hi, looks like this patch was forgotten. Do you think this should be fixed or should we document that PTRACE_GETREGS is not consistent with PTRACE_PEEKUSER on ppc64? On 09/17, Oleg Nesterov wrote: > > I don't have a ppc machine, this patch wasn't even compile tested, > could you please review?

[PATCH] powerpc/spufs: fix the type of ret in spufs_arch_write_note

2020-06-10 Thread Christoph Hellwig
Both the ->dump method and snprintf return an int. So switch to an int and properly handle errors from ->dump. Fixes: 5456ffdee666 ("powerpc/spufs: simplify spufs core dumping") Reported-by: kbuild test robot Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/cell/spufs/coredump.c |

Re: PowerPC KVM-PR issue

2020-06-10 Thread Christian Zigotzky
On 10 June 2020 at 00:18 am, Christian Zigotzky wrote: Hello, KVM-PR doesn't work anymore on my Nemo board [1]. I figured out that the Git kernels and the kernel 5.7 are affected. Error message: Fienix kernel: kvmppc_exit_pr_progint: emulation at 700 failed () I can boot virtual

[PATCH v3 06/41] powerpc/book3s64/pkeys: Prevent key 1 modification from userspace.

2020-06-10 Thread Aneesh Kumar K.V
Key 1 is marked reserved by ISA. Setup uamor to prevent userspace modification of the same. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index

[PATCH v3 11/41] powerpc/book3s64/pkeys: Make initial_allocation_mask static

2020-06-10 Thread Aneesh Kumar K.V
initial_allocation_mask is not used outside this file. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pkeys.h | 1 - arch/powerpc/mm/book3s64/pkeys.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pkeys.h

[PATCH v3 03/41] powerpc/book3s64/pkeys: Move pkey related bits in the linux page table

2020-06-10 Thread Aneesh Kumar K.V
To keep things simple, all the pkey related bits are kept together in linux page table for 64K config with hash translation. With hash-4k kernel requires 4 bits to store slots details. This is done by overloading some of the RPN bits for storing the slot details. Due to this PKEY_BIT0 on the 4K

[PATCH v3 32/41] powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.

2020-06-10 Thread Aneesh Kumar K.V
Radix use AMR Key 0 and hash translation use AMR key 3. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h

[PATCH v3 36/41] powerpc/book3s64/keys: Print information during boot.

2020-06-10 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index bb127e4e2dd2..5d320ac2ba04 100644 --- a/arch/powerpc/mm/book3s64/pkeys.c +++

[PATCH v3 40/41] powerpc/book3s64/keys/kuap: Reset AMR/IAMR values on kexec

2020-06-10 Thread Aneesh Kumar K.V
We can kexec into a kernel that doesn't use memory keys for kernel mapping (such as an older kernel which doesn't support kuap/kuep with hash translation). We need to make sure we reset the AMR/IAMR value on kexec otherwise, the new kernel will use key 0 for kernel mapping and the old AMR value

[PATCH v3 17/41] powerpc/book3s64/kuap: Move KUAP related function outside radix

2020-06-10 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Signed-off-by: Aneesh Kumar K.V --- .../asm/book3s/64/{kup-radix.h => kup.h} | 6 +++--- arch/powerpc/include/asm/kup.h | 2

Re: [PATCH] powerpc/kprobes: Use probe_address() to read instructions

2020-06-10 Thread Michael Ellerman
Christoph Hellwig writes: > On Tue, Jun 09, 2020 at 03:28:38PM +1000, Michael Ellerman wrote: >> On Mon, 24 Feb 2020 18:02:10 + (UTC), Christophe Leroy wrote: >> > In order to avoid Oopses, use probe_address() to read the >> > instruction at the address where the trap happened. >> >> Applied

[RFC PATCH v2 1/3] ASoC: soc-card: export snd_soc_lookup_component_nolocked

2020-06-10 Thread Shengjiu Wang
snd_soc_lookup_component_nolocked can be used for the DPCM case that Front-End needs to get the unused platform component but added by Back-End cpu dai driver. If the component is gotten, then we can get the dma chan created by Back-End component and reused it in Front-End. Signed-off-by:

[RFC PATCH v2 0/3] ASoC: fsl_asrc_dma: Reuse the dma channel if available in Back-End

2020-06-10 Thread Shengjiu Wang
Reuse the dma channel if available in Back-End Shengjiu Wang (3): ASoC: soc-card: export snd_soc_lookup_component_nolocked ASoC: dmaengine_pcm: export soc_component_to_pcm ASoC: fsl_asrc_dma: Reuse the dma channel if available in Back-End changes in v2: - update according to Mark's

Re: [PATCH 0/6] consolidate PowerPC instruction encoding macros

2020-06-10 Thread Michael Ellerman
Balamuruhan S writes: > ppc-opcode.h have base instruction encoding wrapped with stringify_in_c() > for raw encoding to have compatibility. But there are redundant macros for > base instruction encodings in bpf, instruction emulation test infrastructure > and powerpc selftests. > > Currently

Re: [PATCH] tty: serial: cpm_uart: Fix behaviour for non existing GPIOs

2020-06-10 Thread Linus Walleij
Hi Christophe! On Sat, Jun 6, 2020 at 9:30 AM Christophe Leroy wrote: > gpiod = devm_gpiod_get_index(dev, NULL, i, GPIOD_ASIS); > > - if (gpiod) { > + if (!IS_ERR_OR_NULL(gpiod)) { > if (i == GPIO_RTS || i == GPIO_DTR) >

Re: [PATCH v11 5/6] ndctl/papr_scm, uapi: Add support for PAPR nvdimm specific methods

2020-06-10 Thread Vaibhav Jain
Dan Williams writes: > On Tue, Jun 9, 2020 at 10:54 AM Vaibhav Jain wrote: >> >> Thanks Dan for the consideration and taking time to look into this. >> >> My responses below: >> >> Dan Williams writes: >> >> > On Mon, Jun 8, 2020 at 5:16 PM kernel test robot wrote: >> >> >> >> Hi Vaibhav, >>

[PATCH v3 33/41] powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.

2020-06-10 Thread Aneesh Kumar K.V
Radix use IAMR Key 0 and hash translation use IAMR key 3. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h index

[PATCH v3 37/41] powerpc/selftest/ptrave-pkey: Rename variables to make it easier to follow code

2020-06-10 Thread Aneesh Kumar K.V
Rename variable to indicate that they are invalid values which we will use to test ptrace update of pkeys. Signed-off-by: Aneesh Kumar K.V --- .../selftests/powerpc/ptrace/ptrace-pkey.c| 26 +-- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git

[PATCH v3 39/41] powerpc/selftest/ptrace-pkey: IAMR and uamor cannot be updated by ptrace

2020-06-10 Thread Aneesh Kumar K.V
Both IAMR and uamor are privileged and cannot be updated by userspace. Hence we also don't allow ptrace interface to update them. Don't update them in the test. Also expected_iamr is only changed if we can allocate a DISABLE_EXECUTE pkey. Signed-off-by: Aneesh Kumar K.V ---

Re: PowerPC KVM-PR issue

2020-06-10 Thread Christian Zigotzky
On 10 June 2020 at 11:06 am, Christian Zigotzky wrote: On 10 June 2020 at 00:18 am, Christian Zigotzky wrote: Hello, KVM-PR doesn't work anymore on my Nemo board [1]. I figured out that the Git kernels and the kernel 5.7 are affected. Error message: Fienix kernel: kvmppc_exit_pr_progint:

[PATCH v3 34/41] powerpc/book3s64/hash/kuap: Enable kuap on hash

2020-06-10 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index 0f4fc2876fc8..e94585fad5c4 100644 --- a/arch/powerpc/mm/book3s64/pkeys.c +++

[RFC PATCH v2 3/3] ASoC: fsl_asrc_dma: Reuse the dma channel if available in Back-End

2020-06-10 Thread Shengjiu Wang
The dma channel has been requested by Back-End cpu dai driver already. If fsl_asrc_dma requests dma chan with same dma:tx symlink, then there will be below warning with SDMA. [ 48.174236] fsl-esai-dai 2024000.esai: Cannot create DMA dma:tx symlink or with EDMA the request operation will fail

Re: [PATCH] powerpc/pseries/svm: Fixup align argument in alloc_shared_lppaca() function

2020-06-10 Thread Michael Ellerman
Satheesh Rajendran writes: > Argument "align" in alloc_shared_lppaca() function was unused inside the > function. Let's fix it and update code comment. I think it would be better to drop the align argument entirely and keep that logic, and the comment, internal to alloc_shared_lppaca(). cheers

[PATCH v3 38/41] powerpc/selftest/ptrace-pkey: Update the test to mark an invalid pkey correctly

2020-06-10 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- .../selftests/powerpc/ptrace/ptrace-pkey.c| 30 --- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c b/tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c index

[PATCH v3 35/41] powerpc/book3s64/hash/kuep: Enable KUEP on hash

2020-06-10 Thread Aneesh Kumar K.V
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index e94585fad5c4..bb127e4e2dd2 100644 --- a/arch/powerpc/mm/book3s64/pkeys.c +++

[PATCH v3 41/41] powerpc/book3s64/hash/kup: Don't hardcode kup key

2020-06-10 Thread Aneesh Kumar K.V
Make KUAP/KUEP key a variable and also check whether the platform limit the max key such that we can't use the key for KUAP/KEUP. Signed-off-by: Aneesh Kumar K.V --- .../powerpc/include/asm/book3s/64/hash-pkey.h | 22 + arch/powerpc/include/asm/book3s/64/kup.h | 1 +

[RFC PATCH v2 2/3] ASoC: dmaengine_pcm: export soc_component_to_pcm

2020-06-10 Thread Shengjiu Wang
In DPCM case, Front-End needs to get the dma chan which has been requested by Back-End and reuse it. Signed-off-by: Shengjiu Wang --- include/sound/dmaengine_pcm.h | 11 +++ sound/soc/soc-generic-dmaengine-pcm.c | 12 2 files changed, 11 insertions(+), 12

Re: [PATCH 1/6] powerpc/ppc-opcode: introduce PPC_RAW_* macros for base instruction encoding

2020-06-10 Thread Michael Ellerman
Balamuruhan S writes: > Introduce PPC_RAW_* macros to have all the bare encoding of ppc > instructions. Move `VSX_XX*()` and `TMRN()` macros up to reuse it. > > Signed-off-by: Balamuruhan S > Acked-by: Naveen N. Rao > Tested-by: Naveen N. Rao > --- > arch/powerpc/include/asm/ppc-opcode.h |

Re: [PATCH v2 1/4] powerpc/64s: implement probe_kernel_read/write without touching AMR

2020-06-10 Thread Christophe Leroy
Hi Nick Le 03/04/2020 à 11:35, Nicholas Piggin a écrit : There is no need to allow user accesses when probing kernel addresses. You should have a look at https://github.com/torvalds/linux/commit/fa94111d94354de76c47fea6e1187d1ee91e23a7 At seems to implement a generic way of achieving what

[PATCH v3 07/41] powerpc/book3s64/pkeys: kill cpu feature key CPU_FTR_PKEY

2020-06-10 Thread Aneesh Kumar K.V
We don't use CPU_FTR_PKEY anymore. Remove the feature bit and mark it free. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/cputable.h | 13 ++--- arch/powerpc/kernel/dt_cpu_ftrs.c | 6 -- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git

[PATCH v3 13/41] powerpc/book3s64/pkeys: Enable MMU_FTR_PKEY

2020-06-10 Thread Aneesh Kumar K.V
Parse storage keys related device tree entry in early_init_devtree and enable MMU feature MMU_FTR_PKEY if pkeys are supported. MMU feature is used instead of CPU feature because this enables us to group MMU_FTR_KUAP and MMU_FTR_PKEY in asm feature fixup code. Signed-off-by: Aneesh Kumar K.V ---

[PATCH v3 21/41] powerpc/book3s64/kuap: Move UAMOR setup to key init function

2020-06-10 Thread Aneesh Kumar K.V
With hash translation, the kernel will use key 3 for implementing KUAP feature. Hence the default UAMOR value depends on what other keys are marked reserved. Move the UAMOR initialization to pkeys init. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 2 ++

[PATCH v3 25/41] powerpc/book3s64/kuep: Store/restore userspace IAMR correctly on entry and exit from kernel

2020-06-10 Thread Aneesh Kumar K.V
This prepare kernel to operate with a different value than userspace IAMR. For this, IAMR needs to be saved and restored on entry and return from the kernel. If MMU_FTR_KEY is enabled we always use the key mechanism to implement KUEP feature. If MMU_FTR_KEY is not supported and if we support

[PATCH v3 00/41] Kernel userspace access/execution prevention with hash translation

2020-06-10 Thread Aneesh Kumar K.V
This patch series implements KUAP and KUEP with hash translation mode using memory keys. The kernel now uses memory protection key 3 to control access to the kernel. Kernel page table entries are now configured with key 3. Access to locations configured with any other key value is denied when in

[PATCH v3 23/41] powerpc/exec: Set thread.regs early during exec

2020-06-10 Thread Aneesh Kumar K.V
In later patches during exec, we would like to access default regs.kuap to control access to the user mapping. Having thread.regs set early makes the code changes simpler. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/thread_info.h | 2 -- arch/powerpc/kernel/process.c

[PATCH v3 30/41] powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR

2020-06-10 Thread Aneesh Kumar K.V
If an application has configured address protection such that read/write is denied using pkey even the kernel should receive a FAULT on accessing the same. This patch use user AMR value stored in pt_regs.kuap to achieve the same. Signed-off-by: Aneesh Kumar K.V ---

[PATCH v3 01/41] powerpc/book3s64/pkeys: Fixup bit numbering

2020-06-10 Thread Aneesh Kumar K.V
This number the pkey bit such that it is easy to follow. PKEY_BIT0 is the lower order bit. This makes further changes easy to follow. No functional change in this patch other than linux page table for hash translation now maps pkeys differently. Signed-off-by: Aneesh Kumar K.V ---

[PATCH v3 24/41] powerpc/book3s64/pkeys: Store/restore userspace AMR correctly on entry and exit from kernel

2020-06-10 Thread Aneesh Kumar K.V
This prepare kernel to operate with a different value than userspace AMR. For this, AMR needs to be saved and restored on entry and return from the kernel. With KUAP we modify kernel AMR when accessing user address from the kernel via copy_to/from_user interfaces. If MMU_FTR_KEY is enabled we

[PATCH v3 29/41] powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.

2020-06-10 Thread Aneesh Kumar K.V
Now that kernel correctly store/restore userspace AMR/IAMR values, avoid manipulating AMR and IAMR from the kernel on behalf of userspace. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 23 arch/powerpc/include/asm/processor.h | 5 --

[PATCH v3 14/41] powerpc/book3s64/kuep: Add MMU_FTR_KUEP

2020-06-10 Thread Aneesh Kumar K.V
This will be used to enable/disable Kernel Userspace Execution Prevention (KUEP). Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/mmu.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index

[PATCH v3 18/41] powerpc/book3s64/kuep: Move KUEP related function outside radix

2020-06-10 Thread Aneesh Kumar K.V
The next set of patches adds support for kuep with hash translation. In preparation for that rename/move kuap related functions to non radix names. Also set MMU_FTR_KUEP and add the missing isync(). Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 1 +

[PATCH v3 31/41] powerpc/book3s64/kuap: Improve error reporting with KUAP

2020-06-10 Thread Aneesh Kumar K.V
With hash translation use DSISR_KEYFAULT to identify a wrong access. With Radix we look at the AMR value and type of fault. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/32/kup.h | 4 +-- arch/powerpc/include/asm/book3s/64/kup.h | 28

[PATCH v3 02/41] powerpc/book3s64/pkeys: pkeys are supported only on hash on book3s.

2020-06-10 Thread Aneesh Kumar K.V
Move them to hash specific file and add BUG() for radix path. --- .../powerpc/include/asm/book3s/64/hash-pkey.h | 32 arch/powerpc/include/asm/book3s/64/pkeys.h| 25 + arch/powerpc/include/asm/pkeys.h | 37 --- 3 files changed, 64

[PATCH v3 10/41] powerpc/book3s64/pkeys: Convert pkey_total to max_pkey

2020-06-10 Thread Aneesh Kumar K.V
max_pkey now represents max key value that userspace can allocate. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pkeys.h | 7 +-- arch/powerpc/mm/book3s64/pkeys.c | 14 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git

[PATCH v3 09/41] powerpc/book3s64/pkeys: Simplify pkey disable branch

2020-06-10 Thread Aneesh Kumar K.V
Make the default value FALSE (pkey enabled) and set to TRUE when we find the total number of keys supported to be zero. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pkeys.h | 2 +- arch/powerpc/mm/book3s64/pkeys.c | 7 +++ 2 files changed, 4 insertions(+), 5 deletions(-)

[PATCH v3 16/41] powerpc/book3s64/pkeys: Use MMU_FTR_PKEY instead of pkey_disabled static key

2020-06-10 Thread Aneesh Kumar K.V
Instead of pkey_disabled static key use mmu feature MMU_FTR_PKEY. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pkeys.h | 2 +- arch/powerpc/include/asm/pkeys.h | 14 ++ arch/powerpc/mm/book3s64/pkeys.c | 16 +++- 3 files

[PATCH v3 22/41] powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation

2020-06-10 Thread Aneesh Kumar K.V
This patch updates kernel hash page table entries to use storage key 3 for its mapping. This implies all kernel access will now use key 3 to control READ/WRITE. The patch also prevents the allocation of key 3 from userspace and UAMOR value is updated such that userspace cannot modify key 3.

[PATCH v3 27/41] powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec

2020-06-10 Thread Aneesh Kumar K.V
On fork, we inherit from the parent and on exec, we should switch to default_amr values. Also, avoid changing the AMR register value within the kernel. The kernel now runs with different AMR values. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 2 ++

[PATCH v3 04/41] powerpc/book3s64/pkeys: Explain key 1 reservation details

2020-06-10 Thread Aneesh Kumar K.V
This explains the details w.r.t key 1. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index 1199fc2bfaec..d60e6bfa3e03 100644 ---

[PATCH v3 12/41] powerpc/book3s64/pkeys: Mark all the pkeys above max pkey as reserved

2020-06-10 Thread Aneesh Kumar K.V
The hypervisor can return less than max allowed pkey (for ex: 31) instead of 32. We should mark all the pkeys above max allowed as reserved so that we avoid the allocation of the wrong pkey(for ex: key 31 in the above case) by userspace. Signed-off-by: Aneesh Kumar K.V ---

[PATCH v3 20/41] powerpc/book3s64/kuap/kuep: Make KUAP and KUEP a subfeature of PPC_MEM_KEYS

2020-06-10 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. Hence make KUAP a BOOK3S_64 feature. Also make it a subfeature of PPC_MEM_KEYS. Hash translation is going to use pkeys to support KUAP/KUEP. Adding this dependency reduces the code complexity and enables us to move some of the

[PATCH v3 26/41] powerpc/book3s64/pkeys: Inherit correctly on fork.

2020-06-10 Thread Aneesh Kumar K.V
Child thread.kuap value is inherited from the parent in copy_thread_tls. We still need to make sure when the child returns from a fork in the kernel we start with the kernel default AMR value. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/process.c | 9 + 1 file changed, 9

[PATCH v3 05/41] powerpc/book3s64/pkeys: Simplify the key initialization

2020-06-10 Thread Aneesh Kumar K.V
Add documentation explaining the execute_only_key. The reservation and initialization mask details are also explained in this patch. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 186 ++- 1 file changed,

Re: [PATCH v3 24/41] powerpc/book3s64/pkeys: Store/restore userspace AMR correctly on entry and exit from kernel

2020-06-10 Thread kernel test robot
Hi "Aneesh, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20200610] [cannot apply to scottwood/next mpe/next v5.7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we

Re: [PATCH v3 25/41] powerpc/book3s64/kuep: Store/restore userspace IAMR correctly on entry and exit from kernel

2020-06-10 Thread kernel test robot
Hi "Aneesh, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20200610] [cannot apply to scottwood/next mpe/next v5.7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we

Re: [PATCH 2/3] powerpc/pci: unmap legacy INTx interrupts of passthrough IO adapters

2020-06-10 Thread Cédric Le Goater
On 5/27/20 2:57 AM, Oliver O'Halloran wrote: > On Wed, Apr 29, 2020 at 5:51 PM Cédric Le Goater wrote: >> >> When a passthrough IO adapter is removed from a pseries machine using >> hash MMU and the XIVE interrupt mode, the POWER hypervisor, pHyp, >> expects the guest OS to have cleared all page

[PATCH 1/3] powerpc/dt_cpu_ftrs: Remove unused macro ISA_V2_07B

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V2_07B is defined but not used anywhere else in the code. Signed-off-by: Murilo Opsfelder Araujo --- arch/powerpc/kernel/dt_cpu_ftrs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index

[PATCH 0/3] powerpc/dt_cpu_ftrs: Make use of ISA_V3_* macros

2020-06-10 Thread Murilo Opsfelder Araujo
The first patch removes unused macro ISA_V2_07B. The second and third patches make use of macros ISA_V3_0B and ISA_V3_1, respectively, instead their corresponding literals. Murilo Opsfelder Araujo (3): powerpc/dt_cpu_ftrs: Remove unused macro ISA_V2_07B powerpc/dt_cpu_ftrs: Make use of macro

[PATCH kernel] KVM: PPC: Fix nested guest RC bits update

2020-06-10 Thread Alexey Kardashevskiy
Before commit 6cdf30375f82 ("powerpc/kvm/book3s: Use kvm helpers to walk shadow or secondary table") we called __find_linux_pte() with a page table pointer from a kvm_nested_guest struct but now we rely on kvmhv_find_nested() which takes an L1 LPID and returns a kvm_nested_guest pointer, however

Re: [PATCH 2/5] powerpc/lib: Initialize a temporary mm for code patching

2020-06-10 Thread Christopher M. Riedl
On Wed Jun 3, 2020 at 9:01 AM, Christophe Leroy wrote: > > > > > Le 03/06/2020 à 07:19, Christopher M. Riedl a écrit : > > When code patching a STRICT_KERNEL_RWX kernel the page containing the > > address to be patched is temporarily mapped with permissive memory > > protections. Currently, a

[PATCH v2] powerpc: Remove inaccessible CMDLINE default

2020-06-10 Thread Chris Packham
Since commit cbe46bd4f510 ("powerpc: remove CONFIG_CMDLINE #ifdef mess") CONFIG_CMDLINE has always had a value regardless of CONFIG_CMDLINE_BOOL. For example: $ make ARCH=powerpc defconfig $ cat .config # CONFIG_CMDLINE_BOOL is not set CONFIG_CMDLINE="" When enabling CONFIG_CMDLINE_BOOL

Re: [PATCH 3/5] powerpc/lib: Use a temporary mm for code patching

2020-06-10 Thread Christopher M. Riedl
On Wed Jun 3, 2020 at 9:12 AM, Christophe Leroy wrote: > > > > > Le 03/06/2020 à 07:19, Christopher M. Riedl a écrit : > > Currently, code patching a STRICT_KERNEL_RWX exposes the temporary > > mappings to other CPUs. These mappings should be kept local to the CPU > > doing the patching. Use the

Re: [PATCH v2] powerpc: Remove inaccessible CMDLINE default

2020-06-10 Thread Christophe Leroy
Le 11/06/2020 à 05:41, Chris Packham a écrit : Since commit cbe46bd4f510 ("powerpc: remove CONFIG_CMDLINE #ifdef mess") CONFIG_CMDLINE has always had a value regardless of CONFIG_CMDLINE_BOOL. For example: $ make ARCH=powerpc defconfig $ cat .config # CONFIG_CMDLINE_BOOL is not set

RE: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo

2020-06-10 Thread Bharat Gooty
Hello Bhupesh, V6 patch set on Linux 5.7, did not help. I have applied makedump file http://lists.infradead.org/pipermail/kexec/2019-November/023963.html changes also (makedump-1.6.6). Tried to apply it on makedumpfile 1.6.7. Patch set_2 failed. Would like to know, if you have V5 patch set for

RE: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo

2020-06-10 Thread Bharat Gooty
Sorry, error message was not posted. Following is the error message crash: cannot determine VA_BITS_ACTUAL -Original Message- From: Bharat Gooty [mailto:bharat.go...@broadcom.com] Sent: Wednesday, June 10, 2020 10:18 PM To: Scott Branden; 'Bhupesh Sharma'; 'Amit Kachhap' Cc: 'Mark

Re: [RFC PATCH 2/2] powerpc/64s: system call support for scv/rfscv instructions

2020-06-10 Thread Nicholas Piggin
Excerpts from Matheus Castanho's message of May 14, 2020 6:55 am: > Hi Nicholas, > > Small comment below: > > On 4/30/20 1:02 AM, Nicholas Piggin wrote: >> Add support for the scv instruction on POWER9 and later CPUs. >> >> For now this implements the zeroth scv vector 'scv 0', as identical >>

[PATCH v2] All arch: remove system call sys_sysctl

2020-06-10 Thread Xiaoming Ni
Since the commit 61a47c1ad3a4dc ("sysctl: Remove the sysctl system call"), sys_sysctl is actually unavailable: any input can only return an error. We have been warning about people using the sysctl system call for years and believe there are no more users. Even if there are users of this

Re: [PATCH v2] All arch: remove system call sys_sysctl

2020-06-10 Thread Stephen Rothwell
Hi Xiaoming, On Thu, 11 Jun 2020 11:54:00 +0800 Xiaoming Ni wrote: > > arch/sh/configs/dreamcast_defconfig| 1 - > arch/sh/configs/espt_defconfig | 1 - > arch/sh/configs/hp6xx_defconfig| 1 - > arch/sh/configs/landisk_defconfig

Re: [PATCH 1/5] powerpc/mm: Introduce temporary mm

2020-06-10 Thread Christopher M. Riedl
On Wed Jun 3, 2020 at 8:58 AM, Christophe Leroy wrote: > > > > > Le 03/06/2020 à 07:19, Christopher M. Riedl a écrit : > > x86 supports the notion of a temporary mm which restricts access to > > temporary PTEs to a single CPU. A temporary mm is useful for situations > > where a CPU needs to

Re: [PATCH v3 25/41] powerpc/book3s64/kuep: Store/restore userspace IAMR correctly on entry and exit from kernel

2020-06-10 Thread kernel test robot
Hi "Aneesh, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20200610] [cannot apply to v5.7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '-

[PATCH 3/3] powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_1

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V3_1 was defined but never used. Use it instead of literal. Signed-off-by: Murilo Opsfelder Araujo --- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index

[PATCH 2/3] powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_0B

2020-06-10 Thread Murilo Opsfelder Araujo
Macro ISA_V3_0B was defined but never used. Use it instead of literal. Signed-off-by: Murilo Opsfelder Araujo --- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index

Re: [PATCH v5 2/4] riscv: Introduce CONFIG_RELOCATABLE

2020-06-10 Thread Jerome Forissier
On 6/7/20 9:59 AM, Alexandre Ghiti wrote: [...] > +config RELOCATABLE > + bool > + depends on MMU > + help > + This builds a kernel as a Position Independent Executable (PIE), > + which retains all relocation metadata required to relocate the > + kernel

Re: [PATCH v3 24/41] powerpc/book3s64/pkeys: Store/restore userspace AMR correctly on entry and exit from kernel

2020-06-10 Thread kernel test robot
Hi "Aneesh, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20200610] [cannot apply to v5.7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '-