WSL2-Linux-Kernel/arch/powerpc/mm/nohash
Christophe Leroy 14965b8e29 powerpc/32: Call mmu_mark_initmem_nx() regardless of data block mapping.
[ Upstream commit 980bbf7ca7 ]

mark_initmem_nx() calls either mmu_mark_initmem_nx() or
set_memory_attr() based on return from v_block_mapped()
of _sinittext.

But we can now handle text and data independently, so that
text may be mapped by block even when data is mapped by pages.

On the 8xx for instance, at startup 32Mbytes of memory are
pinned in TLB. So the pinned entries need to go away for sinittext.

In next patch a BAT will be set to also covers sinittext on book3s/32.
So it will also be needed to call mmu_mark_initmem_nx() even when
data above sinittext is not mapped with BATs.

As this is highly dependent on the platform, call mmu_mark_initmem_nx()
regardless of data block mapping. Then the platform will know what to
do.

Modify 8xx mmu_mark_initmem_nx() so that inittext mapping is modified
only when pagealloc debug and kfence are not active, otherwise inittext
is mapped with standard pages. And don't do anything on kernel text
which is already mapped with PAGE_KERNEL_TEXT.

Fixes: da1adea075 ("powerpc/8xx: Allow STRICT_KERNEL_RwX with pinned TLB")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/db3fc14f3bfa6215b0786ef58a6e2bc1e1f964d7.1655202804.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:24:12 +02:00
..
8xx.c powerpc/32: Call mmu_mark_initmem_nx() regardless of data block mapping. 2022-08-17 14:24:12 +02:00
40x.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
44x.c powerpc/4xx: Fix setup_kuep() on SMP 2021-06-30 22:21:02 +10:00
Makefile powerpc/fsl_booke/32: implement KASLR infrastructure 2019-11-13 19:27:40 +11:00
book3e_hugetlbpage.c powerpc/mm: move FSL_BOOK3 version of update_mmu_cache() 2019-08-20 21:22:14 +10:00
book3e_pgtable.c powerpc/book3e: Fix PUD allocation size in map_kernel_page() 2022-07-07 17:53:24 +02:00
fsl_booke.c powerpc: Retire e200 core (mpc555x processor) 2020-12-05 21:49:18 +11:00
kaslr_booke.c powerpc/book3e: get rid of #include <generated/compile.h> 2022-06-22 14:22:05 +02:00
mmu_context.c powerpc/nohash: Remove DEBUG_HARDER 2021-06-17 00:09:10 +10:00
tlb.c powerpc/8xx: Support 16k hugepages with 4k pages 2020-09-15 22:13:31 +10:00
tlb_low.S powerpc/booke: Avoid link stack corruption in several places 2021-08-25 13:35:47 +10:00
tlb_low_64e.S powerpc/book3e: Fix set_memory_x() and set_memory_nx() 2021-11-18 19:16:57 +01:00