diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 985d825494f1..bade533ba288 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -164,24 +164,18 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
164 | return r; | 164 | return r; |
165 | } | 165 | } |
166 | 166 | ||
167 | struct kvm *kvm_arch_create_vm(void) | 167 | int kvm_arch_init_vm(struct kvm *kvm) |
168 | { | 168 | { |
169 | struct kvm *kvm; | ||
170 | int rc; | 169 | int rc; |
171 | char debug_name[16]; | 170 | char debug_name[16]; |
172 | 171 | ||
173 | rc = s390_enable_sie(); | 172 | rc = s390_enable_sie(); |
174 | if (rc) | 173 | if (rc) |
175 | goto out_nokvm; | 174 | goto out_err; |
176 | |||
177 | rc = -ENOMEM; | ||
178 | kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL); | ||
179 | if (!kvm) | ||
180 | goto out_nokvm; | ||
181 | 175 | ||
182 | kvm->arch.sca = (struct sca_block *) get_zeroed_page(GFP_KERNEL); | 176 | kvm->arch.sca = (struct sca_block *) get_zeroed_page(GFP_KERNEL); |
183 | if (!kvm->arch.sca) | 177 | if (!kvm->arch.sca) |
184 | goto out_nosca; | 178 | goto out_err; |
185 | 179 | ||
186 | sprintf(debug_name, "kvm-%u", current->pid); | 180 | sprintf(debug_name, "kvm-%u", current->pid); |
187 | 181 | ||
@@ -195,13 +189,11 @@ struct kvm *kvm_arch_create_vm(void) | |||
195 | debug_register_view(kvm->arch.dbf, &debug_sprintf_view); | 189 | debug_register_view(kvm->arch.dbf, &debug_sprintf_view); |
196 | VM_EVENT(kvm, 3, "%s", "vm created"); | 190 | VM_EVENT(kvm, 3, "%s", "vm created"); |
197 | 191 | ||
198 | return kvm; | 192 | return 0; |
199 | out_nodbf: | 193 | out_nodbf: |
200 | free_page((unsigned long)(kvm->arch.sca)); | 194 | free_page((unsigned long)(kvm->arch.sca)); |
201 | out_nosca: | 195 | out_err: |
202 | kfree(kvm); | 196 | return rc; |
203 | out_nokvm: | ||
204 | return ERR_PTR(rc); | ||
205 | } | 197 | } |
206 | 198 | ||
207 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | 199 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
@@ -240,11 +232,8 @@ void kvm_arch_sync_events(struct kvm *kvm) | |||
240 | void kvm_arch_destroy_vm(struct kvm *kvm) | 232 | void kvm_arch_destroy_vm(struct kvm *kvm) |
241 | { | 233 | { |
242 | kvm_free_vcpus(kvm); | 234 | kvm_free_vcpus(kvm); |
243 | kvm_free_physmem(kvm); | ||
244 | free_page((unsigned long)(kvm->arch.sca)); | 235 | free_page((unsigned long)(kvm->arch.sca)); |
245 | debug_unregister(kvm->arch.dbf); | 236 | debug_unregister(kvm->arch.dbf); |
246 | cleanup_srcu_struct(&kvm->srcu); | ||
247 | kfree(kvm); | ||
248 | } | 237 | } |
249 | 238 | ||
250 | /* Section: vcpu related */ | 239 | /* Section: vcpu related */ |