kvm-s390.c (e08b96371625aaa84cb03f51acc4c8e0be27403a) kvm-s390.c (27e0393f15fc8bc855c6a888387ff5ffd2181089)
1/*
2 * s390host.c -- hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008,2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 219 unchanged lines hidden (view full) ---

228void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
229{
230 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
231 clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn);
232 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
233 (__u64) vcpu->arch.sie_block)
234 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
235 smp_mb();
1/*
2 * s390host.c -- hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008,2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 219 unchanged lines hidden (view full) ---

228void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
229{
230 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
231 clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn);
232 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
233 (__u64) vcpu->arch.sie_block)
234 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
235 smp_mb();
236
237 if (kvm_is_ucontrol(vcpu->kvm))
238 gmap_free(vcpu->arch.gmap);
239
236 free_page((unsigned long)(vcpu->arch.sie_block));
237 kvm_vcpu_uninit(vcpu);
238 kfree(vcpu);
239}
240
241static void kvm_free_vcpus(struct kvm *kvm)
242{
243 unsigned int i;

--- 14 unchanged lines hidden (view full) ---

258{
259}
260
261void kvm_arch_destroy_vm(struct kvm *kvm)
262{
263 kvm_free_vcpus(kvm);
264 free_page((unsigned long)(kvm->arch.sca));
265 debug_unregister(kvm->arch.dbf);
240 free_page((unsigned long)(vcpu->arch.sie_block));
241 kvm_vcpu_uninit(vcpu);
242 kfree(vcpu);
243}
244
245static void kvm_free_vcpus(struct kvm *kvm)
246{
247 unsigned int i;

--- 14 unchanged lines hidden (view full) ---

262{
263}
264
265void kvm_arch_destroy_vm(struct kvm *kvm)
266{
267 kvm_free_vcpus(kvm);
268 free_page((unsigned long)(kvm->arch.sca));
269 debug_unregister(kvm->arch.dbf);
266 gmap_free(kvm->arch.gmap);
270 if (!kvm_is_ucontrol(kvm))
271 gmap_free(kvm->arch.gmap);
267}
268
269/* Section: vcpu related */
270int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
271{
272}
273
274/* Section: vcpu related */
275int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
276{
277 if (kvm_is_ucontrol(vcpu->kvm)) {
278 vcpu->arch.gmap = gmap_alloc(current->mm);
279 if (!vcpu->arch.gmap)
280 return -ENOMEM;
281 return 0;
282 }
283
272 vcpu->arch.gmap = vcpu->kvm->arch.gmap;
273 return 0;
274}
275
276void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
277{
278 /* Nothing todo */
279}

--- 402 unchanged lines hidden (view full) ---

682 if (copy_from_user(&psw, argp, sizeof(psw)))
683 break;
684 r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
685 break;
686 }
687 case KVM_S390_INITIAL_RESET:
688 r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
689 break;
284 vcpu->arch.gmap = vcpu->kvm->arch.gmap;
285 return 0;
286}
287
288void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
289{
290 /* Nothing todo */
291}

--- 402 unchanged lines hidden (view full) ---

694 if (copy_from_user(&psw, argp, sizeof(psw)))
695 break;
696 r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
697 break;
698 }
699 case KVM_S390_INITIAL_RESET:
700 r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
701 break;
702#ifdef CONFIG_KVM_S390_UCONTROL
703 case KVM_S390_UCAS_MAP: {
704 struct kvm_s390_ucas_mapping ucasmap;
705
706 if (copy_from_user(&ucasmap, argp, sizeof(ucasmap))) {
707 r = -EFAULT;
708 break;
709 }
710
711 if (!kvm_is_ucontrol(vcpu->kvm)) {
712 r = -EINVAL;
713 break;
714 }
715
716 r = gmap_map_segment(vcpu->arch.gmap, ucasmap.user_addr,
717 ucasmap.vcpu_addr, ucasmap.length);
718 break;
719 }
720 case KVM_S390_UCAS_UNMAP: {
721 struct kvm_s390_ucas_mapping ucasmap;
722
723 if (copy_from_user(&ucasmap, argp, sizeof(ucasmap))) {
724 r = -EFAULT;
725 break;
726 }
727
728 if (!kvm_is_ucontrol(vcpu->kvm)) {
729 r = -EINVAL;
730 break;
731 }
732
733 r = gmap_unmap_segment(vcpu->arch.gmap, ucasmap.vcpu_addr,
734 ucasmap.length);
735 break;
736 }
737#endif
690 default:
691 r = -EINVAL;
692 }
693 return r;
694}
695
696/* Section: memory related */
697int kvm_arch_prepare_memory_region(struct kvm *kvm,

--- 80 unchanged lines hidden ---
738 default:
739 r = -EINVAL;
740 }
741 return r;
742}
743
744/* Section: memory related */
745int kvm_arch_prepare_memory_region(struct kvm *kvm,

--- 80 unchanged lines hidden ---