summaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-19 00:55:00 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 11:19:01 +0300
commitff030fdf55732266c2d35b1a4a0baaf9ce49e9dd (patch)
tree579e39c9b9460b83f6398aea3738dfedee75d2f7 /arch/powerpc/kvm/powerpc.c
parent4dbf6fec78868ef02e8bf32834f16b22f58723f5 (diff)
downloadlinux-ff030fdf55732266c2d35b1a4a0baaf9ce49e9dd.tar.xz
KVM: PPC: Move kvm_vcpu_init() invocation to common code
Move the kvm_cpu_{un}init() calls to common PPC code as an intermediate step towards removing kvm_cpu_{un}init() altogether. No functional change intended. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index fd978f681b66..173f57e0a1b5 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -729,14 +729,20 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
if (!vcpu)
return ERR_PTR(-ENOMEM);
- err = kvmppc_core_vcpu_create(kvm, vcpu, id);
+ err = kvm_vcpu_init(vcpu, kvm, id);
if (err)
goto free_vcpu;
+ err = kvmppc_core_vcpu_create(vcpu);
+ if (err)
+ goto uninit_vcpu;
+
vcpu->arch.wqp = &vcpu->wq;
kvmppc_create_vcpu_debugfs(vcpu, id);
return vcpu;
+uninit_vcpu:
+ kvm_vcpu_uninit(vcpu);
free_vcpu:
kmem_cache_free(kvm_vcpu_cache, vcpu);
return ERR_PTR(err);
@@ -770,6 +776,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
kvmppc_core_vcpu_free(vcpu);
+ kvm_vcpu_uninit(vcpu);
+
kmem_cache_free(kvm_vcpu_cache, vcpu);
}