]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu/amd: KVM: SVM: Set pCPU info in IRTE when setting vCPU affinity
authorSean Christopherson <seanjc@google.com>
Wed, 11 Jun 2025 22:45:45 +0000 (15:45 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 23 Jun 2025 16:50:39 +0000 (09:50 -0700)
commitf965255dc5033387ac7858787c6c792fd789ac34
treee2005184f5ce1da192f9fa1fe0ad24fc6439836c
parent0b2b541fa3cd85bb06fdd9353764673aa2bfd54a
iommu/amd: KVM: SVM: Set pCPU info in IRTE when setting vCPU affinity

Now that setting vCPU affinity is guarded with ir_list_lock, i.e. now that
avic_physical_id_entry can be safely accessed, set the pCPU info
straight-away when setting vCPU affinity.  Putting the IRTE into posted
mode, and then immediately updating the IRTE a second time if the target
vCPU is running is wasteful and confusing.

This also fixes a flaw where a posted IRQ that arrives between putting
the IRTE into guest_mode and setting the correct destination could cause
the IOMMU to ring the doorbell on the wrong pCPU.

Link: https://lore.kernel.org/r/20250611224604.313496-44-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/irq_remapping.h
arch/x86/kvm/svm/avic.c
drivers/iommu/amd/iommu.c
include/linux/amd-iommu.h