File tree 1 file changed +20
-0
lines changed
arch/powerpc/include/asm/book3s/32 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#include <asm/bug.h>
6
6
#include <asm/book3s/32/mmu-hash.h>
7
+ #include <asm/mmu.h>
8
+ #include <asm/synch.h>
7
9
8
10
#ifndef __ASSEMBLY__
9
11
@@ -18,6 +20,15 @@ static inline void kuep_lock(void)
18
20
return ;
19
21
20
22
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() */
21
32
}
22
33
23
34
static inline void kuep_unlock (void )
@@ -26,6 +37,15 @@ static inline void kuep_unlock(void)
26
37
return ;
27
38
28
39
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() */
29
49
}
30
50
31
51
#ifdef CONFIG_PPC_KUAP
You can’t perform that action at this time.
0 commit comments