7
7
#include <linux/pci.h>
8
8
#include <linux/logic_iomem.h>
9
9
#include <linux/of_platform.h>
10
+ #include <linux/irqchip/irq-msi-lib.h>
10
11
#include <linux/irqdomain.h>
11
12
#include <linux/msi.h>
12
13
#include <linux/unaligned.h>
@@ -29,7 +30,6 @@ static struct um_pci_device *um_pci_platform_device;
29
30
static struct um_pci_device_reg um_pci_devices [MAX_DEVICES ];
30
31
static struct fwnode_handle * um_pci_fwnode ;
31
32
static struct irq_domain * um_pci_inner_domain ;
32
- static struct irq_domain * um_pci_msi_domain ;
33
33
static unsigned long um_pci_msi_used [BITS_TO_LONGS (MAX_MSI_VECTORS )];
34
34
35
35
static unsigned long um_pci_cfgspace_read (void * priv , unsigned int offset ,
@@ -400,21 +400,24 @@ static void um_pci_inner_domain_free(struct irq_domain *domain,
400
400
}
401
401
402
402
static const struct irq_domain_ops um_pci_inner_domain_ops = {
403
+ .select = msi_lib_irq_domain_select ,
403
404
.alloc = um_pci_inner_domain_alloc ,
404
405
.free = um_pci_inner_domain_free ,
405
406
};
406
407
407
- static struct irq_chip um_pci_msi_irq_chip = {
408
- .name = "UM virtual PCIe MSI" ,
409
- .irq_mask = pci_msi_mask_irq ,
410
- .irq_unmask = pci_msi_unmask_irq ,
411
- };
412
-
413
- static struct msi_domain_info um_pci_msi_domain_info = {
414
- .flags = MSI_FLAG_USE_DEF_DOM_OPS |
415
- MSI_FLAG_USE_DEF_CHIP_OPS |
416
- MSI_FLAG_PCI_MSIX ,
417
- .chip = & um_pci_msi_irq_chip ,
408
+ #define UM_PCI_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
409
+ MSI_FLAG_USE_DEF_CHIP_OPS | \
410
+ MSI_FLAG_NO_AFFINITY)
411
+ #define UM_PCI_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
412
+ MSI_FLAG_PCI_MSIX)
413
+
414
+ static const struct msi_parent_ops um_pci_msi_parent_ops = {
415
+ .required_flags = UM_PCI_MSI_FLAGS_REQUIRED ,
416
+ .supported_flags = UM_PCI_MSI_FLAGS_SUPPORTED ,
417
+ .bus_select_token = DOMAIN_BUS_NEXUS ,
418
+ .bus_select_mask = MATCH_PCI_MSI ,
419
+ .prefix = "UM-virtual-" ,
420
+ .init_dev_msi_info = msi_lib_init_dev_msi_info ,
418
421
};
419
422
420
423
static struct resource busn_resource = {
@@ -559,17 +562,14 @@ static int __init um_pci_init(void)
559
562
goto free ;
560
563
}
561
564
562
- um_pci_inner_domain = irq_domain_create_linear (um_pci_fwnode , MAX_MSI_VECTORS ,
563
- & um_pci_inner_domain_ops , NULL );
564
- if (!um_pci_inner_domain ) {
565
- err = - ENOMEM ;
566
- goto free ;
567
- }
565
+ struct irq_domain_info info = {
566
+ .fwnode = um_pci_fwnode ,
567
+ .ops = & um_pci_inner_domain_ops ,
568
+ .size = MAX_MSI_VECTORS ,
569
+ };
568
570
569
- um_pci_msi_domain = pci_msi_create_irq_domain (um_pci_fwnode ,
570
- & um_pci_msi_domain_info ,
571
- um_pci_inner_domain );
572
- if (!um_pci_msi_domain ) {
571
+ um_pci_inner_domain = msi_create_parent_irq_domain (& info , & um_pci_msi_parent_ops );
572
+ if (!um_pci_inner_domain ) {
573
573
err = - ENOMEM ;
574
574
goto free ;
575
575
}
@@ -611,7 +611,6 @@ device_initcall(um_pci_init);
611
611
612
612
static void __exit um_pci_exit (void )
613
613
{
614
- irq_domain_remove (um_pci_msi_domain );
615
614
irq_domain_remove (um_pci_inner_domain );
616
615
pci_free_resource_list (& bridge -> windows );
617
616
pci_free_host_bridge (bridge );
0 commit comments