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

powerpc/8xx: Remove offset in SPRN_M_TWB

SPRN_M_TWB contains the address of task PGD minus an offset which
compensates the offset required when accessing the kernel PGDIR.
However, since commit ac9f97ff8b32 ("powerpc/8xx: Inconditionally use
task PGDIR in DTLB misses") and commit 33c527522f39 ("powerpc/8xx:
Inconditionally use task PGDIR in ITLB misses") kernel PGDIR is not
used anymore in hot paths.

Remove this offset which was added by
commit fde5a9057fcf ("powerpc/8xx: Optimise access to swapper_pg_dir")

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[maddy: Fixed checkpatch.pl warning for "pathes"]
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/9710d960b512996e64beebfd368cfeaadb28b3ba.1755509047.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Madhavan Srinivasan
96c79fef a41de5cc

+10 -16
+9 -7
arch/powerpc/kernel/head_8xx.S
··· 190 190 INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11) 191 191 mtspr SPRN_MD_EPN, r10 192 192 mfspr r10, SPRN_M_TWB /* Get level 1 table */ 193 - lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ 193 + lwz r11, 0(r10) /* Get level 1 entry */ 194 194 mtspr SPRN_MD_TWC, r11 195 195 mfspr r10, SPRN_MD_TWC 196 196 lwz r10, 0(r10) /* Get the pte */ ··· 233 233 */ 234 234 mfspr r10, SPRN_MD_EPN 235 235 mfspr r10, SPRN_M_TWB /* Get level 1 table */ 236 - lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ 236 + lwz r11, 0(r10) /* Get level 1 entry */ 237 237 238 238 mtspr SPRN_MD_TWC, r11 239 239 mfspr r10, SPRN_MD_TWC ··· 375 375 mfspr r10, SPRN_DAR 376 376 mtspr SPRN_MD_EPN, r10 377 377 mfspr r11, SPRN_M_TWB /* Get level 1 table */ 378 - lwz r10, (swapper_pg_dir - PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ 378 + lwz r10, 0(r11) /* Get the level 1 entry */ 379 379 cmpwi cr1, r10, 0 380 380 bne cr1, 1f 381 381 ··· 384 384 lwz r10, (swapper_pg_dir - PAGE_OFFSET)@l(r10) /* Get the level 1 entry */ 385 385 cmpwi cr1, r10, 0 386 386 beq cr1, 1f 387 - stw r10, (swapper_pg_dir - PAGE_OFFSET)@l(r11) /* Set the level 1 entry */ 387 + stw r10, 0(r11) /* Set the level 1 entry */ 388 388 mfspr r10, SPRN_M_TW 389 389 mtcr r10 390 390 mfspr r10, SPRN_SPRG_SCRATCH0 ··· 412 412 tophys(r11, r10) 413 413 mfspr r11, SPRN_M_TWB /* Get level 1 table */ 414 414 rlwinm r11, r11, 0, 20, 31 415 - oris r11, r11, (swapper_pg_dir - PAGE_OFFSET)@ha 415 + oris r11, r11, (swapper_pg_dir - PAGE_OFFSET)@h 416 + ori r11, r11, (swapper_pg_dir - PAGE_OFFSET)@l 416 417 3: 417 - lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ 418 + lwz r11, 0(r11) /* Get the level 1 entry */ 418 419 rlwinm r11, r11, 0, ~_PMD_PAGE_8M 419 420 mtspr SPRN_MD_TWC, r11 420 421 mfspr r11, SPRN_MD_TWC ··· 536 535 li r0,0 537 536 stwu r0,THREAD_SIZE-STACK_FRAME_MIN_SIZE(r1) 538 537 539 - lis r6, swapper_pg_dir@ha 538 + lis r6, swapper_pg_dir@h 539 + ori r6, r6, swapper_pg_dir@l 540 540 tophys(r6,r6) 541 541 mtspr SPRN_M_TWB, r6 542 542
+1 -9
arch/powerpc/mm/nohash/mmu_context.c
··· 203 203 static void set_context(unsigned long id, pgd_t *pgd) 204 204 { 205 205 if (IS_ENABLED(CONFIG_PPC_8xx)) { 206 - s16 offset = (s16)(__pa(swapper_pg_dir)); 207 - 208 - /* 209 - * Register M_TWB will contain base address of level 1 table minus the 210 - * lower part of the kernel PGDIR base address, so that all accesses to 211 - * level 1 table are done relative to lower part of kernel PGDIR base 212 - * address. 213 - */ 214 - mtspr(SPRN_M_TWB, __pa(pgd) - offset); 206 + mtspr(SPRN_M_TWB, __pa(pgd)); 215 207 216 208 /* Update context */ 217 209 mtspr(SPRN_M_CASID, id - 1);