mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
iommu/intel: Convert to msi_create_parent_irq_domain() helper
Now that we have a concise helper to create an MSI parent domain, switch the Intel 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-10-maz@kernel.org Link: https://lore.kernel.org/r/169c793c50be8493cfd9d11affb00e9ed6341c36.1750858125.git.namcao@linutronix.de Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
0eaa67ad3a
commit
8154f3c0fd
|
|
@ -200,6 +200,7 @@ source "drivers/iommu/riscv/Kconfig"
|
|||
config IRQ_REMAP
|
||||
bool "Support for Interrupt Remapping"
|
||||
depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
|
||||
select IRQ_MSI_LIB
|
||||
help
|
||||
Supports Interrupt remapping for IO-APIC and MSI devices.
|
||||
To use x2apic mode in the CPU's which support x2APIC enhancements or
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/hpet.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/irqchip/irq-msi-lib.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/crash_dump.h>
|
||||
|
|
@ -518,8 +519,14 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
|
|||
|
||||
static int intel_setup_irq_remapping(struct intel_iommu *iommu)
|
||||
{
|
||||
struct irq_domain_info info = {
|
||||
.ops = &intel_ir_domain_ops,
|
||||
.parent = arch_get_ir_parent_domain(),
|
||||
.domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI,
|
||||
.size = INTR_REMAP_TABLE_ENTRIES,
|
||||
.host_data = iommu,
|
||||
};
|
||||
struct ir_table *ir_table;
|
||||
struct fwnode_handle *fn;
|
||||
unsigned long *bitmap;
|
||||
void *ir_table_base;
|
||||
|
||||
|
|
@ -544,25 +551,16 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
|
|||
goto out_free_pages;
|
||||
}
|
||||
|
||||
fn = irq_domain_alloc_named_id_fwnode("INTEL-IR", iommu->seq_id);
|
||||
if (!fn)
|
||||
info.fwnode = irq_domain_alloc_named_id_fwnode("INTEL-IR", iommu->seq_id);
|
||||
if (!info.fwnode)
|
||||
goto out_free_bitmap;
|
||||
|
||||
iommu->ir_domain =
|
||||
irq_domain_create_hierarchy(arch_get_ir_parent_domain(),
|
||||
0, INTR_REMAP_TABLE_ENTRIES,
|
||||
fn, &intel_ir_domain_ops,
|
||||
iommu);
|
||||
iommu->ir_domain = msi_create_parent_irq_domain(&info, &dmar_msi_parent_ops);
|
||||
if (!iommu->ir_domain) {
|
||||
pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id);
|
||||
goto out_free_fwnode;
|
||||
}
|
||||
|
||||
irq_domain_update_bus_token(iommu->ir_domain, DOMAIN_BUS_DMAR);
|
||||
iommu->ir_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
|
||||
IRQ_DOMAIN_FLAG_ISOLATED_MSI;
|
||||
iommu->ir_domain->msi_parent_ops = &dmar_msi_parent_ops;
|
||||
|
||||
ir_table->base = ir_table_base;
|
||||
ir_table->bitmap = bitmap;
|
||||
iommu->ir_table = ir_table;
|
||||
|
|
@ -608,7 +606,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
|
|||
irq_domain_remove(iommu->ir_domain);
|
||||
iommu->ir_domain = NULL;
|
||||
out_free_fwnode:
|
||||
irq_domain_free_fwnode(fn);
|
||||
irq_domain_free_fwnode(info.fwnode);
|
||||
out_free_bitmap:
|
||||
bitmap_free(bitmap);
|
||||
out_free_pages:
|
||||
|
|
@ -1530,6 +1528,8 @@ static const struct irq_domain_ops intel_ir_domain_ops = {
|
|||
|
||||
static const struct msi_parent_ops dmar_msi_parent_ops = {
|
||||
.supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI,
|
||||
.bus_select_token = DOMAIN_BUS_DMAR,
|
||||
.bus_select_mask = MATCH_PCI_MSI,
|
||||
.prefix = "IR-",
|
||||
.init_dev_msi_info = msi_parent_init_dev_msi_info,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user