File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 7
7
#include <uapi/asm/mman.h>
8
8
9
9
static inline unsigned long arch_calc_vm_prot_bits (unsigned long prot ,
10
- unsigned long pkey __always_unused )
10
+ unsigned long pkey )
11
11
{
12
12
unsigned long ret = 0 ;
13
13
@@ -17,6 +17,14 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
17
17
if (system_supports_mte () && (prot & PROT_MTE ))
18
18
ret |= VM_MTE ;
19
19
20
+ #ifdef CONFIG_ARCH_HAS_PKEYS
21
+ if (system_supports_poe ()) {
22
+ ret |= pkey & BIT (0 ) ? VM_PKEY_BIT0 : 0 ;
23
+ ret |= pkey & BIT (1 ) ? VM_PKEY_BIT1 : 0 ;
24
+ ret |= pkey & BIT (2 ) ? VM_PKEY_BIT2 : 0 ;
25
+ }
26
+ #endif
27
+
20
28
return ret ;
21
29
}
22
30
#define arch_calc_vm_prot_bits (prot , pkey ) arch_calc_vm_prot_bits(prot, pkey)
Original file line number Diff line number Diff line change @@ -102,6 +102,17 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags)
102
102
if (vm_flags & VM_MTE )
103
103
prot |= PTE_ATTRINDX (MT_NORMAL_TAGGED );
104
104
105
+ #ifdef CONFIG_ARCH_HAS_PKEYS
106
+ if (system_supports_poe ()) {
107
+ if (vm_flags & VM_PKEY_BIT0 )
108
+ prot |= PTE_PO_IDX_0 ;
109
+ if (vm_flags & VM_PKEY_BIT1 )
110
+ prot |= PTE_PO_IDX_1 ;
111
+ if (vm_flags & VM_PKEY_BIT2 )
112
+ prot |= PTE_PO_IDX_2 ;
113
+ }
114
+ #endif
115
+
105
116
return __pgprot (prot );
106
117
}
107
118
EXPORT_SYMBOL (vm_get_page_prot );
You can’t perform that action at this time.
0 commit comments