diff options
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 8b00eb2ddf57..be8497186b96 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -113,8 +113,6 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
113 | int kvm_dev_ioctl_check_extension(long ext) | 113 | int kvm_dev_ioctl_check_extension(long ext) |
114 | { | 114 | { |
115 | switch (ext) { | 115 | switch (ext) { |
116 | case KVM_CAP_USER_MEMORY: | ||
117 | return 1; | ||
118 | default: | 116 | default: |
119 | return 0; | 117 | return 0; |
120 | } | 118 | } |
@@ -185,8 +183,6 @@ struct kvm *kvm_arch_create_vm(void) | |||
185 | debug_register_view(kvm->arch.dbf, &debug_sprintf_view); | 183 | debug_register_view(kvm->arch.dbf, &debug_sprintf_view); |
186 | VM_EVENT(kvm, 3, "%s", "vm created"); | 184 | VM_EVENT(kvm, 3, "%s", "vm created"); |
187 | 185 | ||
188 | try_module_get(THIS_MODULE); | ||
189 | |||
190 | return kvm; | 186 | return kvm; |
191 | out_nodbf: | 187 | out_nodbf: |
192 | free_page((unsigned long)(kvm->arch.sca)); | 188 | free_page((unsigned long)(kvm->arch.sca)); |
@@ -196,13 +192,33 @@ out_nokvm: | |||
196 | return ERR_PTR(rc); | 192 | return ERR_PTR(rc); |
197 | } | 193 | } |
198 | 194 | ||
195 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | ||
196 | { | ||
197 | VCPU_EVENT(vcpu, 3, "%s", "free cpu"); | ||
198 | free_page((unsigned long)(vcpu->arch.sie_block)); | ||
199 | kvm_vcpu_uninit(vcpu); | ||
200 | kfree(vcpu); | ||
201 | } | ||
202 | |||
203 | static void kvm_free_vcpus(struct kvm *kvm) | ||
204 | { | ||
205 | unsigned int i; | ||
206 | |||
207 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | ||
208 | if (kvm->vcpus[i]) { | ||
209 | kvm_arch_vcpu_destroy(kvm->vcpus[i]); | ||
210 | kvm->vcpus[i] = NULL; | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
199 | void kvm_arch_destroy_vm(struct kvm *kvm) | 215 | void kvm_arch_destroy_vm(struct kvm *kvm) |
200 | { | 216 | { |
201 | debug_unregister(kvm->arch.dbf); | 217 | kvm_free_vcpus(kvm); |
202 | kvm_free_physmem(kvm); | 218 | kvm_free_physmem(kvm); |
203 | free_page((unsigned long)(kvm->arch.sca)); | 219 | free_page((unsigned long)(kvm->arch.sca)); |
220 | debug_unregister(kvm->arch.dbf); | ||
204 | kfree(kvm); | 221 | kfree(kvm); |
205 | module_put(THIS_MODULE); | ||
206 | } | 222 | } |
207 | 223 | ||
208 | /* Section: vcpu related */ | 224 | /* Section: vcpu related */ |
@@ -213,8 +229,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
213 | 229 | ||
214 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) | 230 | void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) |
215 | { | 231 | { |
216 | /* kvm common code refers to this, but does'nt call it */ | 232 | /* Nothing todo */ |
217 | BUG(); | ||
218 | } | 233 | } |
219 | 234 | ||
220 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 235 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
@@ -308,8 +323,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | |||
308 | VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu, | 323 | VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu, |
309 | vcpu->arch.sie_block); | 324 | vcpu->arch.sie_block); |
310 | 325 | ||
311 | try_module_get(THIS_MODULE); | ||
312 | |||
313 | return vcpu; | 326 | return vcpu; |
314 | out_free_cpu: | 327 | out_free_cpu: |
315 | kfree(vcpu); | 328 | kfree(vcpu); |
@@ -317,14 +330,6 @@ out_nomem: | |||
317 | return ERR_PTR(rc); | 330 | return ERR_PTR(rc); |
318 | } | 331 | } |
319 | 332 | ||
320 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | ||
321 | { | ||
322 | VCPU_EVENT(vcpu, 3, "%s", "destroy cpu"); | ||
323 | free_page((unsigned long)(vcpu->arch.sie_block)); | ||
324 | kfree(vcpu); | ||
325 | module_put(THIS_MODULE); | ||
326 | } | ||
327 | |||
328 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | 333 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) |
329 | { | 334 | { |
330 | /* kvm common code refers to this, but never calls it */ | 335 | /* kvm common code refers to this, but never calls it */ |