aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/kvm-s390.c
diff options
context:
space:
mode:
authorCarsten Otte <cotte@de.ibm.com>2012-01-04 04:25:27 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:20 -0500
commit58f9460ba1cc9de67e6591bfd08dccded43d27bd (patch)
tree7c5fdfd4ac7407f6315a90b5bb015b41e41e8d42 /arch/s390/kvm/kvm-s390.c
parentccc7910fe564d99415def7c041fa261e62a43011 (diff)
KVM: s390: ucontrol: disable sca
This patch makes sure user controlled virtual machines do not use a system control area (sca). This is needed in order to create virtual machines with more cpus than the size of the sca [64]. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r--arch/s390/kvm/kvm-s390.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8489edf80c89..abf784d8c680 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -228,10 +228,13 @@ out_err:
228void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 228void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
229{ 229{
230 VCPU_EVENT(vcpu, 3, "%s", "free cpu"); 230 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
231 clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn); 231 if (!kvm_is_ucontrol(vcpu->kvm)) {
232 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda == 232 clear_bit(63 - vcpu->vcpu_id,
233 (__u64) vcpu->arch.sie_block) 233 (unsigned long *) &vcpu->kvm->arch.sca->mcn);
234 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0; 234 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
235 (__u64) vcpu->arch.sie_block)
236 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
237 }
235 smp_mb(); 238 smp_mb();
236 239
237 if (kvm_is_ucontrol(vcpu->kvm)) 240 if (kvm_is_ucontrol(vcpu->kvm))
@@ -368,12 +371,19 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
368 goto out_free_cpu; 371 goto out_free_cpu;
369 372
370 vcpu->arch.sie_block->icpua = id; 373 vcpu->arch.sie_block->icpua = id;
371 BUG_ON(!kvm->arch.sca); 374 if (!kvm_is_ucontrol(kvm)) {
372 if (!kvm->arch.sca->cpu[id].sda) 375 if (!kvm->arch.sca) {
373 kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block; 376 WARN_ON_ONCE(1);
374 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32); 377 goto out_free_cpu;
375 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca; 378 }
376 set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn); 379 if (!kvm->arch.sca->cpu[id].sda)
380 kvm->arch.sca->cpu[id].sda =
381 (__u64) vcpu->arch.sie_block;
382 vcpu->arch.sie_block->scaoh =
383 (__u32)(((__u64)kvm->arch.sca) >> 32);
384 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
385 set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
386 }
377 387
378 spin_lock_init(&vcpu->arch.local_int.lock); 388 spin_lock_init(&vcpu->arch.local_int.lock);
379 INIT_LIST_HEAD(&vcpu->arch.local_int.list); 389 INIT_LIST_HEAD(&vcpu->arch.local_int.list);