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

PCI: aardvark: Switch to msi_create_parent_irq_domain()

Switch to msi_create_parent_irq_domain() from pci_msi_create_irq_domain()
which was using legacy MSI domain setup.

Signed-off-by: Nam Cao <namcao@linutronix.de>
[mani: reworded commit message]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
[bhelgaas: rebase on dev_fwnode() conversion]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/68b2f9387bbe4f08bcd428bfab83ad1219fb8d80.1750858083.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Bjorn Helgaas
75027704 0cb6d733

+23 -35
+1
drivers/pci/controller/Kconfig
··· 13 13 depends on OF 14 14 depends on PCI_MSI 15 15 select PCI_BRIDGE_EMUL 16 + select IRQ_MSI_LIB 16 17 help 17 18 Add support for Aardvark 64bit PCIe Host Controller. This 18 19 controller is part of the South Bridge of the Marvel Armada
+22 -35
drivers/pci/controller/pci-aardvark.c
··· 13 13 #include <linux/gpio/consumer.h> 14 14 #include <linux/interrupt.h> 15 15 #include <linux/irq.h> 16 + #include <linux/irqchip/irq-msi-lib.h> 16 17 #include <linux/irqdomain.h> 17 18 #include <linux/kernel.h> 18 19 #include <linux/module.h> ··· 279 278 struct irq_domain *irq_domain; 280 279 struct irq_chip irq_chip; 281 280 raw_spinlock_t irq_lock; 282 - struct irq_domain *msi_domain; 283 281 struct irq_domain *msi_inner_domain; 284 282 raw_spinlock_t msi_irq_lock; 285 283 DECLARE_BITMAP(msi_used, MSI_IRQ_NUM); ··· 1332 1332 raw_spin_unlock_irqrestore(&pcie->msi_irq_lock, flags); 1333 1333 } 1334 1334 1335 - static void advk_msi_top_irq_mask(struct irq_data *d) 1336 - { 1337 - pci_msi_mask_irq(d); 1338 - irq_chip_mask_parent(d); 1339 - } 1340 - 1341 - static void advk_msi_top_irq_unmask(struct irq_data *d) 1342 - { 1343 - pci_msi_unmask_irq(d); 1344 - irq_chip_unmask_parent(d); 1345 - } 1346 - 1347 1335 static struct irq_chip advk_msi_bottom_irq_chip = { 1348 1336 .name = "MSI", 1349 1337 .irq_compose_msi_msg = advk_msi_irq_compose_msi_msg, ··· 1424 1436 .xlate = irq_domain_xlate_onecell, 1425 1437 }; 1426 1438 1427 - static struct irq_chip advk_msi_irq_chip = { 1428 - .name = "advk-MSI", 1429 - .irq_mask = advk_msi_top_irq_mask, 1430 - .irq_unmask = advk_msi_top_irq_unmask, 1431 - }; 1439 + #define ADVK_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ 1440 + MSI_FLAG_USE_DEF_CHIP_OPS | \ 1441 + MSI_FLAG_PCI_MSI_MASK_PARENT | \ 1442 + MSI_FLAG_NO_AFFINITY) 1443 + #define ADVK_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ 1444 + MSI_FLAG_PCI_MSIX | \ 1445 + MSI_FLAG_MULTI_PCI_MSI) 1432 1446 1433 - static struct msi_domain_info advk_msi_domain_info = { 1434 - .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | 1435 - MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI | 1436 - MSI_FLAG_PCI_MSIX, 1437 - .chip = &advk_msi_irq_chip, 1447 + static const struct msi_parent_ops advk_msi_parent_ops = { 1448 + .required_flags = ADVK_MSI_FLAGS_REQUIRED, 1449 + .supported_flags = ADVK_MSI_FLAGS_SUPPORTED, 1450 + .bus_select_token = DOMAIN_BUS_PCI_MSI, 1451 + .prefix = "advk-", 1452 + .init_dev_msi_info = msi_lib_init_dev_msi_info, 1438 1453 }; 1439 1454 1440 1455 static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie) ··· 1447 1456 raw_spin_lock_init(&pcie->msi_irq_lock); 1448 1457 mutex_init(&pcie->msi_used_lock); 1449 1458 1450 - pcie->msi_inner_domain = irq_domain_create_linear(NULL, MSI_IRQ_NUM, 1451 - &advk_msi_domain_ops, pcie); 1459 + struct irq_domain_info info = { 1460 + .fwnode = dev_fwnode(dev), 1461 + .ops = &advk_msi_domain_ops, 1462 + .host_data = pcie, 1463 + .size = MSI_IRQ_NUM, 1464 + }; 1465 + 1466 + pcie->msi_inner_domain = msi_create_parent_irq_domain(&info, &advk_msi_parent_ops); 1452 1467 if (!pcie->msi_inner_domain) 1453 1468 return -ENOMEM; 1454 - 1455 - pcie->msi_domain = 1456 - pci_msi_create_irq_domain(dev_fwnode(dev), 1457 - &advk_msi_domain_info, 1458 - pcie->msi_inner_domain); 1459 - if (!pcie->msi_domain) { 1460 - irq_domain_remove(pcie->msi_inner_domain); 1461 - return -ENOMEM; 1462 - } 1463 1469 1464 1470 return 0; 1465 1471 } 1466 1472 1467 1473 static void advk_pcie_remove_msi_irq_domain(struct advk_pcie *pcie) 1468 1474 { 1469 - irq_domain_remove(pcie->msi_domain); 1470 1475 irq_domain_remove(pcie->msi_inner_domain); 1471 1476 } 1472 1477