[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1568401242-260374-11-git-send-email-suravee.suthikulpanit@amd.com>
Date: Fri, 13 Sep 2019 19:01:02 +0000
From: "Suthikulpanit, Suravee" <Suravee.Suthikulpanit@....com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC: "pbonzini@...hat.com" <pbonzini@...hat.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"joro@...tes.org" <joro@...tes.org>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"graf@...zon.com" <graf@...zon.com>,
"jschoenh@...zon.de" <jschoenh@...zon.de>,
"karahmed@...zon.de" <karahmed@...zon.de>,
"rimasluk@...zon.com" <rimasluk@...zon.com>,
"Grimm, Jon" <Jon.Grimm@....com>,
"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@....com>
Subject: [PATCH v3 10/16] svm: Disable AVIC when launching guest with SVM
support
Since AVIC does not currently work w/ nested virtualization, disable AVIC
for the guest if setting CPUID Fn80000001_ECX[SVM] (i.e. indicate support
for SVM, which is needed for nested virtualization).
Suggested-by: Alexander Graf <graf@...zon.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
---
arch/x86/kvm/svm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a01bc6a..e02ee1a 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -6029,6 +6029,16 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu)
return;
guest_cpuid_clear(vcpu, X86_FEATURE_X2APIC);
+
+ /*
+ * Currently, AVIC does not work with nested virtualization.
+ * So, we disable AVIC when cpuid for SVM is set in the L1 guest.
+ */
+ if (nested && guest_cpuid_has(vcpu, X86_FEATURE_SVM)) {
+ vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
+ kvm_make_apicv_deactivate_request(vcpu, true);
+ srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
+ }
}
static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
--
1.8.3.1
Powered by blists - more mailing lists