]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - arch/x86/kvm/svm.c
KVM: Add struct kvm_vcpu pointer parameter to get_enable_apicv()
[mirror_ubuntu-hirsute-kernel.git] / arch / x86 / kvm / svm.c
index af54327b9017a5239b6e3b016048207645d66fa8..76f559f5a3dddf3b4b4e383104afd4f1d1d22826 100644 (file)
@@ -1600,6 +1600,23 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
                avic_update_vapic_bar(svm, APIC_DEFAULT_PHYS_BASE);
 }
 
+static int avic_init_vcpu(struct vcpu_svm *svm)
+{
+       int ret;
+
+       if (!avic)
+               return 0;
+
+       ret = avic_init_backing_page(&svm->vcpu);
+       if (ret)
+               return ret;
+
+       INIT_LIST_HEAD(&svm->ir_list);
+       spin_lock_init(&svm->ir_list_lock);
+
+       return ret;
+}
+
 static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
 {
        struct vcpu_svm *svm;
@@ -1636,14 +1653,9 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
        if (!hsave_page)
                goto free_page3;
 
-       if (avic) {
-               err = avic_init_backing_page(&svm->vcpu);
-               if (err)
-                       goto free_page4;
-
-               INIT_LIST_HEAD(&svm->ir_list);
-               spin_lock_init(&svm->ir_list_lock);
-       }
+       err = avic_init_vcpu(svm);
+       if (err)
+               goto free_page4;
 
        /* We initialize this flag to true to make sure that the is_running
         * bit would be set the first time the vcpu is loaded.
@@ -4395,7 +4407,7 @@ static void svm_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set)
        return;
 }
 
-static bool svm_get_enable_apicv(void)
+static bool svm_get_enable_apicv(struct kvm_vcpu *vcpu)
 {
        return avic;
 }