aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1163e8173e5a..16ef31b87452 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -238,7 +238,9 @@ module_param(nested, int, S_IRUGO);
238 238
239/* enable / disable AVIC */ 239/* enable / disable AVIC */
240static int avic; 240static int avic;
241#ifdef CONFIG_X86_LOCAL_APIC
241module_param(avic, int, S_IRUGO); 242module_param(avic, int, S_IRUGO);
243#endif
242 244
243static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); 245static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
244static void svm_flush_tlb(struct kvm_vcpu *vcpu); 246static void svm_flush_tlb(struct kvm_vcpu *vcpu);
@@ -981,11 +983,14 @@ static __init int svm_hardware_setup(void)
981 } else 983 } else
982 kvm_disable_tdp(); 984 kvm_disable_tdp();
983 985
984 if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC))) 986 if (avic) {
985 avic = false; 987 if (!npt_enabled ||
986 988 !boot_cpu_has(X86_FEATURE_AVIC) ||
987 if (avic) 989 !IS_ENABLED(CONFIG_X86_LOCAL_APIC))
988 pr_info("AVIC enabled\n"); 990 avic = false;
991 else
992 pr_info("AVIC enabled\n");
993 }
989 994
990 return 0; 995 return 0;
991 996
@@ -1324,7 +1329,7 @@ free_avic:
1324static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run) 1329static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
1325{ 1330{
1326 u64 entry; 1331 u64 entry;
1327 int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu); 1332 int h_physical_id = kvm_cpu_get_apicid(vcpu->cpu);
1328 struct vcpu_svm *svm = to_svm(vcpu); 1333 struct vcpu_svm *svm = to_svm(vcpu);
1329 1334
1330 if (!kvm_vcpu_apicv_active(vcpu)) 1335 if (!kvm_vcpu_apicv_active(vcpu))
@@ -1349,7 +1354,7 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1349{ 1354{
1350 u64 entry; 1355 u64 entry;
1351 /* ID = 0xff (broadcast), ID > 0xff (reserved) */ 1356 /* ID = 0xff (broadcast), ID > 0xff (reserved) */
1352 int h_physical_id = __default_cpu_present_to_apicid(cpu); 1357 int h_physical_id = kvm_cpu_get_apicid(cpu);
1353 struct vcpu_svm *svm = to_svm(vcpu); 1358 struct vcpu_svm *svm = to_svm(vcpu);
1354 1359
1355 if (!kvm_vcpu_apicv_active(vcpu)) 1360 if (!kvm_vcpu_apicv_active(vcpu))
@@ -4236,7 +4241,7 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
4236 4241
4237 if (avic_vcpu_is_running(vcpu)) 4242 if (avic_vcpu_is_running(vcpu))
4238 wrmsrl(SVM_AVIC_DOORBELL, 4243 wrmsrl(SVM_AVIC_DOORBELL,
4239 __default_cpu_present_to_apicid(vcpu->cpu)); 4244 kvm_cpu_get_apicid(vcpu->cpu));
4240 else 4245 else
4241 kvm_vcpu_wake_up(vcpu); 4246 kvm_vcpu_wake_up(vcpu);
4242} 4247}