Skip to content

Commit c36e5eb

Browse files
covanamjmberg-intel
authored andcommitted
um: virt-pci: Switch to msi_create_parent_irq_domain()
Move away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain(). Signed-off-by: Nam Cao <[email protected]> Acked-by: Johannes Berg <[email protected]> Tested-by: Johannes Berg <[email protected]> Link: https://patch.msgid.link/5f0bd8e877e7bfdfb1a7e99d6b126caf6a7eea48.1751266049.git.namcao@linutronix.de Signed-off-by: Johannes Berg <[email protected]>
1 parent 4c5ba7a commit c36e5eb

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

arch/um/drivers/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ config UML_RTC
160160
config UML_PCI
161161
bool
162162
select FORCE_PCI
163+
select IRQ_MSI_LIB
163164
select UML_IOMEM_EMULATION
164165
select UML_DMA_EMULATION
165166
select PCI_MSI

arch/um/drivers/virt-pci.c

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/pci.h>
88
#include <linux/logic_iomem.h>
99
#include <linux/of_platform.h>
10+
#include <linux/irqchip/irq-msi-lib.h>
1011
#include <linux/irqdomain.h>
1112
#include <linux/msi.h>
1213
#include <linux/unaligned.h>
@@ -29,7 +30,6 @@ static struct um_pci_device *um_pci_platform_device;
2930
static struct um_pci_device_reg um_pci_devices[MAX_DEVICES];
3031
static struct fwnode_handle *um_pci_fwnode;
3132
static struct irq_domain *um_pci_inner_domain;
32-
static struct irq_domain *um_pci_msi_domain;
3333
static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)];
3434

3535
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,
400400
}
401401

402402
static const struct irq_domain_ops um_pci_inner_domain_ops = {
403+
.select = msi_lib_irq_domain_select,
403404
.alloc = um_pci_inner_domain_alloc,
404405
.free = um_pci_inner_domain_free,
405406
};
406407

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,
418421
};
419422

420423
static struct resource busn_resource = {
@@ -559,17 +562,14 @@ static int __init um_pci_init(void)
559562
goto free;
560563
}
561564

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+
};
568570

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) {
573573
err = -ENOMEM;
574574
goto free;
575575
}
@@ -611,7 +611,6 @@ device_initcall(um_pci_init);
611611

612612
static void __exit um_pci_exit(void)
613613
{
614-
irq_domain_remove(um_pci_msi_domain);
615614
irq_domain_remove(um_pci_inner_domain);
616615
pci_free_resource_list(&bridge->windows);
617616
pci_free_host_bridge(bridge);

0 commit comments

Comments
 (0)