diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-07 20:50:48 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:52:50 -0500 |
commit | 76fafa5e22bd82e92d2734852ba23f17322d675a (patch) | |
tree | f7b81035e86b5b26cbb2d2d13958c805f4990589 /drivers/kvm/kvm_main.c | |
parent | d589444e924bc72e42fa94853f9096589d69374d (diff) |
KVM: Hoist kvm_create_lapic() into kvm_vcpu_init()
Move kvm_create_lapic() into kvm_vcpu_init(), rather than having svm
and vmx do it. And make it return the error rather than a fairly
random -ENOMEM.
This also solves the problem that neither svm.c nor vmx.c actually
handles the error path properly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index b19734606cd9..9ea9277014aa 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -255,14 +255,22 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) | |||
255 | if (r < 0) | 255 | if (r < 0) |
256 | goto fail_free_pio_data; | 256 | goto fail_free_pio_data; |
257 | 257 | ||
258 | if (irqchip_in_kernel(kvm)) { | ||
259 | r = kvm_create_lapic(vcpu); | ||
260 | if (r < 0) | ||
261 | goto fail_mmu_destroy; | ||
262 | } | ||
263 | |||
258 | return 0; | 264 | return 0; |
259 | 265 | ||
266 | fail_mmu_destroy: | ||
267 | kvm_mmu_destroy(vcpu); | ||
260 | fail_free_pio_data: | 268 | fail_free_pio_data: |
261 | free_page((unsigned long)vcpu->pio_data); | 269 | free_page((unsigned long)vcpu->pio_data); |
262 | fail_free_run: | 270 | fail_free_run: |
263 | free_page((unsigned long)vcpu->run); | 271 | free_page((unsigned long)vcpu->run); |
264 | fail: | 272 | fail: |
265 | return -ENOMEM; | 273 | return r; |
266 | } | 274 | } |
267 | EXPORT_SYMBOL_GPL(kvm_vcpu_init); | 275 | EXPORT_SYMBOL_GPL(kvm_vcpu_init); |
268 | 276 | ||