aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-04-20 06:37:53 -0400
committerAvi Kivity <avi@redhat.com>2011-05-11 07:57:11 -0400
commitca1d4a9e772bde0a0b8cda61ee9fdca29f80f361 (patch)
treeac64707383caef498f295a3c8fb306af70288c2a /arch/x86/kvm/x86.c
parent0f65dd70a442ff498da10cec0a599fbd9d2d6f9e (diff)
KVM: x86 emulator: drop vcpu argument from pio callbacks
Making the emulator caller agnostic. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 274652ae6d5..e9040a9b25c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4060,9 +4060,12 @@ static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)
4060} 4060}
4061 4061
4062 4062
4063static int emulator_pio_in_emulated(int size, unsigned short port, void *val, 4063static int emulator_pio_in_emulated(struct x86_emulate_ctxt *ctxt,
4064 unsigned int count, struct kvm_vcpu *vcpu) 4064 int size, unsigned short port, void *val,
4065 unsigned int count)
4065{ 4066{
4067 struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
4068
4066 if (vcpu->arch.pio.count) 4069 if (vcpu->arch.pio.count)
4067 goto data_avail; 4070 goto data_avail;
4068 4071
@@ -4090,10 +4093,12 @@ static int emulator_pio_in_emulated(int size, unsigned short port, void *val,
4090 return 0; 4093 return 0;
4091} 4094}
4092 4095
4093static int emulator_pio_out_emulated(int size, unsigned short port, 4096static int emulator_pio_out_emulated(struct x86_emulate_ctxt *ctxt,
4094 const void *val, unsigned int count, 4097 int size, unsigned short port,
4095 struct kvm_vcpu *vcpu) 4098 const void *val, unsigned int count)
4096{ 4099{
4100 struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
4101
4097 trace_kvm_pio(1, port, size, count); 4102 trace_kvm_pio(1, port, size, count);
4098 4103
4099 vcpu->arch.pio.port = port; 4104 vcpu->arch.pio.port = port;
@@ -4614,7 +4619,8 @@ EXPORT_SYMBOL_GPL(x86_emulate_instruction);
4614int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port) 4619int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size, unsigned short port)
4615{ 4620{
4616 unsigned long val = kvm_register_read(vcpu, VCPU_REGS_RAX); 4621 unsigned long val = kvm_register_read(vcpu, VCPU_REGS_RAX);
4617 int ret = emulator_pio_out_emulated(size, port, &val, 1, vcpu); 4622 int ret = emulator_pio_out_emulated(&vcpu->arch.emulate_ctxt,
4623 size, port, &val, 1);
4618 /* do not return to emulator after return from userspace */ 4624 /* do not return to emulator after return from userspace */
4619 vcpu->arch.pio.count = 0; 4625 vcpu->arch.pio.count = 0;
4620 return ret; 4626 return ret;