Skip to content

Commit 9b62e03

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86: Define more SEV+ page fault error bits/flags for #NPF
Define more #NPF error code flags that are relevant to SEV+ (mostly SNP) guests, as specified by the APM: * Bit 31 (RMP): Set to 1 if the fault was caused due to an RMP check or a VMPL check failure, 0 otherwise. * Bit 34 (ENC): Set to 1 if the guest’s effective C-bit was 1, 0 otherwise. * Bit 35 (SIZEM): Set to 1 if the fault was caused by a size mismatch between PVALIDATE or RMPADJUST and the RMP, 0 otherwise. * Bit 36 (VMPL): Set to 1 if the fault was caused by a VMPL permission check failure, 0 otherwise. Note, the APM is *extremely* misleading, and strongly implies that the above flags can _only_ be set for #NPF exits from SNP guests. That is a lie, as bit 34 (C-bit=1, i.e. was encrypted) can be set when running _any_ flavor of SEV guest on SNP capable hardware. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-ID: <20240228024147.41573-4-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 63b6206 commit 9b62e03

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/x86/include/asm/kvm_host.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ enum x86_intercept_stage;
261261
#define PFERR_FETCH_MASK BIT(4)
262262
#define PFERR_PK_MASK BIT(5)
263263
#define PFERR_SGX_MASK BIT(15)
264+
#define PFERR_GUEST_RMP_MASK BIT_ULL(31)
264265
#define PFERR_GUEST_FINAL_MASK BIT_ULL(32)
265266
#define PFERR_GUEST_PAGE_MASK BIT_ULL(33)
267+
#define PFERR_GUEST_ENC_MASK BIT_ULL(34)
268+
#define PFERR_GUEST_SIZEM_MASK BIT_ULL(35)
269+
#define PFERR_GUEST_VMPL_MASK BIT_ULL(36)
266270
#define PFERR_IMPLICIT_ACCESS BIT_ULL(48)
267271

268272
#define PFERR_NESTED_GUEST_PAGE (PFERR_GUEST_PAGE_MASK | \

0 commit comments

Comments
 (0)