Skip to content

Commit 0eaa67a

Browse files
Marc Zyngierjoergroedel
authored andcommitted
iommu/amd: Convert to msi_create_parent_irq_domain() helper
Now that we have a concise helper to create an MSI parent domain, switch the AMD IOMMU remapping over to that. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Nam Cao <[email protected]> Link: https://lore.kernel.org/all/[email protected] Link: https://lore.kernel.org/r/92e5ae97a03e4ffc272349d0863cd2cc8f904c44.1750858125.git.namcao@linutronix.de Signed-off-by: Joerg Roedel <[email protected]>
1 parent 792ea7b commit 0eaa67a

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

drivers/iommu/amd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config AMD_IOMMU
77
select PCI_ATS
88
select PCI_PRI
99
select PCI_PASID
10+
select IRQ_MSI_LIB
1011
select MMU_NOTIFIER
1112
select IOMMU_API
1213
select IOMMU_IOVA

drivers/iommu/amd/iommu.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/notifier.h>
2626
#include <linux/export.h>
2727
#include <linux/irq.h>
28+
#include <linux/irqchip/irq-msi-lib.h>
2829
#include <linux/msi.h>
2930
#include <linux/irqdomain.h>
3031
#include <linux/percpu.h>
@@ -3970,29 +3971,30 @@ static struct irq_chip amd_ir_chip = {
39703971

39713972
static const struct msi_parent_ops amdvi_msi_parent_ops = {
39723973
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
3974+
.bus_select_token = DOMAIN_BUS_AMDVI,
3975+
.bus_select_mask = MATCH_PCI_MSI,
39733976
.prefix = "IR-",
39743977
.init_dev_msi_info = msi_parent_init_dev_msi_info,
39753978
};
39763979

39773980
int amd_iommu_create_irq_domain(struct amd_iommu *iommu)
39783981
{
3979-
struct fwnode_handle *fn;
3982+
struct irq_domain_info info = {
3983+
.fwnode = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index),
3984+
.ops = &amd_ir_domain_ops,
3985+
.domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI,
3986+
.host_data = iommu,
3987+
.parent = arch_get_ir_parent_domain(),
3988+
};
39803989

3981-
fn = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index);
3982-
if (!fn)
3990+
if (!info.fwnode)
39833991
return -ENOMEM;
3984-
iommu->ir_domain = irq_domain_create_hierarchy(arch_get_ir_parent_domain(), 0, 0,
3985-
fn, &amd_ir_domain_ops, iommu);
3992+
3993+
iommu->ir_domain = msi_create_parent_irq_domain(&info, &amdvi_msi_parent_ops);
39863994
if (!iommu->ir_domain) {
3987-
irq_domain_free_fwnode(fn);
3995+
irq_domain_free_fwnode(info.fwnode);
39883996
return -ENOMEM;
39893997
}
3990-
3991-
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI);
3992-
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
3993-
IRQ_DOMAIN_FLAG_ISOLATED_MSI;
3994-
iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops;
3995-
39963998
return 0;
39973999
}
39984000

0 commit comments

Comments
 (0)