10
10
#include <linux/hpet.h>
11
11
#include <linux/pci.h>
12
12
#include <linux/irq.h>
13
+ #include <linux/irqchip/irq-msi-lib.h>
13
14
#include <linux/acpi.h>
14
15
#include <linux/irqdomain.h>
15
16
#include <linux/crash_dump.h>
@@ -518,8 +519,14 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
518
519
519
520
static int intel_setup_irq_remapping (struct intel_iommu * iommu )
520
521
{
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
+ };
521
529
struct ir_table * ir_table ;
522
- struct fwnode_handle * fn ;
523
530
unsigned long * bitmap ;
524
531
void * ir_table_base ;
525
532
@@ -544,25 +551,16 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
544
551
goto out_free_pages ;
545
552
}
546
553
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 )
549
556
goto out_free_bitmap ;
550
557
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 );
556
559
if (!iommu -> ir_domain ) {
557
560
pr_err ("IR%d: failed to allocate irqdomain\n" , iommu -> seq_id );
558
561
goto out_free_fwnode ;
559
562
}
560
563
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
-
566
564
ir_table -> base = ir_table_base ;
567
565
ir_table -> bitmap = bitmap ;
568
566
iommu -> ir_table = ir_table ;
@@ -608,7 +606,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
608
606
irq_domain_remove (iommu -> ir_domain );
609
607
iommu -> ir_domain = NULL ;
610
608
out_free_fwnode :
611
- irq_domain_free_fwnode (fn );
609
+ irq_domain_free_fwnode (info . fwnode );
612
610
out_free_bitmap :
613
611
bitmap_free (bitmap );
614
612
out_free_pages :
@@ -1530,6 +1528,8 @@ static const struct irq_domain_ops intel_ir_domain_ops = {
1530
1528
1531
1529
static const struct msi_parent_ops dmar_msi_parent_ops = {
1532
1530
.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 ,
1533
1533
.prefix = "IR-" ,
1534
1534
.init_dev_msi_info = msi_parent_init_dev_msi_info ,
1535
1535
};
0 commit comments