KVM: MIPS: Move .vcpu_setup() call to kvm_arch_vcpu_create()
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 18 Dec 2019 21:55:19 +0000 (13:55 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Jan 2020 18:59:26 +0000 (19:59 +0100)
Fold setup() into create() now that the two are called back-to-back by
common KVM code.  This paves the way for removing kvm_arch_vcpu_setup().
Note, there is no unwind function associated with kvm_arch_vcpu_setup(),
i.e. no teardown path that also needs to be moved.

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/mips.c

index 92c9321b3f9592e4e7cfdb5ae1072b7808c4107d..b3a4435af66b1363428819b79ddda7a17d278c2b 100644 (file)
@@ -386,8 +386,15 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
        vcpu->arch.last_sched_cpu = -1;
        vcpu->arch.last_exec_cpu = -1;
 
+       /* Initial guest state */
+       err = kvm_mips_callbacks->vcpu_setup(vcpu);
+       if (err)
+               goto out_free_commpage;
+
        return 0;
 
+out_free_commpage:
+       kfree(vcpu->arch.kseg0_commpage);
 out_free_gebase:
        kfree(gebase);
 out:
@@ -1237,10 +1244,9 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
        return 0;
 }
 
-/* Initial guest state */
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
-       return kvm_mips_callbacks->vcpu_setup(vcpu);
+       return 0;
 }
 
 static void kvm_mips_set_c0_status(void)