Stable backport request

2021-10-23 Thread Michael Ellerman
Hi Greg, Please backport the following commit to v5.4 and v5.10: 73287caa9210ded6066833195f4335f7f688a46b ("powerpc64/idle: Fix SP offsets when saving GPRs") And please backport the following commits to v5.4, v5.10 and v5.14: 9b4416c5095c20e110c82ae602c254099b83b72f ("KVM: PPC: Book3S

Re: [PATCH] locking: remove spin_lock_flags() etc

2021-10-23 Thread Arnd Bergmann
On Sat, Oct 23, 2021 at 3:37 AM Waiman Long wrote: >> On 10/22/21 7:59 AM, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > As this is all dead code, just remove it and the helper functions built > > around it. For arch/ia64, the inline asm could be cleaned up, but > > it seems safer to

Re: [PATCH] powerpc: Enhance pmem DMA bypass handling

2021-10-23 Thread Alexey Kardashevskiy
On 23/10/2021 07:18, Brian King wrote: On 10/22/21 7:24 AM, Alexey Kardashevskiy wrote: On 22/10/2021 04:44, Brian King wrote: If ibm,pmemory is installed in the system, it can appear anywhere in the address space. This patch enhances how we handle DMA for devices when ibm,pmemory is

[PATCH v2 10/10] powerpc/fsl_booke: Enable STRICT_KERNEL_RWX

2021-10-23 Thread Christophe Leroy
Enable STRICT_KERNEL_RWX on fsl_booke. For that, we need additional TLBCAMs dedicated to linear mapping, based on the alignment of _sinittext. By default, up to 768 Mbytes of memory are mapped. It uses 3 TLBCAMs of size 256 Mbytes. With a data alignment of 16, we need up to 9 TLBCAMs:

[PATCH v2 09/10] powerpc/fsl_booke: Update of TLBCAMs after init

2021-10-23 Thread Christophe Leroy
After init, set readonly memory as ROX and set readwrite memory as RWX, if STRICT_KERNEL_RWX is enabled. Signed-off-by: Christophe Leroy --- v2: No change --- arch/powerpc/mm/mmu_decl.h | 2 +- arch/powerpc/mm/nohash/fsl_book3e.c | 32 + 2 files changed, 29

[PATCH v2 08/10] powerpc/fsl_booke: Allocate separate TLBCAMs for readonly memory

2021-10-23 Thread Christophe Leroy
Reorganise TLBCAM allocation so that when STRICT_KERNEL_RWX is enabled, TLBCAMs are allocated such that readonly memory uses different TLBCAMs. This results in an allocation looking like: Memory CAM mapping: 4/4/4/1/1/1/1/16/16/16/64/64/64/256/256 Mb, residual: 256Mb Signed-off-by: Christophe

[PATCH v2 07/10] powerpc/fsl_booke: Tell map_mem_in_cams() if init is done

2021-10-23 Thread Christophe Leroy
In order to be able to call map_mem_in_cams() once more after init for STRICT_KERNEL_RWX, add an argument. For now, map_mem_in_cams() is always called only during init. Signed-off-by: Christophe Leroy --- v2: No change --- arch/powerpc/mm/mmu_decl.h | 2 +-

[PATCH v2 06/10] powerpc/fsl_booke: Enable reloading of TLBCAM without switching to AS1

2021-10-23 Thread Christophe Leroy
Avoid switching to AS1 when reloading TLBCAM after init for STRICT_KERNEL_RWX. When we setup AS1 we expect the entire accessible memory to be mapped through one entry, this is not the case anymore at the end of init. We are not changing the size of TLBCAMs, only flags, so no need to switch to

[PATCH v2 05/10] powerpc/fsl_booke: Take exec flag into account when setting TLBCAMs

2021-10-23 Thread Christophe Leroy
Don't force MAS3_SX and MAS3_UX at all time. Take into account the exec flag. While at it, fix a couple of closeby style problems (indent with space and unnecessary parenthesis), it keeps more readability. Signed-off-by: Christophe Leroy --- v2: Use the new _PAGE_EXEC to check executability of

[PATCH v2 04/10] powerpc/fsl_booke: Rename fsl_booke.c to fsl_book3e.c

2021-10-23 Thread Christophe Leroy
We have a myriad of CONFIG symbols around different variants of BOOKEs, which would be worth tidying up one day. But at least, make file names and CONFIG option match: We have CONFIG_FSL_BOOKE and CONFIG_PPC_FSL_BOOK3E. fsl_booke.c is selected by and only by CONFIG_PPC_FSL_BOOK3E. So rename it

[PATCH v2 03/10] powerpc/booke: Disable STRICT_KERNEL_RWX, DEBUG_PAGEALLOC and KFENCE

2021-10-23 Thread Christophe Leroy
fsl_booke and 44x are not able to map kernel linear memory with pages, so they can't support DEBUG_PAGEALLOC and KFENCE, and STRICT_KERNEL_RWX is also a problem for now. Enable those only on book3s (both 32 and 64 except KFENCE), 8xx and 40x. Fixes: 88df6e90fa97 ("[POWERPC] DEBUG_PAGEALLOC for

[PATCH v2 02/10] powerpc/book3e: Fix set_memory_x() and set_memory_nx()

2021-10-23 Thread Christophe Leroy
set_memory_x() calls pte_mkexec() which sets _PAGE_EXEC. set_memory_nx() calls pte_exprotec() which clears _PAGE_EXEC. Book3e has 2 bits, UX and SX, which defines the exec rights resp. for user (PR=1) and for kernel (PR=0). _PAGE_EXEC is defined as UX only. An executable kernel page is set with

[PATCH v2 01/10] powerpc/nohash: Fix __ptep_set_access_flags() and ptep_set_wrprotect()

2021-10-23 Thread Christophe Leroy
Commit 26973fa5ac0e ("powerpc/mm: use pte helpers in generic code") changed those two functions to use pte helpers to determine which bits to clear and which bits to set. This change was based on the assumption that bits to be set/cleared are always the same and can be determined by applying the