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

irqchip/ls-scfg-msi: Switch to use 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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/6d23d93fa1f1e65526698f97c9888fa5d12abc7b.1750860131.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Thomas Gleixner
94b59d5f bafb2901

+22 -26
+1
drivers/irqchip/Kconfig
··· 436 436 def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE 437 437 select IRQ_MSI_IOMMU 438 438 depends on PCI_MSI 439 + select IRQ_MSI_LIB 439 440 440 441 config PARTITION_PERCPU 441 442 bool
+21 -26
drivers/irqchip/irq-ls-scfg-msi.c
··· 14 14 #include <linux/iommu.h> 15 15 #include <linux/irq.h> 16 16 #include <linux/irqchip/chained_irq.h> 17 + #include <linux/irqchip/irq-msi-lib.h> 17 18 #include <linux/irqdomain.h> 18 19 #include <linux/of_irq.h> 19 20 #include <linux/of_pci.h> ··· 48 47 spinlock_t lock; 49 48 struct platform_device *pdev; 50 49 struct irq_domain *parent; 51 - struct irq_domain *msi_domain; 52 50 void __iomem *regs; 53 51 phys_addr_t msiir_addr; 54 52 struct ls_scfg_msi_cfg *cfg; ··· 57 57 unsigned long *used; 58 58 }; 59 59 60 - static struct irq_chip ls_scfg_msi_irq_chip = { 61 - .name = "MSI", 62 - .irq_mask = pci_msi_mask_irq, 63 - .irq_unmask = pci_msi_unmask_irq, 64 - }; 60 + #define MPIC_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ 61 + MSI_FLAG_USE_DEF_CHIP_OPS) 62 + #define MPIC_MSI_FLAGS_SUPPORTED (MSI_FLAG_PCI_MSIX | \ 63 + MSI_GENERIC_FLAGS_MASK) 65 64 66 - static struct msi_domain_info ls_scfg_msi_domain_info = { 67 - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | 68 - MSI_FLAG_USE_DEF_CHIP_OPS | 69 - MSI_FLAG_PCI_MSIX), 70 - .chip = &ls_scfg_msi_irq_chip, 65 + static const struct msi_parent_ops ls_scfg_msi_parent_ops = { 66 + .required_flags = MPIC_MSI_FLAGS_REQUIRED, 67 + .supported_flags = MPIC_MSI_FLAGS_SUPPORTED, 68 + .bus_select_token = DOMAIN_BUS_NEXUS, 69 + .bus_select_mask = MATCH_PCI_MSI, 70 + .prefix = "MSI-", 71 + .init_dev_msi_info = msi_lib_init_dev_msi_info, 71 72 }; 72 73 73 74 static int msi_affinity_flag = 1; ··· 186 185 } 187 186 188 187 static const struct irq_domain_ops ls_scfg_msi_domain_ops = { 188 + .select = msi_lib_irq_domain_select, 189 189 .alloc = ls_scfg_msi_domain_irq_alloc, 190 190 .free = ls_scfg_msi_domain_irq_free, 191 191 }; ··· 216 214 217 215 static int ls_scfg_msi_domains_init(struct ls_scfg_msi *msi_data) 218 216 { 219 - /* Initialize MSI domain parent */ 220 - msi_data->parent = irq_domain_create_linear(NULL, 221 - msi_data->irqs_num, 222 - &ls_scfg_msi_domain_ops, 223 - msi_data); 224 - if (!msi_data->parent) { 225 - dev_err(&msi_data->pdev->dev, "failed to create IRQ domain\n"); 226 - return -ENOMEM; 227 - } 217 + struct irq_domain_info info = { 218 + .fwnode = of_fwnode_handle(msi_data->pdev->dev.of_node), 219 + .ops = &ls_scfg_msi_domain_ops, 220 + .host_data = msi_data, 221 + .size = msi_data->irqs_num, 222 + }; 228 223 229 - msi_data->msi_domain = pci_msi_create_irq_domain( 230 - of_fwnode_handle(msi_data->pdev->dev.of_node), 231 - &ls_scfg_msi_domain_info, 232 - msi_data->parent); 233 - if (!msi_data->msi_domain) { 224 + msi_data->parent = msi_create_parent_irq_domain(&info, &ls_scfg_msi_parent_ops); 225 + if (!msi_data->parent) { 234 226 dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n"); 235 227 irq_domain_remove(msi_data->parent); 236 228 return -ENOMEM; ··· 401 405 for (i = 0; i < msi_data->msir_num; i++) 402 406 ls_scfg_msi_teardown_hwirq(&msi_data->msir[i]); 403 407 404 - irq_domain_remove(msi_data->msi_domain); 405 408 irq_domain_remove(msi_data->parent); 406 409 407 410 platform_set_drvdata(pdev, NULL);