powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
[ Upstream commit aa4113340ae6c2811e046f08c2bc21011d20a072 ]
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: d9e1831a42
("powerpc/85xx: Load all early TLB entries at once")
Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Scott Wood <oss@buserror.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200123111914.2565-1-laurentiu.tudor@nxp.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5cbf92e3c7
commit
a493baf2f2
1 changed files with 11 additions and 1 deletions
|
@ -400,7 +400,7 @@ _GLOBAL(set_context)
|
||||||
* extern void loadcam_entry(unsigned int index)
|
* extern void loadcam_entry(unsigned int index)
|
||||||
*
|
*
|
||||||
* Load TLBCAM[index] entry in to the L2 CAM MMU
|
* Load TLBCAM[index] entry in to the L2 CAM MMU
|
||||||
* Must preserve r7, r8, r9, and r10
|
* Must preserve r7, r8, r9, r10 and r11
|
||||||
*/
|
*/
|
||||||
_GLOBAL(loadcam_entry)
|
_GLOBAL(loadcam_entry)
|
||||||
mflr r5
|
mflr r5
|
||||||
|
@ -436,6 +436,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
|
||||||
*/
|
*/
|
||||||
_GLOBAL(loadcam_multi)
|
_GLOBAL(loadcam_multi)
|
||||||
mflr r8
|
mflr r8
|
||||||
|
/* Don't switch to AS=1 if already there */
|
||||||
|
mfmsr r11
|
||||||
|
andi. r11,r11,MSR_IS
|
||||||
|
bne 10f
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up temporary TLB entry that is the same as what we're
|
* Set up temporary TLB entry that is the same as what we're
|
||||||
|
@ -461,6 +465,7 @@ _GLOBAL(loadcam_multi)
|
||||||
mtmsr r6
|
mtmsr r6
|
||||||
isync
|
isync
|
||||||
|
|
||||||
|
10:
|
||||||
mr r9,r3
|
mr r9,r3
|
||||||
add r10,r3,r4
|
add r10,r3,r4
|
||||||
2: bl loadcam_entry
|
2: bl loadcam_entry
|
||||||
|
@ -469,6 +474,10 @@ _GLOBAL(loadcam_multi)
|
||||||
mr r3,r9
|
mr r3,r9
|
||||||
blt 2b
|
blt 2b
|
||||||
|
|
||||||
|
/* Don't return to AS=0 if we were in AS=1 at function start */
|
||||||
|
andi. r11,r11,MSR_IS
|
||||||
|
bne 3f
|
||||||
|
|
||||||
/* Return to AS=0 and clear the temporary entry */
|
/* Return to AS=0 and clear the temporary entry */
|
||||||
mfmsr r6
|
mfmsr r6
|
||||||
rlwinm. r6,r6,0,~(MSR_IS|MSR_DS)
|
rlwinm. r6,r6,0,~(MSR_IS|MSR_DS)
|
||||||
|
@ -484,6 +493,7 @@ _GLOBAL(loadcam_multi)
|
||||||
tlbwe
|
tlbwe
|
||||||
isync
|
isync
|
||||||
|
|
||||||
|
3:
|
||||||
mtlr r8
|
mtlr r8
|
||||||
blr
|
blr
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue