summaryrefslogtreecommitdiff
path: root/arch/s390
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-19 00:55:09 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 11:19:07 +0300
commit897cc38eaab96d006ab17edd0f50a2f432f584cf (patch)
tree4424da47ceebcd43cd400d7b71572b57abe938c5 /arch/s390
parentfe931f12277186d1a9d38ba6729b42e8edb68988 (diff)
downloadlinux-897cc38eaab96d006ab17edd0f50a2f432f584cf.tar.xz
KVM: Add kvm_arch_vcpu_precreate() to handle pre-allocation issues
Add a pre-allocation arch hook to handle checks that are currently done by arch specific code prior to allocating the vCPU object. This paves the way for moving the allocation to common KVM code. Acked-by: Christoffer Dall <christoffer.dall@arm.com> 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>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/kvm-s390.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d9e6bf3d54f0..57c6838dff37 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3035,15 +3035,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
return rc;
}
+int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
+{
+ if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id))
+ return -EINVAL;
+ return 0;
+}
+
struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
unsigned int id)
{
struct kvm_vcpu *vcpu;
struct sie_page *sie_page;
- int rc = -EINVAL;
-
- if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id))
- goto out;
+ int rc;
rc = -ENOMEM;