summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2018-03-08 08:57:26 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-16 22:01:38 +0100
commit432baf60eee3dcacac94b8781464ab566abf0183 (patch)
tree83baadab98c52c7fd5026a9619b8983b755e32c5 /arch/x86/kvm/vmx.c
parent2bb8cafea80bf69c0e729bf1ad1bcd1d6c53248d (diff)
downloadlinux-0-day-432baf60eee3dcacac94b8781464ab566abf0183.tar.gz
linux-0-day-432baf60eee3dcacac94b8781464ab566abf0183.tar.xz
KVM: VMX: use kvm_fast_pio_in for handling IN I/O
Fast emulation of processor I/O for IN was disabled on x86 (both VMX and SVM) some years ago due to a buggy implementation. The addition of kvm_fast_pio_in(), used by SVM, re-introduced (functional!) fast emulation of IN. Piggyback SVM's work and use kvm_fast_pio_in() on VMX instead of performing full emulation of IN. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 5d67a15b51160..8d31e1b7cdd05 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6270,15 +6270,15 @@ static int handle_io(struct kvm_vcpu *vcpu)
exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
string = (exit_qualification & 16) != 0;
- in = (exit_qualification & 8) != 0;
++vcpu->stat.io_exits;
- if (string || in)
+ if (string)
return emulate_instruction(vcpu, 0) == EMULATE_DONE;
port = exit_qualification >> 16;
size = (exit_qualification & 7) + 1;
+ in = (exit_qualification & 8) != 0;
ret = kvm_skip_emulated_instruction(vcpu);
@@ -6286,7 +6286,10 @@ static int handle_io(struct kvm_vcpu *vcpu)
* TODO: we might be squashing a KVM_GUESTDBG_SINGLESTEP-triggered
* KVM_EXIT_DEBUG here.
*/
- return kvm_fast_pio_out(vcpu, size, port) && ret;
+ if (in)
+ return kvm_fast_pio_in(vcpu, size, port) && ret;
+ else
+ return kvm_fast_pio_out(vcpu, size, port) && ret;
}
static void