Skip to content

Commit 810531a

Browse files
committed
iommu/vt-d: Enable PCI/IMS
PCI/IMS works like PCI/MSI-X in the remapping. Just add the feature flag, but only when on real hardware. Virtualized IOMMUs need additional support, e.g. for PASID. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20221124232327.081482253@linutronix.de
1 parent 6e24c88 commit 810531a

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

drivers/iommu/intel/irq_remapping.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static const struct irq_domain_ops intel_ir_domain_ops;
8282

8383
static void iommu_disable_irq_remapping(struct intel_iommu *iommu);
8484
static int __init parse_ioapics_under_ir(void);
85-
static const struct msi_parent_ops dmar_msi_parent_ops;
85+
static const struct msi_parent_ops dmar_msi_parent_ops, virt_dmar_msi_parent_ops;
8686

8787
static bool ir_pre_enabled(struct intel_iommu *iommu)
8888
{
@@ -577,7 +577,11 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
577577

578578
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_DMAR);
579579
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
580-
iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops;
580+
581+
if (cap_caching_mode(iommu->cap))
582+
iommu->ir_domain->msi_parent_ops = &virt_dmar_msi_parent_ops;
583+
else
584+
iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops;
581585

582586
ir_table->base = page_address(pages);
583587
ir_table->bitmap = bitmap;
@@ -1429,11 +1433,20 @@ static const struct irq_domain_ops intel_ir_domain_ops = {
14291433
};
14301434

14311435
static const struct msi_parent_ops dmar_msi_parent_ops = {
1432-
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
1436+
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED |
1437+
MSI_FLAG_MULTI_PCI_MSI |
1438+
MSI_FLAG_PCI_IMS,
14331439
.prefix = "IR-",
14341440
.init_dev_msi_info = msi_parent_init_dev_msi_info,
14351441
};
14361442

1443+
static const struct msi_parent_ops virt_dmar_msi_parent_ops = {
1444+
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED |
1445+
MSI_FLAG_MULTI_PCI_MSI,
1446+
.prefix = "vIR-",
1447+
.init_dev_msi_info = msi_parent_init_dev_msi_info,
1448+
};
1449+
14371450
/*
14381451
* Support of Interrupt Remapping Unit Hotplug
14391452
*/

0 commit comments

Comments
 (0)