aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-10-21 05:00:39 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:55 -0500
commite00c8cf29b9798eb9918469b0cce1766e0ae40d7 (patch)
tree2824cf4bfffc96faeda6981a790295c2e4f49690 /drivers/kvm/kvm_main.c
parent34c16eecf78ed4cf01f39ac7211f5b57942ec899 (diff)
KVM: Move vmx_vcpu_reset() out of vmx_vcpu_setup()
Split guest reset code out of vmx_vcpu_setup(). Besides being cleaner, this moves the realmode tss setup (which can sleep) outside vmx_vcpu_setup() (which is executed with preemption enabled). [izik: remove unused variable] Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0b23657f434c..a6e3165043d1 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2122,7 +2122,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
2122 pr_debug("vcpu %d received sipi with vector # %x\n", 2122 pr_debug("vcpu %d received sipi with vector # %x\n",
2123 vcpu->vcpu_id, vcpu->sipi_vector); 2123 vcpu->vcpu_id, vcpu->sipi_vector);
2124 kvm_lapic_reset(vcpu); 2124 kvm_lapic_reset(vcpu);
2125 kvm_x86_ops->vcpu_reset(vcpu); 2125 r = kvm_x86_ops->vcpu_reset(vcpu);
2126 if (r)
2127 return r;
2126 vcpu->mp_state = VCPU_MP_STATE_RUNNABLE; 2128 vcpu->mp_state = VCPU_MP_STATE_RUNNABLE;
2127 } 2129 }
2128 2130
@@ -2637,7 +2639,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
2637 BUG_ON((unsigned long)&vcpu->host_fx_image & 0xF); 2639 BUG_ON((unsigned long)&vcpu->host_fx_image & 0xF);
2638 2640
2639 vcpu_load(vcpu); 2641 vcpu_load(vcpu);
2640 r = kvm_mmu_setup(vcpu); 2642 r = kvm_x86_ops->vcpu_reset(vcpu);
2643 if (r == 0)
2644 r = kvm_mmu_setup(vcpu);
2641 vcpu_put(vcpu); 2645 vcpu_put(vcpu);
2642 if (r < 0) 2646 if (r < 0)
2643 goto free_vcpu; 2647 goto free_vcpu;