Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/603: Really copy kernel PGD entries into all PGDIRs

Commit 82ef440f9a38 ("powerpc/603: Copy kernel PGD entries into all
PGDIRs and preallocate execmem page tables") was supposed to extend
to powerpc 603 the copy of kernel PGD entries into all PGDIRs
implemented in a previous patch on the 8xx. But 603 is book3s/32 and
uses a duplicate of pgd_alloc() defined in another header.

So really do the copy at the correct place for the 603.

Fixes: 82ef440f9a38 ("powerpc/603: Copy kernel PGD entries into all PGDIRs and preallocate execmem page tables")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/752ab7514cae089a2dd7cc0f3d5e35849f76adb9.1755757797.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Madhavan Srinivasan
f2863371 d9e46de4

+9 -3
+8 -2
arch/powerpc/include/asm/book3s/32/pgalloc.h
··· 7 7 8 8 static inline pgd_t *pgd_alloc(struct mm_struct *mm) 9 9 { 10 - return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), 11 - pgtable_gfp_flags(mm, GFP_KERNEL)); 10 + pgd_t *pgd = kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), 11 + pgtable_gfp_flags(mm, GFP_KERNEL)); 12 + 13 + #ifdef CONFIG_PPC_BOOK3S_603 14 + memcpy(pgd + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, 15 + (MAX_PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); 16 + #endif 17 + return pgd; 12 18 } 13 19 14 20 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
+1 -1
arch/powerpc/include/asm/nohash/pgalloc.h
··· 22 22 pgd_t *pgd = kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), 23 23 pgtable_gfp_flags(mm, GFP_KERNEL)); 24 24 25 - #if defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC_BOOK3S_603) 25 + #ifdef CONFIG_PPC_8xx 26 26 memcpy(pgd + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, 27 27 (MAX_PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); 28 28 #endif