Skip to content

Commit

Permalink
kvm: svm: Do not support AVIC if not CONFIG_X86_LOCAL_APIC
Browse files Browse the repository at this point in the history
Add logic to disable AVIC #ifndef CONFIG_X86_LOCAL_APIC.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Suravee Suthikulpanit authored and Paolo Bonzini committed Jun 15, 2016
1 parent 7d669f5 commit 5b8abf1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ module_param(nested, int, S_IRUGO);

/* enable / disable AVIC */
static int avic;
#ifdef CONFIG_X86_LOCAL_APIC
module_param(avic, int, S_IRUGO);
#endif

static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
static void svm_flush_tlb(struct kvm_vcpu *vcpu);
Expand Down Expand Up @@ -981,11 +983,14 @@ static __init int svm_hardware_setup(void)
} else
kvm_disable_tdp();

if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC)))
avic = false;

if (avic)
pr_info("AVIC enabled\n");
if (avic) {
if (!npt_enabled ||
!boot_cpu_has(X86_FEATURE_AVIC) ||
!IS_ENABLED(CONFIG_X86_LOCAL_APIC))
avic = false;
else
pr_info("AVIC enabled\n");
}

return 0;

Expand Down

0 comments on commit 5b8abf1

Please sign in to comment.