Commit b584fa1f authored by Bharat Kumar Gogada's avatar Bharat Kumar Gogada Committed by Bjorn Helgaas

PCI: xilinx: Keep both legacy and MSI interrupt domain references

When built with MSI support, the legacy domain reference was being
overwritten with MSI.

Create two separate domains for MSI and legacy interrupts.
Signed-off-by: default avatarBharat Kumar Gogada <bharatku@xilinx.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent f665bd15
...@@ -101,7 +101,8 @@ ...@@ -101,7 +101,8 @@
* @msi_pages: MSI pages * @msi_pages: MSI pages
* @root_busno: Root Bus number * @root_busno: Root Bus number
* @dev: Device pointer * @dev: Device pointer
* @irq_domain: IRQ domain pointer * @msi_domain: MSI IRQ domain pointer
* @leg_domain: Legacy IRQ domain pointer
* @resources: Bus Resources * @resources: Bus Resources
*/ */
struct xilinx_pcie_port { struct xilinx_pcie_port {
...@@ -110,7 +111,8 @@ struct xilinx_pcie_port { ...@@ -110,7 +111,8 @@ struct xilinx_pcie_port {
unsigned long msi_pages; unsigned long msi_pages;
u8 root_busno; u8 root_busno;
struct device *dev; struct device *dev;
struct irq_domain *irq_domain; struct irq_domain *msi_domain;
struct irq_domain *leg_domain;
struct list_head resources; struct list_head resources;
}; };
...@@ -281,7 +283,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip, ...@@ -281,7 +283,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip,
if (hwirq < 0) if (hwirq < 0)
return hwirq; return hwirq;
irq = irq_create_mapping(port->irq_domain, hwirq); irq = irq_create_mapping(port->msi_domain, hwirq);
if (!irq) if (!irq)
return -EINVAL; return -EINVAL;
...@@ -443,7 +445,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data) ...@@ -443,7 +445,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
/* Handle INTx Interrupt */ /* Handle INTx Interrupt */
val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >> val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1; XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
generic_handle_irq(irq_find_mapping(port->irq_domain, generic_handle_irq(irq_find_mapping(port->leg_domain,
val)); val));
} }
} }
...@@ -526,12 +528,14 @@ static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port) ...@@ -526,12 +528,14 @@ static void xilinx_pcie_free_irq_domain(struct xilinx_pcie_port *port)
} }
for (i = 0; i < num_irqs; i++) { for (i = 0; i < num_irqs; i++) {
irq = irq_find_mapping(port->irq_domain, i); irq = irq_find_mapping(port->leg_domain, i);
if (irq > 0) if (irq > 0)
irq_dispose_mapping(irq); irq_dispose_mapping(irq);
} }
if (port->leg_domain)
irq_domain_remove(port->irq_domain); irq_domain_remove(port->leg_domain);
if (port->msi_domain)
irq_domain_remove(port->msi_domain);
} }
/** /**
...@@ -553,21 +557,21 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port) ...@@ -553,21 +557,21 @@ static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
return -ENODEV; return -ENODEV;
} }
port->irq_domain = irq_domain_add_linear(pcie_intc_node, 4, port->leg_domain = irq_domain_add_linear(pcie_intc_node, 4,
&intx_domain_ops, &intx_domain_ops,
port); port);
if (!port->irq_domain) { if (!port->leg_domain) {
dev_err(dev, "Failed to get a INTx IRQ domain\n"); dev_err(dev, "Failed to get a INTx IRQ domain\n");
return -ENODEV; return -ENODEV;
} }
/* Setup MSI */ /* Setup MSI */
if (IS_ENABLED(CONFIG_PCI_MSI)) { if (IS_ENABLED(CONFIG_PCI_MSI)) {
port->irq_domain = irq_domain_add_linear(node, port->msi_domain = irq_domain_add_linear(node,
XILINX_NUM_MSI_IRQS, XILINX_NUM_MSI_IRQS,
&msi_domain_ops, &msi_domain_ops,
&xilinx_pcie_msi_chip); &xilinx_pcie_msi_chip);
if (!port->irq_domain) { if (!port->msi_domain) {
dev_err(dev, "Failed to get a MSI IRQ domain\n"); dev_err(dev, "Failed to get a MSI IRQ domain\n");
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment