Skip to content

Commit 3d467f7

Browse files
willdeaconMarc Zyngier
authored andcommitted
KVM: arm64: Extend pkvm_page_state enumeration to handle absent pages
Explicitly name the combination of SW0 | SW1 as reserved in the pte and introduce a new PKVM_NOPAGE meta-state which, although not directly stored in the software bits of the pte, can be used to represent an entry for which there is no underlying page. This is distinct from an invalid pte, as stage-2 identity mappings for the host are created lazily and so an invalid pte there is the same as a valid mapping for the purposes of ownership information. This state will be used for permission checking during page transitions in later patches. Reviewed-by: Andrew Walbran <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Quentin Perret <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a83e219 commit 3d467f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/kvm/hyp/include/nvhe/mem_protect.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ enum pkvm_page_state {
2424
PKVM_PAGE_OWNED = 0ULL,
2525
PKVM_PAGE_SHARED_OWNED = KVM_PGTABLE_PROT_SW0,
2626
PKVM_PAGE_SHARED_BORROWED = KVM_PGTABLE_PROT_SW1,
27+
__PKVM_PAGE_RESERVED = KVM_PGTABLE_PROT_SW0 |
28+
KVM_PGTABLE_PROT_SW1,
29+
30+
/* Meta-states which aren't encoded directly in the PTE's SW bits */
31+
PKVM_NOPAGE,
2732
};
2833

2934
#define PKVM_PAGE_STATE_PROT_MASK (KVM_PGTABLE_PROT_SW0 | KVM_PGTABLE_PROT_SW1)

0 commit comments

Comments
 (0)