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

irqchip/armada-370-xp: 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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/976892e3ce64fcf52387833abee08ddfa47d2a82.1750860131.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Thomas Gleixner
bafb2901 7a91ad7e

+26 -23
+1
drivers/irqchip/Kconfig
··· 79 79 bool 80 80 select GENERIC_IRQ_CHIP 81 81 select PCI_MSI if PCI 82 + select IRQ_MSI_LIB if PCI 82 83 select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 83 84 84 85 config ALPINE_MSI
+25 -23
drivers/irqchip/irq-armada-370-xp.c
··· 20 20 #include <linux/interrupt.h> 21 21 #include <linux/irqchip.h> 22 22 #include <linux/irqchip/chained_irq.h> 23 + #include <linux/irqchip/irq-msi-lib.h> 23 24 #include <linux/cpu.h> 24 25 #include <linux/io.h> 25 26 #include <linux/of_address.h> ··· 157 156 * @parent_irq: parent IRQ if MPIC is not top-level interrupt controller 158 157 * @domain: MPIC main interrupt domain 159 158 * @ipi_domain: IPI domain 160 - * @msi_domain: MSI domain 161 159 * @msi_inner_domain: MSI inner domain 162 160 * @msi_used: bitmap of used MSI numbers 163 161 * @msi_lock: mutex serializing access to @msi_used ··· 176 176 struct irq_domain *ipi_domain; 177 177 #endif 178 178 #ifdef CONFIG_PCI_MSI 179 - struct irq_domain *msi_domain; 180 179 struct irq_domain *msi_inner_domain; 181 180 DECLARE_BITMAP(msi_used, PCI_MSI_FULL_DOORBELL_NR); 182 181 struct mutex msi_lock; ··· 232 233 } 233 234 234 235 #ifdef CONFIG_PCI_MSI 235 - 236 - static struct irq_chip mpic_msi_irq_chip = { 237 - .name = "MPIC MSI", 238 - .irq_mask = pci_msi_mask_irq, 239 - .irq_unmask = pci_msi_unmask_irq, 240 - }; 241 - 242 - static struct msi_domain_info mpic_msi_domain_info = { 243 - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | 244 - MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX), 245 - .chip = &mpic_msi_irq_chip, 246 - }; 247 236 248 237 static void mpic_compose_msi_msg(struct irq_data *d, struct msi_msg *msg) 249 238 { ··· 301 314 } 302 315 303 316 static const struct irq_domain_ops mpic_msi_domain_ops = { 317 + .select = msi_lib_irq_domain_select, 304 318 .alloc = mpic_msi_alloc, 305 319 .free = mpic_msi_free, 306 320 }; ··· 318 330 /* Unmask local doorbell interrupt */ 319 331 writel(1, mpic->per_cpu + MPIC_INT_CLEAR_MASK); 320 332 } 333 + 334 + #define MPIC_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ 335 + MSI_FLAG_USE_DEF_CHIP_OPS) 336 + #define MPIC_MSI_FLAGS_SUPPORTED (MSI_FLAG_MULTI_PCI_MSI | \ 337 + MSI_FLAG_PCI_MSIX | \ 338 + MSI_GENERIC_FLAGS_MASK) 339 + 340 + static const struct msi_parent_ops mpic_msi_parent_ops = { 341 + .required_flags = MPIC_MSI_FLAGS_REQUIRED, 342 + .supported_flags = MPIC_MSI_FLAGS_SUPPORTED, 343 + .bus_select_token = DOMAIN_BUS_NEXUS, 344 + .bus_select_mask = MATCH_PCI_MSI, 345 + .prefix = "MPIC-", 346 + .init_dev_msi_info = msi_lib_init_dev_msi_info, 347 + }; 321 348 322 349 static int __init mpic_msi_init(struct mpic *mpic, struct device_node *node, 323 350 phys_addr_t main_int_phys_base) ··· 351 348 mpic->msi_doorbell_mask = PCI_MSI_FULL_DOORBELL_MASK; 352 349 } 353 350 354 - mpic->msi_inner_domain = irq_domain_create_linear(NULL, mpic->msi_doorbell_size, 355 - &mpic_msi_domain_ops, mpic); 351 + struct irq_domain_info info = { 352 + .fwnode = of_fwnode_handle(node), 353 + .ops = &mpic_msi_domain_ops, 354 + .host_data = mpic, 355 + .size = mpic->msi_doorbell_size, 356 + }; 357 + 358 + mpic->msi_inner_domain = msi_create_parent_irq_domain(&info, &mpic_msi_parent_ops); 356 359 if (!mpic->msi_inner_domain) 357 360 return -ENOMEM; 358 - 359 - mpic->msi_domain = pci_msi_create_irq_domain(of_fwnode_handle(node), &mpic_msi_domain_info, 360 - mpic->msi_inner_domain); 361 - if (!mpic->msi_domain) { 362 - irq_domain_remove(mpic->msi_inner_domain); 363 - return -ENOMEM; 364 - } 365 361 366 362 mpic_msi_reenable_percpu(mpic); 367 363