aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2018-08-23 13:56:49 -0700
committerRadim Krčmář <rkrcmar@redhat.com>2018-08-30 16:20:43 +0200
commit384bf2218e96f57118270945b1841e4dbbe9e352 (patch)
tree94db901f36dd066f2db6567f07154d17a86c8616 /arch/x86/kvm
parentKVM: x86: Invert emulation re-execute behavior to make it opt-in (diff)
downloadwireguard-linux-384bf2218e96f57118270945b1841e4dbbe9e352.tar.xz
wireguard-linux-384bf2218e96f57118270945b1841e4dbbe9e352.zip
KVM: x86: Merge EMULTYPE_RETRY and EMULTYPE_ALLOW_REEXECUTE
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>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--arch/x86/kvm/x86.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 4508c34eef20..0246a1ea7f55 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5217,7 +5217,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;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d6f85ea23101..924ce28723c4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5870,7 +5870,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) {
@@ -5958,7 +5958,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))