diff options
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/kvm_main.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index f267dbb52845..c8b8cfa332bb 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1237,8 +1237,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu, | |||
1237 | kvm_arch_ops->decache_regs(vcpu); | 1237 | kvm_arch_ops->decache_regs(vcpu); |
1238 | kvm_arch_ops->set_rflags(vcpu, emulate_ctxt.eflags); | 1238 | kvm_arch_ops->set_rflags(vcpu, emulate_ctxt.eflags); |
1239 | 1239 | ||
1240 | if (vcpu->mmio_is_write) | 1240 | if (vcpu->mmio_is_write) { |
1241 | vcpu->mmio_needed = 0; | ||
1241 | return EMULATE_DO_MMIO; | 1242 | return EMULATE_DO_MMIO; |
1243 | } | ||
1242 | 1244 | ||
1243 | return EMULATE_DONE; | 1245 | return EMULATE_DONE; |
1244 | } | 1246 | } |
@@ -1692,8 +1694,6 @@ static int complete_pio(struct kvm_vcpu *vcpu) | |||
1692 | vcpu->regs[VCPU_REGS_RSI] += delta; | 1694 | vcpu->regs[VCPU_REGS_RSI] += delta; |
1693 | } | 1695 | } |
1694 | 1696 | ||
1695 | vcpu->run->io_completed = 0; | ||
1696 | |||
1697 | kvm_arch_ops->decache_regs(vcpu); | 1697 | kvm_arch_ops->decache_regs(vcpu); |
1698 | 1698 | ||
1699 | io->count -= io->cur_count; | 1699 | io->count -= io->cur_count; |
@@ -1800,25 +1800,25 @@ static int kvm_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1800 | /* re-sync apic's tpr */ | 1800 | /* re-sync apic's tpr */ |
1801 | vcpu->cr8 = kvm_run->cr8; | 1801 | vcpu->cr8 = kvm_run->cr8; |
1802 | 1802 | ||
1803 | if (kvm_run->io_completed) { | 1803 | if (vcpu->pio.cur_count) { |
1804 | if (vcpu->pio.cur_count) { | 1804 | r = complete_pio(vcpu); |
1805 | r = complete_pio(vcpu); | 1805 | if (r) |
1806 | if (r) | 1806 | goto out; |
1807 | goto out; | 1807 | } |
1808 | } else if (!vcpu->mmio_is_write) { | 1808 | |
1809 | memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); | 1809 | if (vcpu->mmio_needed) { |
1810 | vcpu->mmio_read_completed = 1; | 1810 | memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); |
1811 | vcpu->mmio_needed = 0; | 1811 | vcpu->mmio_read_completed = 1; |
1812 | r = emulate_instruction(vcpu, kvm_run, | 1812 | vcpu->mmio_needed = 0; |
1813 | vcpu->mmio_fault_cr2, 0); | 1813 | r = emulate_instruction(vcpu, kvm_run, |
1814 | if (r == EMULATE_DO_MMIO) { | 1814 | vcpu->mmio_fault_cr2, 0); |
1815 | /* | 1815 | if (r == EMULATE_DO_MMIO) { |
1816 | * Read-modify-write. Back to userspace. | 1816 | /* |
1817 | */ | 1817 | * Read-modify-write. Back to userspace. |
1818 | kvm_run->exit_reason = KVM_EXIT_MMIO; | 1818 | */ |
1819 | r = 0; | 1819 | kvm_run->exit_reason = KVM_EXIT_MMIO; |
1820 | goto out; | 1820 | r = 0; |
1821 | } | 1821 | goto out; |
1822 | } | 1822 | } |
1823 | } | 1823 | } |
1824 | 1824 | ||