File tree Expand file tree Collapse file tree 2 files changed +34
-33
lines changed
arch/arm64/kvm/hyp/include/nvhe Expand file tree Collapse file tree 2 files changed +34
-33
lines changed Original file line number Diff line number Diff line change 11
11
#include <asm/kvm_mmu.h>
12
12
#include <asm/kvm_pgtable.h>
13
13
#include <asm/virt.h>
14
+ #include <nvhe/memory.h>
14
15
#include <nvhe/pkvm.h>
15
16
#include <nvhe/spinlock.h>
16
17
17
- /*
18
- * SW bits 0-1 are reserved to track the memory ownership state of each page:
19
- * 00: The page is owned exclusively by the page-table owner.
20
- * 01: The page is owned by the page-table owner, but is shared
21
- * with another entity.
22
- * 10: The page is shared with, but not owned by the page-table owner.
23
- * 11: Reserved for future use (lending).
24
- */
25
- enum pkvm_page_state {
26
- PKVM_PAGE_OWNED = 0ULL ,
27
- PKVM_PAGE_SHARED_OWNED = BIT (0 ),
28
- PKVM_PAGE_SHARED_BORROWED = BIT (1 ),
29
- __PKVM_PAGE_RESERVED = BIT (0 ) | BIT (1 ),
30
-
31
- /* Meta-states which aren't encoded directly in the PTE's SW bits */
32
- PKVM_NOPAGE = BIT (2 ),
33
- };
34
- #define PKVM_PAGE_META_STATES_MASK (~__PKVM_PAGE_RESERVED)
35
-
36
- #define PKVM_PAGE_STATE_PROT_MASK (KVM_PGTABLE_PROT_SW0 | KVM_PGTABLE_PROT_SW1)
37
- static inline enum kvm_pgtable_prot pkvm_mkstate (enum kvm_pgtable_prot prot ,
38
- enum pkvm_page_state state )
39
- {
40
- prot &= ~PKVM_PAGE_STATE_PROT_MASK ;
41
- prot |= FIELD_PREP (PKVM_PAGE_STATE_PROT_MASK , state );
42
- return prot ;
43
- }
44
-
45
- static inline enum pkvm_page_state pkvm_getstate (enum kvm_pgtable_prot prot )
46
- {
47
- return FIELD_GET (PKVM_PAGE_STATE_PROT_MASK , prot );
48
- }
49
-
50
18
struct host_mmu {
51
19
struct kvm_arch arch ;
52
20
struct kvm_pgtable pgt ;
Original file line number Diff line number Diff line change 7
7
8
8
#include <linux/types.h>
9
9
10
+ /*
11
+ * SW bits 0-1 are reserved to track the memory ownership state of each page:
12
+ * 00: The page is owned exclusively by the page-table owner.
13
+ * 01: The page is owned by the page-table owner, but is shared
14
+ * with another entity.
15
+ * 10: The page is shared with, but not owned by the page-table owner.
16
+ * 11: Reserved for future use (lending).
17
+ */
18
+ enum pkvm_page_state {
19
+ PKVM_PAGE_OWNED = 0ULL ,
20
+ PKVM_PAGE_SHARED_OWNED = BIT (0 ),
21
+ PKVM_PAGE_SHARED_BORROWED = BIT (1 ),
22
+ __PKVM_PAGE_RESERVED = BIT (0 ) | BIT (1 ),
23
+
24
+ /* Meta-states which aren't encoded directly in the PTE's SW bits */
25
+ PKVM_NOPAGE = BIT (2 ),
26
+ };
27
+ #define PKVM_PAGE_META_STATES_MASK (~__PKVM_PAGE_RESERVED)
28
+
29
+ #define PKVM_PAGE_STATE_PROT_MASK (KVM_PGTABLE_PROT_SW0 | KVM_PGTABLE_PROT_SW1)
30
+ static inline enum kvm_pgtable_prot pkvm_mkstate (enum kvm_pgtable_prot prot ,
31
+ enum pkvm_page_state state )
32
+ {
33
+ prot &= ~PKVM_PAGE_STATE_PROT_MASK ;
34
+ prot |= FIELD_PREP (PKVM_PAGE_STATE_PROT_MASK , state );
35
+ return prot ;
36
+ }
37
+
38
+ static inline enum pkvm_page_state pkvm_getstate (enum kvm_pgtable_prot prot )
39
+ {
40
+ return FIELD_GET (PKVM_PAGE_STATE_PROT_MASK , prot );
41
+ }
42
+
10
43
struct hyp_page {
11
44
unsigned short refcount ;
12
45
unsigned short order ;
You can’t perform that action at this time.
0 commit comments