iommu/amd: Switch to MSI base domains
Remove the global PCI/MSI irqdomain implementation and provide the required MSI parent ops so the PCI/MSI code can detect the new parent and setup per device domains. 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/20221124232326.209212272@linutronix.de
This commit is contained in:
parent
9a945234ab
commit
cc7594ffad
|
@ -218,6 +218,7 @@ static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
|
|||
info->flags |= MSI_FLAG_NOMASK_QUIRK;
|
||||
break;
|
||||
case DOMAIN_BUS_DMAR:
|
||||
case DOMAIN_BUS_AMDVI:
|
||||
break;
|
||||
default:
|
||||
WARN_ON_ONCE(1);
|
||||
|
|
|
@ -734,7 +734,6 @@ struct amd_iommu {
|
|||
u8 max_counters;
|
||||
#ifdef CONFIG_IRQ_REMAP
|
||||
struct irq_domain *ir_domain;
|
||||
struct irq_domain *msi_domain;
|
||||
|
||||
struct amd_irte_ops *irte_ops;
|
||||
#endif
|
||||
|
|
|
@ -815,7 +815,7 @@ amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu)
|
|||
!pci_dev_has_default_msi_parent_domain(to_pci_dev(dev)))
|
||||
return;
|
||||
|
||||
dev_set_msi_domain(dev, iommu->msi_domain);
|
||||
dev_set_msi_domain(dev, iommu->ir_domain);
|
||||
}
|
||||
|
||||
#else /* CONFIG_IRQ_REMAP */
|
||||
|
@ -3648,6 +3648,12 @@ static struct irq_chip amd_ir_chip = {
|
|||
.irq_compose_msi_msg = ir_compose_msi_msg,
|
||||
};
|
||||
|
||||
static const struct msi_parent_ops amdvi_msi_parent_ops = {
|
||||
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
|
||||
.prefix = "IR-",
|
||||
.init_dev_msi_info = msi_parent_init_dev_msi_info,
|
||||
};
|
||||
|
||||
int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
|
||||
{
|
||||
struct fwnode_handle *fn;
|
||||
|
@ -3655,16 +3661,17 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
|
|||
fn = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index);
|
||||
if (!fn)
|
||||
return -ENOMEM;
|
||||
iommu->ir_domain = irq_domain_create_tree(fn, &amd_ir_domain_ops, iommu);
|
||||
iommu->ir_domain = irq_domain_create_hierarchy(arch_get_ir_parent_domain(), 0, 0,
|
||||
fn, &amd_ir_domain_ops, iommu);
|
||||
if (!iommu->ir_domain) {
|
||||
irq_domain_free_fwnode(fn);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
iommu->ir_domain->parent = arch_get_ir_parent_domain();
|
||||
iommu->msi_domain = arch_create_remap_msi_irq_domain(iommu->ir_domain,
|
||||
"AMD-IR-MSI",
|
||||
iommu->index);
|
||||
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI);
|
||||
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
|
||||
iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ enum irq_domain_bus_token {
|
|||
DOMAIN_BUS_PCI_DEVICE_MSI,
|
||||
DOMAIN_BUS_PCI_DEVICE_MSIX,
|
||||
DOMAIN_BUS_DMAR,
|
||||
DOMAIN_BUS_AMDVI,
|
||||
};
|
||||
|
||||
#endif /* _LINUX_IRQDOMAIN_DEFS_H */
|
||||
|
|
Loading…
Reference in New Issue