KVM: Do not communicate to userspace through cpu registers during PIO
Currently when passing the a PIO emulation request to userspace, we rely on userspace updating %rax (on 'in' instructions) and %rsi/%rdi/%rcx (on string instructions). This (a) requires two extra ioctls for getting and setting the registers and (b) is unfriendly to non-x86 archs, when they get kvm ports. So fix by doing the register fixups in the kernel and passing to userspace only an abstract description of the PIO to be done. Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
@@ -1037,6 +1037,7 @@ static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||
kvm_run->io.size = ((io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT);
|
||||
kvm_run->io.string = (io_info & SVM_IOIO_STR_MASK) != 0;
|
||||
kvm_run->io.rep = (io_info & SVM_IOIO_REP_MASK) != 0;
|
||||
kvm_run->io.count = 1;
|
||||
|
||||
if (kvm_run->io.string) {
|
||||
unsigned addr_mask;
|
||||
@@ -1056,6 +1057,7 @@ static int io_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||
}
|
||||
} else
|
||||
kvm_run->io.value = vcpu->svm->vmcb->save.rax;
|
||||
vcpu->pio_pending = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user