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 /arch/powerpc/kvm/powerpc.c | |
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 'arch/powerpc/kvm/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 38f756f25053..99758460efde 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -145,18 +145,12 @@ void kvm_arch_check_processor_compat(void *rtn) | |||
145 | *(int *)rtn = kvmppc_core_check_processor_compat(); | 145 | *(int *)rtn = kvmppc_core_check_processor_compat(); |
146 | } | 146 | } |
147 | 147 | ||
148 | struct kvm *kvm_arch_create_vm(void) | 148 | int kvm_arch_init_vm(struct kvm *kvm) |
149 | { | 149 | { |
150 | struct kvm *kvm; | 150 | return 0; |
151 | |||
152 | kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL); | ||
153 | if (!kvm) | ||
154 | return ERR_PTR(-ENOMEM); | ||
155 | |||
156 | return kvm; | ||
157 | } | 151 | } |
158 | 152 | ||
159 | static void kvmppc_free_vcpus(struct kvm *kvm) | 153 | void kvm_arch_destroy_vm(struct kvm *kvm) |
160 | { | 154 | { |
161 | unsigned int i; | 155 | unsigned int i; |
162 | struct kvm_vcpu *vcpu; | 156 | struct kvm_vcpu *vcpu; |
@@ -176,14 +170,6 @@ void kvm_arch_sync_events(struct kvm *kvm) | |||
176 | { | 170 | { |
177 | } | 171 | } |
178 | 172 | ||
179 | void kvm_arch_destroy_vm(struct kvm *kvm) | ||
180 | { | ||
181 | kvmppc_free_vcpus(kvm); | ||
182 | kvm_free_physmem(kvm); | ||
183 | cleanup_srcu_struct(&kvm->srcu); | ||
184 | kfree(kvm); | ||
185 | } | ||
186 | |||
187 | int kvm_dev_ioctl_check_extension(long ext) | 173 | int kvm_dev_ioctl_check_extension(long ext) |
188 | { | 174 | { |
189 | int r; | 175 | int r; |