]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/kvm/vmx.c
KVM: Handle cpuid in the kernel instead of punting to userspace
[linux-2.6-omap-h63xx.git] / drivers / kvm / vmx.c
index fbbf9d6b299fa16bed8f89a677dc393bc1c55ee1..71410a65bb90bd6974ea05bca3a3c868989a8a85 100644 (file)
@@ -1459,12 +1459,14 @@ static int handle_io(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                = (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_DF) != 0;
        kvm_run->io.rep = (exit_qualification & 32) != 0;
        kvm_run->io.port = exit_qualification >> 16;
+       kvm_run->io.count = 1;
        if (kvm_run->io.string) {
                if (!get_io_count(vcpu, &kvm_run->io.count))
                        return 1;
                kvm_run->io.address = vmcs_readl(GUEST_LINEAR_ADDRESS);
        } else
                kvm_run->io.value = vcpu->regs[VCPU_REGS_RAX]; /* rax */
+       vcpu->pio_pending = 1;
        return 0;
 }
 
@@ -1583,8 +1585,8 @@ static int handle_dr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 
 static int handle_cpuid(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 {
-       kvm_run->exit_reason = KVM_EXIT_CPUID;
-       return 0;
+       kvm_emulate_cpuid(vcpu);
+       return 1;
 }
 
 static int handle_rdmsr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
@@ -1658,7 +1660,7 @@ static int handle_halt(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 
 static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
 {
-       vmcs_writel(GUEST_RIP, vmcs_readl(GUEST_RIP)+3);
+       skip_emulated_instruction(vcpu);
        return kvm_hypercall(vcpu, kvm_run);
 }