]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: VMX: replace 0x180 with EPT_VIOLATION_* definition
authorSU Hang <darcy.sh@antgroup.com>
Tue, 29 Mar 2022 03:01:06 +0000 (11:01 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Apr 2022 17:37:19 +0000 (13:37 -0400)
Using self-expressing macro definition EPT_VIOLATION_GVA_VALIDATION
and EPT_VIOLATION_GVA_TRANSLATED instead of 0x180
in FNAME(walk_addr_generic)().

Signed-off-by: SU Hang <darcy.sh@antgroup.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220329030108.97341-2-darcy.sh@antgroup.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/vmx.h
arch/x86/kvm/mmu/paging_tmpl.h

index 0ffaa3156a4e4148f60a5ef5c005d043ff68378a..3586d4aeaac7dbbc7df9072e5afa710513578880 100644 (file)
@@ -546,6 +546,7 @@ enum vm_entry_failure_code {
 #define EPT_VIOLATION_READABLE_BIT     3
 #define EPT_VIOLATION_WRITABLE_BIT     4
 #define EPT_VIOLATION_EXECUTABLE_BIT   5
+#define EPT_VIOLATION_GVA_IS_VALID_BIT 7
 #define EPT_VIOLATION_GVA_TRANSLATED_BIT 8
 #define EPT_VIOLATION_ACC_READ         (1 << EPT_VIOLATION_ACC_READ_BIT)
 #define EPT_VIOLATION_ACC_WRITE                (1 << EPT_VIOLATION_ACC_WRITE_BIT)
@@ -553,6 +554,7 @@ enum vm_entry_failure_code {
 #define EPT_VIOLATION_READABLE         (1 << EPT_VIOLATION_READABLE_BIT)
 #define EPT_VIOLATION_WRITABLE         (1 << EPT_VIOLATION_WRITABLE_BIT)
 #define EPT_VIOLATION_EXECUTABLE       (1 << EPT_VIOLATION_EXECUTABLE_BIT)
+#define EPT_VIOLATION_GVA_IS_VALID     (1 << EPT_VIOLATION_GVA_IS_VALID_BIT)
 #define EPT_VIOLATION_GVA_TRANSLATED   (1 << EPT_VIOLATION_GVA_TRANSLATED_BIT)
 
 /*
index 01fee5f67ac370691e17178f049e45ec0befd516..9c6bdab9f29bd329d6da717f76011fe36551c570 100644 (file)
@@ -515,7 +515,8 @@ error:
         * The other bits are set to 0.
         */
        if (!(errcode & PFERR_RSVD_MASK)) {
-               vcpu->arch.exit_qualification &= 0x180;
+               vcpu->arch.exit_qualification &= (EPT_VIOLATION_GVA_IS_VALID |
+                                                 EPT_VIOLATION_GVA_TRANSLATED);
                if (write_fault)
                        vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_WRITE;
                if (user_fault)