Skip to content

Commit 81b9336

Browse files
tudorlgregkh
authored andcommitted
powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
commit aa41133 upstream. In the current implementation, the call to loadcam_multi() is wrapped between switch_to_as1() and restore_to_as0() calls so, when it tries to create its own temporary AS=1 TLB1 entry, it ends up duplicating the existing one created by switch_to_as1(). Add a check to skip creating the temporary entry if already running in AS=1. Fixes: d9e1831 ("powerpc/85xx: Load all early TLB entries at once") Cc: [email protected] # v4.4+ Signed-off-by: Laurentiu Tudor <[email protected]> Acked-by: Scott Wood <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 38aa7f3 commit 81b9336

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/powerpc/mm/nohash/tlb_low.S

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ _GLOBAL(set_context)
397397
* extern void loadcam_entry(unsigned int index)
398398
*
399399
* Load TLBCAM[index] entry in to the L2 CAM MMU
400-
* Must preserve r7, r8, r9, and r10
400+
* Must preserve r7, r8, r9, r10 and r11
401401
*/
402402
_GLOBAL(loadcam_entry)
403403
mflr r5
@@ -433,6 +433,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
433433
*/
434434
_GLOBAL(loadcam_multi)
435435
mflr r8
436+
/* Don't switch to AS=1 if already there */
437+
mfmsr r11
438+
andi. r11,r11,MSR_IS
439+
bne 10f
436440

437441
/*
438442
* Set up temporary TLB entry that is the same as what we're
@@ -458,6 +462,7 @@ _GLOBAL(loadcam_multi)
458462
mtmsr r6
459463
isync
460464

465+
10:
461466
mr r9,r3
462467
add r10,r3,r4
463468
2: bl loadcam_entry
@@ -466,6 +471,10 @@ _GLOBAL(loadcam_multi)
466471
mr r3,r9
467472
blt 2b
468473

474+
/* Don't return to AS=0 if we were in AS=1 at function start */
475+
andi. r11,r11,MSR_IS
476+
bne 3f
477+
469478
/* Return to AS=0 and clear the temporary entry */
470479
mfmsr r6
471480
rlwinm. r6,r6,0,~(MSR_IS|MSR_DS)
@@ -481,6 +490,7 @@ _GLOBAL(loadcam_multi)
481490
tlbwe
482491
isync
483492

493+
3:
484494
mtlr r8
485495
blr
486496
#endif

0 commit comments

Comments
 (0)