mirror of
https://github.com/torvalds/linux.git
synced 2024-12-20 10:01:56 +00:00
KVM: s390: Move guts of kvm_arch_vcpu_init() into kvm_arch_vcpu_create()
Move all of kvm_arch_vcpu_init(), which is invoked at the very end of kvm_vcpu_init(), into kvm_arch_vcpu_create() in preparation of moving the call to kvm_vcpu_init(). Moving kvm_vcpu_init() is itself a preparatory step for moving allocation and initialization to common KVM code. No functional change inteded. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
897cc38eaa
commit
321f8ee559
@ -2705,34 +2705,6 @@ static int sca_can_add_vcpu(struct kvm *kvm, unsigned int id)
|
|||||||
|
|
||||||
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
|
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID;
|
|
||||||
kvm_clear_async_pf_completion_queue(vcpu);
|
|
||||||
vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX |
|
|
||||||
KVM_SYNC_GPRS |
|
|
||||||
KVM_SYNC_ACRS |
|
|
||||||
KVM_SYNC_CRS |
|
|
||||||
KVM_SYNC_ARCH0 |
|
|
||||||
KVM_SYNC_PFAULT;
|
|
||||||
kvm_s390_set_prefix(vcpu, 0);
|
|
||||||
if (test_kvm_facility(vcpu->kvm, 64))
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB;
|
|
||||||
if (test_kvm_facility(vcpu->kvm, 82))
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_BPBC;
|
|
||||||
if (test_kvm_facility(vcpu->kvm, 133))
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_GSCB;
|
|
||||||
if (test_kvm_facility(vcpu->kvm, 156))
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_ETOKEN;
|
|
||||||
/* fprs can be synchronized via vrs, even if the guest has no vx. With
|
|
||||||
* MACHINE_HAS_VX, (load|store)_fpu_regs() will work with vrs format.
|
|
||||||
*/
|
|
||||||
if (MACHINE_HAS_VX)
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS;
|
|
||||||
else
|
|
||||||
vcpu->run->kvm_valid_regs |= KVM_SYNC_FPRS;
|
|
||||||
|
|
||||||
if (kvm_is_ucontrol(vcpu->kvm))
|
|
||||||
return __kvm_ucontrol_vcpu_init(vcpu);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3077,11 +3049,45 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
|
|||||||
rc = kvm_vcpu_init(vcpu, kvm, id);
|
rc = kvm_vcpu_init(vcpu, kvm, id);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_free_sie_block;
|
goto out_free_sie_block;
|
||||||
|
|
||||||
|
vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID;
|
||||||
|
kvm_clear_async_pf_completion_queue(vcpu);
|
||||||
|
vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX |
|
||||||
|
KVM_SYNC_GPRS |
|
||||||
|
KVM_SYNC_ACRS |
|
||||||
|
KVM_SYNC_CRS |
|
||||||
|
KVM_SYNC_ARCH0 |
|
||||||
|
KVM_SYNC_PFAULT;
|
||||||
|
kvm_s390_set_prefix(vcpu, 0);
|
||||||
|
if (test_kvm_facility(vcpu->kvm, 64))
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB;
|
||||||
|
if (test_kvm_facility(vcpu->kvm, 82))
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_BPBC;
|
||||||
|
if (test_kvm_facility(vcpu->kvm, 133))
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_GSCB;
|
||||||
|
if (test_kvm_facility(vcpu->kvm, 156))
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_ETOKEN;
|
||||||
|
/* fprs can be synchronized via vrs, even if the guest has no vx. With
|
||||||
|
* MACHINE_HAS_VX, (load|store)_fpu_regs() will work with vrs format.
|
||||||
|
*/
|
||||||
|
if (MACHINE_HAS_VX)
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS;
|
||||||
|
else
|
||||||
|
vcpu->run->kvm_valid_regs |= KVM_SYNC_FPRS;
|
||||||
|
|
||||||
|
if (kvm_is_ucontrol(vcpu->kvm)) {
|
||||||
|
rc = __kvm_ucontrol_vcpu_init(vcpu);
|
||||||
|
if (rc)
|
||||||
|
goto out_uninit_vcpu;
|
||||||
|
}
|
||||||
|
|
||||||
VM_EVENT(kvm, 3, "create cpu %d at 0x%pK, sie block at 0x%pK", id, vcpu,
|
VM_EVENT(kvm, 3, "create cpu %d at 0x%pK, sie block at 0x%pK", id, vcpu,
|
||||||
vcpu->arch.sie_block);
|
vcpu->arch.sie_block);
|
||||||
trace_kvm_s390_create_vcpu(id, vcpu, vcpu->arch.sie_block);
|
trace_kvm_s390_create_vcpu(id, vcpu, vcpu->arch.sie_block);
|
||||||
|
|
||||||
return vcpu;
|
return vcpu;
|
||||||
|
out_uninit_vcpu:
|
||||||
|
kvm_vcpu_uninit(vcpu);
|
||||||
out_free_sie_block:
|
out_free_sie_block:
|
||||||
free_page((unsigned long)(vcpu->arch.sie_block));
|
free_page((unsigned long)(vcpu->arch.sie_block));
|
||||||
out_free_cpu:
|
out_free_cpu:
|
||||||
|
Loading…
Reference in New Issue
Block a user