Skip to content

Commit fa5745a

Browse files
committed
iommu/amd: 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. 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.140571546@linutronix.de
1 parent 810531a commit fa5745a

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

drivers/iommu/amd/iommu.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,11 +3649,20 @@ static struct irq_chip amd_ir_chip = {
36493649
};
36503650

36513651
static const struct msi_parent_ops amdvi_msi_parent_ops = {
3652-
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
3652+
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED |
3653+
MSI_FLAG_MULTI_PCI_MSI |
3654+
MSI_FLAG_PCI_IMS,
36533655
.prefix = "IR-",
36543656
.init_dev_msi_info = msi_parent_init_dev_msi_info,
36553657
};
36563658

3659+
static const struct msi_parent_ops virt_amdvi_msi_parent_ops = {
3660+
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED |
3661+
MSI_FLAG_MULTI_PCI_MSI,
3662+
.prefix = "vIR-",
3663+
.init_dev_msi_info = msi_parent_init_dev_msi_info,
3664+
};
3665+
36573666
int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
36583667
{
36593668
struct fwnode_handle *fn;
@@ -3670,7 +3679,11 @@ int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
36703679

36713680
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI);
36723681
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
3673-
iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops;
3682+
3683+
if (amd_iommu_np_cache)
3684+
iommu->ir_domain->msi_parent_ops = &virt_amdvi_msi_parent_ops;
3685+
else
3686+
iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops;
36743687

36753688
return 0;
36763689
}

0 commit comments

Comments
 (0)