Commit 58f9460b authored by Carsten Otte's avatar Carsten Otte Committed by Avi Kivity

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: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent ccc7910f
...@@ -228,10 +228,13 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) ...@@ -228,10 +228,13 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
{ {
VCPU_EVENT(vcpu, 3, "%s", "free cpu"); VCPU_EVENT(vcpu, 3, "%s", "free cpu");
clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn); if (!kvm_is_ucontrol(vcpu->kvm)) {
if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda == clear_bit(63 - vcpu->vcpu_id,
(__u64) vcpu->arch.sie_block) (unsigned long *) &vcpu->kvm->arch.sca->mcn);
vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0; if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
(__u64) vcpu->arch.sie_block)
vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
}
smp_mb(); smp_mb();
if (kvm_is_ucontrol(vcpu->kvm)) if (kvm_is_ucontrol(vcpu->kvm))
...@@ -368,12 +371,19 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, ...@@ -368,12 +371,19 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
goto out_free_cpu; goto out_free_cpu;
vcpu->arch.sie_block->icpua = id; vcpu->arch.sie_block->icpua = id;
BUG_ON(!kvm->arch.sca); if (!kvm_is_ucontrol(kvm)) {
if (!kvm->arch.sca->cpu[id].sda) if (!kvm->arch.sca) {
kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block; WARN_ON_ONCE(1);
vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32); goto out_free_cpu;
vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca; }
set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn); if (!kvm->arch.sca->cpu[id].sda)
kvm->arch.sca->cpu[id].sda =
(__u64) vcpu->arch.sie_block;
vcpu->arch.sie_block->scaoh =
(__u32)(((__u64)kvm->arch.sca) >> 32);
vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
}
spin_lock_init(&vcpu->arch.local_int.lock); spin_lock_init(&vcpu->arch.local_int.lock);
INIT_LIST_HEAD(&vcpu->arch.local_int.list); INIT_LIST_HEAD(&vcpu->arch.local_int.list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment