Skip to content

Commit 2b2c6aa

Browse files
committed
iommm/amd: Store irq domain in struct device
As the next step to make X86 utilize the direct MSI irq domain operations store the irq domain pointer in the device struct when a device is probed. It only overrides the irqdomain of devices which are handled by a regular PCI/MSI irq domain which protects PCI devices behind special busses like VMD which have their own irq domain. No functional change. It just avoids the redirection through arch_*_msi_irqs() and allows the PCI/MSI core to directly invoke the irq domain alloc/free functions instead of having to look up the irq domain for every single MSI interupt. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Joerg Roedel <jroedel@suse.de> Link: https://lore.kernel.org/r/20200826112333.806328762@linutronix.de
1 parent 85a8dfc commit 2b2c6aa

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/iommu/amd/iommu.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,21 @@ static void iommu_poll_ga_log(struct amd_iommu *iommu)
729729
}
730730
}
731731
}
732-
#endif /* CONFIG_IRQ_REMAP */
732+
733+
static void
734+
amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu)
735+
{
736+
if (!irq_remapping_enabled || !dev_is_pci(dev) ||
737+
pci_dev_has_special_msi_domain(to_pci_dev(dev)))
738+
return;
739+
740+
dev_set_msi_domain(dev, iommu->msi_domain);
741+
}
742+
743+
#else /* CONFIG_IRQ_REMAP */
744+
static inline void
745+
amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu) { }
746+
#endif /* !CONFIG_IRQ_REMAP */
733747

734748
#define AMD_IOMMU_INT_MASK \
735749
(MMIO_STATUS_EVT_INT_MASK | \
@@ -2157,6 +2171,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)
21572171
iommu_dev = ERR_PTR(ret);
21582172
iommu_ignore_device(dev);
21592173
} else {
2174+
amd_iommu_set_pci_msi_domain(dev, iommu);
21602175
iommu_dev = &iommu->iommu;
21612176
}
21622177

0 commit comments

Comments
 (0)