diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2019-12-18 22:55:09 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-01-24 09:19:07 +0100 |
commit | 897cc38eaab96d006ab17edd0f50a2f432f584cf (patch) | |
tree | 4424da47ceebcd43cd400d7b71572b57abe938c5 /virt/kvm/kvm_main.c | |
parent | KVM: Remove kvm_arch_vcpu_free() declaration (diff) | |
download | linux-897cc38eaab96d006ab17edd0f50a2f432f584cf.tar.xz linux-897cc38eaab96d006ab17edd0f50a2f432f584cf.zip |
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 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 483c683408a2..7b52207f829c 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2728,6 +2728,10 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) kvm->created_vcpus++; mutex_unlock(&kvm->lock); + r = kvm_arch_vcpu_precreate(kvm, id); + if (r) + goto vcpu_decrement; + vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) { r = PTR_ERR(vcpu); |