public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Update destination when updating pi irte
@ 2023-05-16 12:21 dengqiao.joey
  2023-05-16 15:54 ` Sean Christopherson
  0 siblings, 1 reply; 11+ messages in thread
From: dengqiao.joey @ 2023-05-16 12:21 UTC (permalink / raw)
  To: seanjc, pbonzini; +Cc: kvm, linux-kernel, dengqiao.joey

Destination of irte will be cleard by IOMMU driver when updating irte.
It will only be set correctly in vcpu_load. IOMMU will deliver the
doorbell message to the wrong physical cpu before vcpu_load is executed.
That means vcpu can not recognize interrupt delivery during the time of
non-root mode.

Signed-off-by: dengqiao.joey <dengqiao.joey@bytedance.com>
---
 arch/x86/kvm/svm/avic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index cfc8ab773025..16fe41429123 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -933,8 +933,11 @@ int avic_pi_update_irte(struct kvm *kvm, unsigned int host_irq,
 			 * we can reference to them directly when we update vcpu
 			 * scheduling information in IOMMU irte.
 			 */
-			if (!ret && pi.is_guest_mode)
+			if (!ret && pi.is_guest_mode) {
+				amd_iommu_update_ga(kvm_cpu_get_apicid(svm->vcpu.cpu),
+						    true, pi.ir_data);
 				svm_ir_list_add(svm, &pi);
+			}
 		} else {
 			/* Use legacy mode in IRTE */
 			struct amd_iommu_pi_data pi;
-- 
2.11.0


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

end of thread, other threads:[~2023-07-21 18:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 12:21 [PATCH] KVM: SVM: Update destination when updating pi irte dengqiao.joey
2023-05-16 15:54 ` Sean Christopherson
2023-05-17 12:04   ` dengqiao.joey
2023-05-17 15:32     ` Joao Martins
2023-05-18  3:58       ` dengqiao.joey
2023-05-18  8:19         ` Maxim Levitsky
2023-05-18  9:02           ` Joao Martins
2023-06-29 22:35             ` Sean Christopherson
2023-07-14 13:05               ` Joao Martins
2023-07-19 15:57                 ` Sean Christopherson
2023-07-21 18:44                   ` Alejandro Jimenez

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