iommu/vt-d: Put IRTE back into posted MSI mode if vCPU posting is disabled
commit 2454823e97a63d85a6b215905f71e5a06324eab7 upstream.
Add a helper to take care of reconfiguring an IRTE to deliver IRQs to the
host, i.e. not to a vCPU, and use the helper when an IRTE's vCPU affinity
is nullified, i.e. when KVM puts an IRTE back into "host" mode. Because
posted MSIs use an ephemeral IRTE, using modify_irte() puts the IRTE into
full remapped mode, i.e. unintentionally disables posted MSIs on the IRQ.
Fixes: ed1e48ea43 ("iommu/vt-d: Enable posted mode for device MSIs")
Cc: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20250315025135.2365846-2-seanjc@google.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e5dd974d6e
commit
c95a438d2c
@@ -1173,7 +1173,17 @@ static void intel_ir_reconfigure_irte_posted(struct irq_data *irqd)
|
||||
static inline void intel_ir_reconfigure_irte_posted(struct irq_data *irqd) {}
|
||||
#endif
|
||||
|
||||
static void intel_ir_reconfigure_irte(struct irq_data *irqd, bool force)
|
||||
static void __intel_ir_reconfigure_irte(struct irq_data *irqd, bool force_host)
|
||||
{
|
||||
struct intel_ir_data *ir_data = irqd->chip_data;
|
||||
|
||||
if (ir_data->irq_2_iommu.posted_msi)
|
||||
intel_ir_reconfigure_irte_posted(irqd);
|
||||
else if (force_host || ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
|
||||
modify_irte(&ir_data->irq_2_iommu, &ir_data->irte_entry);
|
||||
}
|
||||
|
||||
static void intel_ir_reconfigure_irte(struct irq_data *irqd, bool force_host)
|
||||
{
|
||||
struct intel_ir_data *ir_data = irqd->chip_data;
|
||||
struct irte *irte = &ir_data->irte_entry;
|
||||
@@ -1186,10 +1196,7 @@ static void intel_ir_reconfigure_irte(struct irq_data *irqd, bool force)
|
||||
irte->vector = cfg->vector;
|
||||
irte->dest_id = IRTE_DEST(cfg->dest_apicid);
|
||||
|
||||
if (ir_data->irq_2_iommu.posted_msi)
|
||||
intel_ir_reconfigure_irte_posted(irqd);
|
||||
else if (force || ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
|
||||
modify_irte(&ir_data->irq_2_iommu, irte);
|
||||
__intel_ir_reconfigure_irte(irqd, force_host);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1244,7 +1251,7 @@ static int intel_ir_set_vcpu_affinity(struct irq_data *data, void *info)
|
||||
|
||||
/* stop posting interrupts, back to the default mode */
|
||||
if (!vcpu_pi_info) {
|
||||
modify_irte(&ir_data->irq_2_iommu, &ir_data->irte_entry);
|
||||
__intel_ir_reconfigure_irte(data, true);
|
||||
} else {
|
||||
struct irte irte_pi;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user