22
22
#include <linux/iopoll.h>
23
23
#include <linux/irq.h>
24
24
#include <linux/irqchip/chained_irq.h>
25
+ #include <linux/irqchip/irq-msi-lib.h>
25
26
#include <linux/irqdomain.h>
26
27
#include <linux/kernel.h>
27
28
#include <linux/init.h>
@@ -1547,7 +1548,7 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
1547
1548
unsigned int index = i * 32 + offset ;
1548
1549
int ret ;
1549
1550
1550
- ret = generic_handle_domain_irq (msi -> domain -> parent , index );
1551
+ ret = generic_handle_domain_irq (msi -> domain , index );
1551
1552
if (ret ) {
1552
1553
/*
1553
1554
* that's weird who triggered this?
@@ -1565,30 +1566,6 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
1565
1566
chained_irq_exit (chip , desc );
1566
1567
}
1567
1568
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
-
1592
1569
static void tegra_msi_irq_ack (struct irq_data * d )
1593
1570
{
1594
1571
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 = {
1690
1667
.free = tegra_msi_domain_free ,
1691
1668
};
1692
1669
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 ,
1697
1680
};
1698
1681
1699
1682
static int tegra_allocate_domains (struct tegra_msi * msi )
1700
1683
{
1701
1684
struct tegra_pcie * pcie = msi_to_pcie (msi );
1702
1685
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
+ };
1712
1692
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 );
1714
1694
if (!msi -> domain ) {
1715
1695
dev_err (pcie -> dev , "failed to create MSI domain\n" );
1716
- irq_domain_remove (parent );
1717
1696
return - ENOMEM ;
1718
1697
}
1719
-
1720
1698
return 0 ;
1721
1699
}
1722
1700
1723
1701
static void tegra_free_domains (struct tegra_msi * msi )
1724
1702
{
1725
- struct irq_domain * parent = msi -> domain -> parent ;
1726
-
1727
1703
irq_domain_remove (msi -> domain );
1728
- irq_domain_remove (parent );
1729
1704
}
1730
1705
1731
1706
static int tegra_pcie_msi_setup (struct tegra_pcie * pcie )
0 commit comments