aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-04-28 12:15:34 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:35:33 -0400
commit411c35b7ef02aefb91e166ffeffad0891d955fcb (patch)
tree809e400adecde2ad22bbb5ad899e4efa7a46c8a4 /arch/x86/kvm/x86.c
parente680080e653b8c8725ca620bf22a5f8480f40cb5 (diff)
KVM: fill in run->mmio details in (read|write)_emulated function
Fill in run->mmio details in (read|write)_emulated function just like pio does. There is no point in filling only vcpu fields there just to copy them into vcpu->run a little bit later. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 44a546b136fc..b976c4c1fa8f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3386,9 +3386,10 @@ mmio:
3386 trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0); 3386 trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0);
3387 3387
3388 vcpu->mmio_needed = 1; 3388 vcpu->mmio_needed = 1;
3389 vcpu->mmio_phys_addr = gpa; 3389 vcpu->run->exit_reason = KVM_EXIT_MMIO;
3390 vcpu->mmio_size = bytes; 3390 vcpu->run->mmio.phys_addr = vcpu->mmio_phys_addr = gpa;
3391 vcpu->mmio_is_write = 0; 3391 vcpu->run->mmio.len = vcpu->mmio_size = bytes;
3392 vcpu->run->mmio.is_write = vcpu->mmio_is_write = 0;
3392 3393
3393 return X86EMUL_UNHANDLEABLE; 3394 return X86EMUL_UNHANDLEABLE;
3394} 3395}
@@ -3436,10 +3437,11 @@ mmio:
3436 return X86EMUL_CONTINUE; 3437 return X86EMUL_CONTINUE;
3437 3438
3438 vcpu->mmio_needed = 1; 3439 vcpu->mmio_needed = 1;
3439 vcpu->mmio_phys_addr = gpa; 3440 vcpu->run->exit_reason = KVM_EXIT_MMIO;
3440 vcpu->mmio_size = bytes; 3441 vcpu->run->mmio.phys_addr = vcpu->mmio_phys_addr = gpa;
3441 vcpu->mmio_is_write = 1; 3442 vcpu->run->mmio.len = vcpu->mmio_size = bytes;
3442 memcpy(vcpu->mmio_data, val, bytes); 3443 vcpu->run->mmio.is_write = vcpu->mmio_is_write = 1;
3444 memcpy(vcpu->run->mmio.data, val, bytes);
3443 3445
3444 return X86EMUL_CONTINUE; 3446 return X86EMUL_CONTINUE;
3445} 3447}
@@ -3850,7 +3852,6 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
3850{ 3852{
3851 int r, shadow_mask; 3853 int r, shadow_mask;
3852 struct decode_cache *c; 3854 struct decode_cache *c;
3853 struct kvm_run *run = vcpu->run;
3854 3855
3855 kvm_clear_exception_queue(vcpu); 3856 kvm_clear_exception_queue(vcpu);
3856 vcpu->arch.mmio_fault_cr2 = cr2; 3857 vcpu->arch.mmio_fault_cr2 = cr2;
@@ -3937,14 +3938,6 @@ restart:
3937 return EMULATE_DO_MMIO; 3938 return EMULATE_DO_MMIO;
3938 } 3939 }
3939 3940
3940 if (r || vcpu->mmio_is_write) {
3941 run->exit_reason = KVM_EXIT_MMIO;
3942 run->mmio.phys_addr = vcpu->mmio_phys_addr;
3943 memcpy(run->mmio.data, vcpu->mmio_data, 8);
3944 run->mmio.len = vcpu->mmio_size;
3945 run->mmio.is_write = vcpu->mmio_is_write;
3946 }
3947
3948 if (r) { 3941 if (r) {
3949 if (kvm_mmu_unprotect_page_virt(vcpu, cr2)) 3942 if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
3950 goto done; 3943 goto done;