diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2010-11-09 11:02:49 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:09 -0500 |
commit | d89f5eff70a31237ffa1e21c51d23ca532110aea (patch) | |
tree | 13b47648a564d8382e08d7e5937ea30ff0fb838c /include/linux/kvm_host.h | |
parent | 9d893c6bc177b6ac5a1e937f4fdc359d272d68ff (diff) |
KVM: Clean up vm creation and release
IA64 support forces us to abstract the allocation of the kvm structure.
But instead of mixing this up with arch-specific initialization and
doing the same on destruction, split both steps. This allows to move
generic destruction calls into generic code.
It also fixes error clean-up on failures of kvm_create_vm for IA64.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index bcf71c7730f0..2d63f2c0137c 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/preempt.h> | 17 | #include <linux/preempt.h> |
18 | #include <linux/msi.h> | 18 | #include <linux/msi.h> |
19 | #include <linux/slab.h> | ||
19 | #include <asm/signal.h> | 20 | #include <asm/signal.h> |
20 | 21 | ||
21 | #include <linux/kvm.h> | 22 | #include <linux/kvm.h> |
@@ -441,7 +442,19 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); | |||
441 | 442 | ||
442 | void kvm_free_physmem(struct kvm *kvm); | 443 | void kvm_free_physmem(struct kvm *kvm); |
443 | 444 | ||
444 | struct kvm *kvm_arch_create_vm(void); | 445 | #ifndef __KVM_HAVE_ARCH_VM_ALLOC |
446 | static inline struct kvm *kvm_arch_alloc_vm(void) | ||
447 | { | ||
448 | return kzalloc(sizeof(struct kvm), GFP_KERNEL); | ||
449 | } | ||
450 | |||
451 | static inline void kvm_arch_free_vm(struct kvm *kvm) | ||
452 | { | ||
453 | kfree(kvm); | ||
454 | } | ||
455 | #endif | ||
456 | |||
457 | int kvm_arch_init_vm(struct kvm *kvm); | ||
445 | void kvm_arch_destroy_vm(struct kvm *kvm); | 458 | void kvm_arch_destroy_vm(struct kvm *kvm); |
446 | void kvm_free_all_assigned_devices(struct kvm *kvm); | 459 | void kvm_free_all_assigned_devices(struct kvm *kvm); |
447 | void kvm_arch_sync_events(struct kvm *kvm); | 460 | void kvm_arch_sync_events(struct kvm *kvm); |