File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
arch/powerpc/include/asm/book3s/32 Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 44
55#include <asm/bug.h>
66#include <asm/book3s/32/mmu-hash.h>
7+ #include <asm/mmu.h>
8+ #include <asm/synch.h>
79
810#ifndef __ASSEMBLY__
911
@@ -18,6 +20,15 @@ static inline void kuep_lock(void)
1820 return ;
1921
2022 update_user_segments (mfsr (0 ) | SR_NX );
23+ /*
24+ * This isync() shouldn't be necessary as the kernel is not excepted to
25+ * run any instruction in userspace soon after the update of segments,
26+ * but hash based cores (at least G3) seem to exhibit a random
27+ * behaviour when the 'isync' is not there. 603 cores don't have this
28+ * behaviour so don't do the 'isync' as it saves several CPU cycles.
29+ */
30+ if (mmu_has_feature (MMU_FTR_HPTE_TABLE ))
31+ isync (); /* Context sync required after mtsr() */
2132}
2233
2334static inline void kuep_unlock (void )
@@ -26,6 +37,15 @@ static inline void kuep_unlock(void)
2637 return ;
2738
2839 update_user_segments (mfsr (0 ) & ~SR_NX );
40+ /*
41+ * This isync() shouldn't be necessary as a 'rfi' will soon be executed
42+ * to return to userspace, but hash based cores (at least G3) seem to
43+ * exhibit a random behaviour when the 'isync' is not there. 603 cores
44+ * don't have this behaviour so don't do the 'isync' as it saves several
45+ * CPU cycles.
46+ */
47+ if (mmu_has_feature (MMU_FTR_HPTE_TABLE ))
48+ isync (); /* Context sync required after mtsr() */
2949}
3050
3151#ifdef CONFIG_PPC_KUAP
You can’t perform that action at this time.
0 commit comments