]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: x86: Merge EMULTYPE_RETRY and EMULTYPE_ALLOW_REEXECUTE
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 23 Aug 2018 20:56:49 +0000 (13:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:41:22 +0000 (22:41 +0200)
commit 384bf2218e96f57118270945b1841e4dbbe9e352 upstream.

retry_instruction() and reexecute_instruction() are a package deal,
i.e. there is no scenario where one is allowed and the other is not.
Merge their controlling emulation type flags to enforce this in code.
Name the combined flag EMULTYPE_ALLOW_RETRY to make it abundantly
clear that we are allowing re{try,execute} to occur, as opposed to
explicitly requesting retry of a previously failed instruction.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c
arch/x86/kvm/x86.c

index b701dd2a62405b02a56750f7c22471dd8a15a77b..0722b77453828a4f37b7ae8128cee87daf1222a6 100644 (file)
@@ -1198,10 +1198,9 @@ enum emulation_result {
 #define EMULTYPE_NO_DECODE         (1 << 0)
 #define EMULTYPE_TRAP_UD           (1 << 1)
 #define EMULTYPE_SKIP              (1 << 2)
-#define EMULTYPE_RETRY             (1 << 3)
-#define EMULTYPE_ALLOW_REEXECUTE    (1 << 4)
-#define EMULTYPE_NO_UD_ON_FAIL     (1 << 5)
-#define EMULTYPE_VMWARE                    (1 << 6)
+#define EMULTYPE_ALLOW_RETRY       (1 << 3)
+#define EMULTYPE_NO_UD_ON_FAIL     (1 << 4)
+#define EMULTYPE_VMWARE                    (1 << 5)
 int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
                            int emulation_type, void *insn, int insn_len);
 
index aef3b98805695ea6bb4662a9ac38fd4908bace05..342c1b6ed7359c7bcb71043fc13094cbe975d0b5 100644 (file)
@@ -4960,7 +4960,7 @@ static int make_mmu_pages_available(struct kvm_vcpu *vcpu)
 int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u64 error_code,
                       void *insn, int insn_len)
 {
-       int r, emulation_type = EMULTYPE_RETRY | EMULTYPE_ALLOW_REEXECUTE;
+       int r, emulation_type = EMULTYPE_ALLOW_RETRY;
        enum emulation_result er;
        bool direct = vcpu->arch.mmu.direct_map;
 
index 58cf20d82cbcc85fea67aafb677cc8b9d743339f..deaa6f4234fd1c40982c1d4ec25d70aa936b42ba 100644 (file)
@@ -5810,7 +5810,7 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2,
        gpa_t gpa = cr2;
        kvm_pfn_t pfn;
 
-       if (!(emulation_type & EMULTYPE_ALLOW_REEXECUTE))
+       if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
                return false;
 
        if (!vcpu->arch.mmu.direct_map) {
@@ -5898,7 +5898,7 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt,
         */
        vcpu->arch.last_retry_eip = vcpu->arch.last_retry_addr = 0;
 
-       if (!(emulation_type & EMULTYPE_RETRY))
+       if (!(emulation_type & EMULTYPE_ALLOW_RETRY))
                return false;
 
        if (x86_page_table_writing_insn(ctxt))