Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <namcao@linutronix.de>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Link: https://patch.msgid.link/5f0bd8e877e7bfdfb1a7e99d6b126caf6a7eea48.1751266049.git.namcao@linutronix.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Nam Cao and committed by
Johannes Berg
c36e5eb9 4c5ba7ac

+22 -22
+1
arch/um/drivers/Kconfig
··· 160 160 config UML_PCI 161 161 bool 162 162 select FORCE_PCI 163 + select IRQ_MSI_LIB 163 164 select UML_IOMEM_EMULATION 164 165 select UML_DMA_EMULATION 165 166 select PCI_MSI
+21 -22
arch/um/drivers/virt-pci.c
··· 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> ··· 30 29 static struct um_pci_device_reg um_pci_devices[MAX_DEVICES]; 31 30 static struct fwnode_handle *um_pci_fwnode; 32 31 static struct irq_domain *um_pci_inner_domain; 33 - static struct irq_domain *um_pci_msi_domain; 34 32 static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)]; 35 33 36 34 static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, ··· 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 - }; 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) 412 413 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, 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 = { ··· 562 559 goto free; 563 560 } 564 561 565 - um_pci_inner_domain = irq_domain_create_linear(um_pci_fwnode, MAX_MSI_VECTORS, 566 - &um_pci_inner_domain_ops, NULL); 567 - if (!um_pci_inner_domain) { 568 - err = -ENOMEM; 569 - goto free; 570 - } 562 + struct irq_domain_info info = { 563 + .fwnode = um_pci_fwnode, 564 + .ops = &um_pci_inner_domain_ops, 565 + .size = MAX_MSI_VECTORS, 566 + }; 571 567 572 - um_pci_msi_domain = pci_msi_create_irq_domain(um_pci_fwnode, 573 - &um_pci_msi_domain_info, 574 - um_pci_inner_domain); 575 - if (!um_pci_msi_domain) { 568 + um_pci_inner_domain = msi_create_parent_irq_domain(&info, &um_pci_msi_parent_ops); 569 + if (!um_pci_inner_domain) { 576 570 err = -ENOMEM; 577 571 goto free; 578 572 } ··· 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);