mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Do not activate AVIC for SEV-enabled guest
@ 2022-04-07 17:55 Suravee Suthikulpanit
  2022-04-08 12:04 ` Suravee Suthikulpanit
  0 siblings, 1 reply; 2+ messages in thread
From: Suravee Suthikulpanit @ 2022-04-07 17:55 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: pbonzini, mlevitsk, seanjc, jon.grimm, brijesh.singh,
	thomas.lendacky, Suravee Suthikulpanit

Since current AVIC implementation cannot support encrypted memory,
inhibit AVIC for SEV-enabled guest.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 arch/x86/include/asm/kvm_host.h | 1 +
 arch/x86/kvm/svm/avic.c         | 3 ++-
 arch/x86/kvm/svm/sev.c          | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 59fc339ba528..6801a0c3890f 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1037,6 +1037,7 @@ struct kvm_x86_msr_filter {
 #define APICV_INHIBIT_REASON_X2APIC	5
 #define APICV_INHIBIT_REASON_BLOCKIRQ	6
 #define APICV_INHIBIT_REASON_ABSENT	7
+#define APICV_INHIBIT_REASON_SEV	8
 
 struct kvm_arch {
 	unsigned long n_used_mmu_pages;
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 4dae5e79f53b..6ffac1b88487 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -1086,7 +1086,8 @@ bool svm_check_apicv_inhibit_reasons(ulong bit)
 			  BIT(APICV_INHIBIT_REASON_IRQWIN) |
 			  BIT(APICV_INHIBIT_REASON_PIT_REINJ) |
 			  BIT(APICV_INHIBIT_REASON_X2APIC) |
-			  BIT(APICV_INHIBIT_REASON_BLOCKIRQ);
+			  BIT(APICV_INHIBIT_REASON_BLOCKIRQ) |
+			  BIT(APICV_INHIBIT_REASON_SEV);
 
 	return supported & BIT(bit);
 }
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index be2883141220..c3af579fcb91 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -259,6 +259,8 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
 
 	INIT_LIST_HEAD(&sev->regions_list);
 
+	kvm_request_apicv_update(kvm, false, APICV_INHIBIT_REASON_SEV);
+
 	return 0;
 
 e_free:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: SVM: Do not activate AVIC for SEV-enabled guest
  2022-04-07 17:55 [PATCH] KVM: SVM: Do not activate AVIC for SEV-enabled guest Suravee Suthikulpanit
@ 2022-04-08 12:04 ` Suravee Suthikulpanit
  0 siblings, 0 replies; 2+ messages in thread
From: Suravee Suthikulpanit @ 2022-04-08 12:04 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: pbonzini, mlevitsk, seanjc, jon.grimm, brijesh.singh, thomas.lendacky

I need to re-base this patch, and resend v2.

Regards,
Suravee

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 17:55 [PATCH] KVM: SVM: Do not activate AVIC for SEV-enabled guest Suravee Suthikulpanit
2022-04-08 12:04 ` Suravee Suthikulpanit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®