mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
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 <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Nam Cao <tglx@linutronix.de> Link: https://lore.kernel.org/all/20241204124549.607054-9-maz@kernel.org Link: https://lore.kernel.org/r/92e5ae97a03e4ffc272349d0863cd2cc8f904c44.1750858125.git.namcao@linutronix.de Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
792ea7b6ca
commit
0eaa67ad3a
|
|
@ -7,6 +7,7 @@ config AMD_IOMMU
|
|||
select PCI_ATS
|
||||
select PCI_PRI
|
||||
select PCI_PASID
|
||||
select IRQ_MSI_LIB
|
||||
select MMU_NOTIFIER
|
||||
select IOMMU_API
|
||||
select IOMMU_IOVA
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/notifier.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/irqchip/irq-msi-lib.h>
|
||||
#include <linux/msi.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/percpu.h>
|
||||
|
|
@ -3970,29 +3971,30 @@ static struct irq_chip amd_ir_chip = {
|
|||
|
||||
static const struct msi_parent_ops amdvi_msi_parent_ops = {
|
||||
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
|
||||
.bus_select_token = DOMAIN_BUS_AMDVI,
|
||||
.bus_select_mask = MATCH_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;
|
||||
struct irq_domain_info info = {
|
||||
.fwnode = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index),
|
||||
.ops = &amd_ir_domain_ops,
|
||||
.domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI,
|
||||
.host_data = iommu,
|
||||
.parent = arch_get_ir_parent_domain(),
|
||||
};
|
||||
|
||||
fn = irq_domain_alloc_named_id_fwnode("AMD-IR", iommu->index);
|
||||
if (!fn)
|
||||
if (!info.fwnode)
|
||||
return -ENOMEM;
|
||||
iommu->ir_domain = irq_domain_create_hierarchy(arch_get_ir_parent_domain(), 0, 0,
|
||||
fn, &amd_ir_domain_ops, iommu);
|
||||
|
||||
iommu->ir_domain = msi_create_parent_irq_domain(&info, &amdvi_msi_parent_ops);
|
||||
if (!iommu->ir_domain) {
|
||||
irq_domain_free_fwnode(fn);
|
||||
irq_domain_free_fwnode(info.fwnode);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_AMDVI);
|
||||
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
|
||||
IRQ_DOMAIN_FLAG_ISOLATED_MSI;
|
||||
iommu->ir_domain->msi_parent_ops = &amdvi_msi_parent_ops;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user