On Thu, Mar 8, 2018 at 8:57 AM Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote: > > 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@xxxxxxxxxx> > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> This commit changes the userspace API in a significant way. Before this commit, when kvm exited to userspace with exit_reason KVM_EXIT_IO and io.direction KVM_EXIT_IO_IN, the guest %rip pointed to the 'in' instruction. Now, the guest %rip will be advanced to the next instruction before the exit to userspace. This seems like a bug, but I'm not entirely sure, because (1) the details of this API aren't documented anywhere, and (2) the behavior for 'in' now matches the behavior for 'out' (but 'ins' and 'outs' still retain the original 'in' behavior). Moreover, Paolo has checked in a self-test that depends on the new behavior. So, maybe I'm wrong in thinking that the guest %rip should point to the I/O instruction when kvm exits to userspace with exit_reason KVM_EXIT_IO?