2222#include <linux/iopoll.h>
2323#include <linux/irq.h>
2424#include <linux/irqchip/chained_irq.h>
25+ #include <linux/irqchip/irq-msi-lib.h>
2526#include <linux/irqdomain.h>
2627#include <linux/kernel.h>
2728#include <linux/init.h>
@@ -1547,7 +1548,7 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
15471548 unsigned int index = i * 32 + offset ;
15481549 int ret ;
15491550
1550- ret = generic_handle_domain_irq (msi -> domain -> parent , index );
1551+ ret = generic_handle_domain_irq (msi -> domain , index );
15511552 if (ret ) {
15521553 /*
15531554 * that's weird who triggered this?
@@ -1565,30 +1566,6 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
15651566 chained_irq_exit (chip , desc );
15661567}
15671568
1568- static void tegra_msi_top_irq_ack (struct irq_data * d )
1569- {
1570- irq_chip_ack_parent (d );
1571- }
1572-
1573- static void tegra_msi_top_irq_mask (struct irq_data * d )
1574- {
1575- pci_msi_mask_irq (d );
1576- irq_chip_mask_parent (d );
1577- }
1578-
1579- static void tegra_msi_top_irq_unmask (struct irq_data * d )
1580- {
1581- pci_msi_unmask_irq (d );
1582- irq_chip_unmask_parent (d );
1583- }
1584-
1585- static struct irq_chip tegra_msi_top_chip = {
1586- .name = "Tegra PCIe MSI" ,
1587- .irq_ack = tegra_msi_top_irq_ack ,
1588- .irq_mask = tegra_msi_top_irq_mask ,
1589- .irq_unmask = tegra_msi_top_irq_unmask ,
1590- };
1591-
15921569static void tegra_msi_irq_ack (struct irq_data * d )
15931570{
15941571 struct tegra_msi * msi = irq_data_get_irq_chip_data (d );
@@ -1690,42 +1667,40 @@ static const struct irq_domain_ops tegra_msi_domain_ops = {
16901667 .free = tegra_msi_domain_free ,
16911668};
16921669
1693- static struct msi_domain_info tegra_msi_info = {
1694- .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
1695- MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX ,
1696- .chip = & tegra_msi_top_chip ,
1670+ static const struct msi_parent_ops tegra_msi_parent_ops = {
1671+ .supported_flags = (MSI_GENERIC_FLAGS_MASK |
1672+ MSI_FLAG_PCI_MSIX ),
1673+ .required_flags = (MSI_FLAG_USE_DEF_DOM_OPS |
1674+ MSI_FLAG_USE_DEF_CHIP_OPS |
1675+ MSI_FLAG_PCI_MSI_MASK_PARENT |
1676+ MSI_FLAG_NO_AFFINITY ),
1677+ .chip_flags = MSI_CHIP_FLAG_SET_ACK ,
1678+ .bus_select_token = DOMAIN_BUS_PCI_MSI ,
1679+ .init_dev_msi_info = msi_lib_init_dev_msi_info ,
16971680};
16981681
16991682static int tegra_allocate_domains (struct tegra_msi * msi )
17001683{
17011684 struct tegra_pcie * pcie = msi_to_pcie (msi );
17021685 struct fwnode_handle * fwnode = dev_fwnode (pcie -> dev );
1703- struct irq_domain * parent ;
1704-
1705- parent = irq_domain_create_linear (fwnode , INT_PCI_MSI_NR ,
1706- & tegra_msi_domain_ops , msi );
1707- if (!parent ) {
1708- dev_err (pcie -> dev , "failed to create IRQ domain\n" );
1709- return - ENOMEM ;
1710- }
1711- irq_domain_update_bus_token (parent , DOMAIN_BUS_NEXUS );
1686+ struct irq_domain_info info = {
1687+ .fwnode = fwnode ,
1688+ .ops = & tegra_msi_domain_ops ,
1689+ .size = INT_PCI_MSI_NR ,
1690+ .host_data = msi ,
1691+ };
17121692
1713- msi -> domain = pci_msi_create_irq_domain ( fwnode , & tegra_msi_info , parent );
1693+ msi -> domain = msi_create_parent_irq_domain ( & info , & tegra_msi_parent_ops );
17141694 if (!msi -> domain ) {
17151695 dev_err (pcie -> dev , "failed to create MSI domain\n" );
1716- irq_domain_remove (parent );
17171696 return - ENOMEM ;
17181697 }
1719-
17201698 return 0 ;
17211699}
17221700
17231701static void tegra_free_domains (struct tegra_msi * msi )
17241702{
1725- struct irq_domain * parent = msi -> domain -> parent ;
1726-
17271703 irq_domain_remove (msi -> domain );
1728- irq_domain_remove (parent );
17291704}
17301705
17311706static int tegra_pcie_msi_setup (struct tegra_pcie * pcie )
0 commit comments