1010#include <linux/hpet.h>
1111#include <linux/pci.h>
1212#include <linux/irq.h>
13+ #include <linux/irqchip/irq-msi-lib.h>
1314#include <linux/acpi.h>
1415#include <linux/irqdomain.h>
1516#include <linux/crash_dump.h>
@@ -518,8 +519,14 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
518519
519520static int intel_setup_irq_remapping (struct intel_iommu * iommu )
520521{
522+ struct irq_domain_info info = {
523+ .ops = & intel_ir_domain_ops ,
524+ .parent = arch_get_ir_parent_domain (),
525+ .domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI ,
526+ .size = INTR_REMAP_TABLE_ENTRIES ,
527+ .host_data = iommu ,
528+ };
521529 struct ir_table * ir_table ;
522- struct fwnode_handle * fn ;
523530 unsigned long * bitmap ;
524531 void * ir_table_base ;
525532
@@ -544,25 +551,16 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
544551 goto out_free_pages ;
545552 }
546553
547- fn = irq_domain_alloc_named_id_fwnode ("INTEL-IR" , iommu -> seq_id );
548- if (!fn )
554+ info . fwnode = irq_domain_alloc_named_id_fwnode ("INTEL-IR" , iommu -> seq_id );
555+ if (!info . fwnode )
549556 goto out_free_bitmap ;
550557
551- iommu -> ir_domain =
552- irq_domain_create_hierarchy (arch_get_ir_parent_domain (),
553- 0 , INTR_REMAP_TABLE_ENTRIES ,
554- fn , & intel_ir_domain_ops ,
555- iommu );
558+ iommu -> ir_domain = msi_create_parent_irq_domain (& info , & dmar_msi_parent_ops );
556559 if (!iommu -> ir_domain ) {
557560 pr_err ("IR%d: failed to allocate irqdomain\n" , iommu -> seq_id );
558561 goto out_free_fwnode ;
559562 }
560563
561- irq_domain_update_bus_token (iommu -> ir_domain , DOMAIN_BUS_DMAR );
562- iommu -> ir_domain -> flags |= IRQ_DOMAIN_FLAG_MSI_PARENT |
563- IRQ_DOMAIN_FLAG_ISOLATED_MSI ;
564- iommu -> ir_domain -> msi_parent_ops = & dmar_msi_parent_ops ;
565-
566564 ir_table -> base = ir_table_base ;
567565 ir_table -> bitmap = bitmap ;
568566 iommu -> ir_table = ir_table ;
@@ -608,7 +606,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
608606 irq_domain_remove (iommu -> ir_domain );
609607 iommu -> ir_domain = NULL ;
610608out_free_fwnode :
611- irq_domain_free_fwnode (fn );
609+ irq_domain_free_fwnode (info . fwnode );
612610out_free_bitmap :
613611 bitmap_free (bitmap );
614612out_free_pages :
@@ -1530,6 +1528,8 @@ static const struct irq_domain_ops intel_ir_domain_ops = {
15301528
15311529static const struct msi_parent_ops dmar_msi_parent_ops = {
15321530 .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI ,
1531+ .bus_select_token = DOMAIN_BUS_DMAR ,
1532+ .bus_select_mask = MATCH_PCI_MSI ,
15331533 .prefix = "IR-" ,
15341534 .init_dev_msi_info = msi_parent_init_dev_msi_info ,
15351535};
0 commit comments