Merge branch 'pci/irq'

- Convert irq_find_mapping() + generic_handle_irq() to
  generic_handle_domain_irq() (Marc Zyngier)

* pci/irq:
  PCI: Bulk conversion to generic_handle_domain_irq()
This commit is contained in:
Bjorn Helgaas 2021-09-02 14:56:42 -05:00
commit 03816e7f78
21 changed files with 76 additions and 128 deletions

View File

@ -204,7 +204,7 @@ static int dra7xx_pcie_handle_msi(struct pcie_port *pp, int index)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
unsigned long val; unsigned long val;
int pos, irq; int pos;
val = dw_pcie_readl_dbi(pci, PCIE_MSI_INTR0_STATUS + val = dw_pcie_readl_dbi(pci, PCIE_MSI_INTR0_STATUS +
(index * MSI_REG_CTRL_BLOCK_SIZE)); (index * MSI_REG_CTRL_BLOCK_SIZE));
@ -213,9 +213,8 @@ static int dra7xx_pcie_handle_msi(struct pcie_port *pp, int index)
pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, 0); pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, 0);
while (pos != MAX_MSI_IRQS_PER_CTRL) { while (pos != MAX_MSI_IRQS_PER_CTRL) {
irq = irq_find_mapping(pp->irq_domain, generic_handle_domain_irq(pp->irq_domain,
(index * MAX_MSI_IRQS_PER_CTRL) + pos); (index * MAX_MSI_IRQS_PER_CTRL) + pos);
generic_handle_irq(irq);
pos++; pos++;
pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, pos); pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, pos);
} }
@ -257,7 +256,7 @@ static void dra7xx_pcie_msi_irq_handler(struct irq_desc *desc)
struct dw_pcie *pci; struct dw_pcie *pci;
struct pcie_port *pp; struct pcie_port *pp;
unsigned long reg; unsigned long reg;
u32 virq, bit; u32 bit;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
@ -276,11 +275,8 @@ static void dra7xx_pcie_msi_irq_handler(struct irq_desc *desc)
case INTB: case INTB:
case INTC: case INTC:
case INTD: case INTD:
for_each_set_bit(bit, &reg, PCI_NUM_INTX) { for_each_set_bit(bit, &reg, PCI_NUM_INTX)
virq = irq_find_mapping(dra7xx->irq_domain, bit); generic_handle_domain_irq(dra7xx->irq_domain, bit);
if (virq)
generic_handle_irq(virq);
}
break; break;
} }

View File

@ -259,14 +259,12 @@ static void ks_pcie_handle_legacy_irq(struct keystone_pcie *ks_pcie,
struct dw_pcie *pci = ks_pcie->pci; struct dw_pcie *pci = ks_pcie->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
u32 pending; u32 pending;
int virq;
pending = ks_pcie_app_readl(ks_pcie, IRQ_STATUS(offset)); pending = ks_pcie_app_readl(ks_pcie, IRQ_STATUS(offset));
if (BIT(0) & pending) { if (BIT(0) & pending) {
virq = irq_linear_revmap(ks_pcie->legacy_irq_domain, offset); dev_dbg(dev, ": irq: irq_offset %d", offset);
dev_dbg(dev, ": irq: irq_offset %d, virq %d\n", offset, virq); generic_handle_domain_irq(ks_pcie->legacy_irq_domain, offset);
generic_handle_irq(virq);
} }
/* EOI the INTx interrupt */ /* EOI the INTx interrupt */
@ -579,7 +577,7 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc)
struct pcie_port *pp = &pci->pp; struct pcie_port *pp = &pci->pp;
struct device *dev = pci->dev; struct device *dev = pci->dev;
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
u32 vector, virq, reg, pos; u32 vector, reg, pos;
dev_dbg(dev, "%s, irq %d\n", __func__, irq); dev_dbg(dev, "%s, irq %d\n", __func__, irq);
@ -600,10 +598,8 @@ static void ks_pcie_msi_irq_handler(struct irq_desc *desc)
continue; continue;
vector = offset + (pos << 3); vector = offset + (pos << 3);
virq = irq_linear_revmap(pp->irq_domain, vector); dev_dbg(dev, "irq: bit %d, vector %d\n", pos, vector);
dev_dbg(dev, "irq: bit %d, vector %d, virq %d\n", pos, vector, generic_handle_domain_irq(pp->irq_domain, vector);
virq);
generic_handle_irq(virq);
} }
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);

View File

@ -55,7 +55,7 @@ static struct msi_domain_info dw_pcie_msi_domain_info = {
/* MSI int handler */ /* MSI int handler */
irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
{ {
int i, pos, irq; int i, pos;
unsigned long val; unsigned long val;
u32 status, num_ctrls; u32 status, num_ctrls;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
@ -74,10 +74,9 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
pos = 0; pos = 0;
while ((pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, while ((pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL,
pos)) != MAX_MSI_IRQS_PER_CTRL) { pos)) != MAX_MSI_IRQS_PER_CTRL) {
irq = irq_find_mapping(pp->irq_domain, generic_handle_domain_irq(pp->irq_domain,
(i * MAX_MSI_IRQS_PER_CTRL) + (i * MAX_MSI_IRQS_PER_CTRL) +
pos); pos);
generic_handle_irq(irq);
pos++; pos++;
} }
} }

View File

@ -235,7 +235,7 @@ static void uniphier_pcie_irq_handler(struct irq_desc *desc)
struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci); struct uniphier_pcie_priv *priv = to_uniphier_pcie(pci);
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned long reg; unsigned long reg;
u32 val, bit, virq; u32 val, bit;
/* INT for debug */ /* INT for debug */
val = readl(priv->base + PCL_RCV_INT); val = readl(priv->base + PCL_RCV_INT);
@ -257,10 +257,8 @@ static void uniphier_pcie_irq_handler(struct irq_desc *desc)
val = readl(priv->base + PCL_RCV_INTX); val = readl(priv->base + PCL_RCV_INTX);
reg = FIELD_GET(PCL_RCV_INTX_ALL_STATUS, val); reg = FIELD_GET(PCL_RCV_INTX_ALL_STATUS, val);
for_each_set_bit(bit, &reg, PCI_NUM_INTX) { for_each_set_bit(bit, &reg, PCI_NUM_INTX)
virq = irq_linear_revmap(priv->legacy_irq_domain, bit); generic_handle_domain_irq(priv->legacy_irq_domain, bit);
generic_handle_irq(virq);
}
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }

View File

@ -92,7 +92,7 @@ static void mobiveil_pcie_isr(struct irq_desc *desc)
u32 msi_data, msi_addr_lo, msi_addr_hi; u32 msi_data, msi_addr_lo, msi_addr_hi;
u32 intr_status, msi_status; u32 intr_status, msi_status;
unsigned long shifted_status; unsigned long shifted_status;
u32 bit, virq, val, mask; u32 bit, val, mask;
/* /*
* The core provides a single interrupt for both INTx/MSI messages. * The core provides a single interrupt for both INTx/MSI messages.
@ -114,11 +114,10 @@ static void mobiveil_pcie_isr(struct irq_desc *desc)
shifted_status >>= PAB_INTX_START; shifted_status >>= PAB_INTX_START;
do { do {
for_each_set_bit(bit, &shifted_status, PCI_NUM_INTX) { for_each_set_bit(bit, &shifted_status, PCI_NUM_INTX) {
virq = irq_find_mapping(rp->intx_domain, int ret;
bit + 1); ret = generic_handle_domain_irq(rp->intx_domain,
if (virq) bit + 1);
generic_handle_irq(virq); if (ret)
else
dev_err_ratelimited(dev, "unexpected IRQ, INT%d\n", dev_err_ratelimited(dev, "unexpected IRQ, INT%d\n",
bit); bit);
@ -155,9 +154,7 @@ static void mobiveil_pcie_isr(struct irq_desc *desc)
dev_dbg(dev, "MSI registers, data: %08x, addr: %08x:%08x\n", dev_dbg(dev, "MSI registers, data: %08x, addr: %08x:%08x\n",
msi_data, msi_addr_hi, msi_addr_lo); msi_data, msi_addr_hi, msi_addr_lo);
virq = irq_find_mapping(msi->dev_domain, msi_data); generic_handle_domain_irq(msi->dev_domain, msi_data);
if (virq)
generic_handle_irq(virq);
msi_status = readl_relaxed(pcie->apb_csr_base + msi_status = readl_relaxed(pcie->apb_csr_base +
MSI_STATUS_OFFSET); MSI_STATUS_OFFSET);

View File

@ -1049,7 +1049,7 @@ static void advk_pcie_handle_int(struct advk_pcie *pcie)
{ {
u32 isr0_val, isr0_mask, isr0_status; u32 isr0_val, isr0_mask, isr0_status;
u32 isr1_val, isr1_mask, isr1_status; u32 isr1_val, isr1_mask, isr1_status;
int i, virq; int i;
isr0_val = advk_readl(pcie, PCIE_ISR0_REG); isr0_val = advk_readl(pcie, PCIE_ISR0_REG);
isr0_mask = advk_readl(pcie, PCIE_ISR0_MASK_REG); isr0_mask = advk_readl(pcie, PCIE_ISR0_MASK_REG);
@ -1077,8 +1077,7 @@ static void advk_pcie_handle_int(struct advk_pcie *pcie)
advk_writel(pcie, PCIE_ISR1_INTX_ASSERT(i), advk_writel(pcie, PCIE_ISR1_INTX_ASSERT(i),
PCIE_ISR1_REG); PCIE_ISR1_REG);
virq = irq_find_mapping(pcie->irq_domain, i); generic_handle_domain_irq(pcie->irq_domain, i);
generic_handle_irq(virq);
} }
} }

View File

@ -314,7 +314,7 @@ static void faraday_pci_irq_handler(struct irq_desc *desc)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if ((irq_stat & BIT(i)) == 0) if ((irq_stat & BIT(i)) == 0)
continue; continue;
generic_handle_irq(irq_find_mapping(p->irqdomain, i)); generic_handle_domain_irq(p->irqdomain, i);
} }
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);

View File

@ -1553,12 +1553,10 @@ static void tegra_pcie_msi_irq(struct irq_desc *desc)
while (reg) { while (reg) {
unsigned int offset = find_first_bit(&reg, 32); unsigned int offset = find_first_bit(&reg, 32);
unsigned int index = i * 32 + offset; unsigned int index = i * 32 + offset;
unsigned int irq; int ret;
irq = irq_find_mapping(msi->domain->parent, index); ret = generic_handle_domain_irq(msi->domain->parent, index);
if (irq) { if (ret) {
generic_handle_irq(irq);
} else {
/* /*
* that's weird who triggered this? * that's weird who triggered this?
* just clear it * just clear it

View File

@ -291,8 +291,7 @@ static void xgene_msi_isr(struct irq_desc *desc)
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct xgene_msi_group *msi_groups; struct xgene_msi_group *msi_groups;
struct xgene_msi *xgene_msi; struct xgene_msi *xgene_msi;
unsigned int virq; int msir_index, msir_val, hw_irq, ret;
int msir_index, msir_val, hw_irq;
u32 intr_index, grp_select, msi_grp; u32 intr_index, grp_select, msi_grp;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
@ -330,10 +329,8 @@ static void xgene_msi_isr(struct irq_desc *desc)
* CPU0 * CPU0
*/ */
hw_irq = hwirq_to_canonical_hwirq(hw_irq); hw_irq = hwirq_to_canonical_hwirq(hw_irq);
virq = irq_find_mapping(xgene_msi->inner_domain, hw_irq); ret = generic_handle_domain_irq(xgene_msi->inner_domain, hw_irq);
WARN_ON(!virq); WARN_ON_ONCE(ret);
if (virq != 0)
generic_handle_irq(virq);
msir_val &= ~(1 << intr_index); msir_val &= ~(1 << intr_index);
} }
grp_select &= ~(1 << msir_index); grp_select &= ~(1 << msir_index);

View File

@ -55,7 +55,7 @@ static void altera_msi_isr(struct irq_desc *desc)
struct altera_msi *msi; struct altera_msi *msi;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq; int ret;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
msi = irq_desc_get_handler_data(desc); msi = irq_desc_get_handler_data(desc);
@ -65,11 +65,9 @@ static void altera_msi_isr(struct irq_desc *desc)
/* Dummy read from vector to clear the interrupt */ /* Dummy read from vector to clear the interrupt */
readl_relaxed(msi->vector_base + (bit * sizeof(u32))); readl_relaxed(msi->vector_base + (bit * sizeof(u32)));
virq = irq_find_mapping(msi->inner_domain, bit); ret = generic_handle_domain_irq(msi->inner_domain, bit);
if (virq) if (ret)
generic_handle_irq(virq); dev_err_ratelimited(&msi->pdev->dev, "unexpected MSI\n");
else
dev_err(&msi->pdev->dev, "unexpected MSI\n");
} }
} }

View File

@ -646,7 +646,7 @@ static void altera_pcie_isr(struct irq_desc *desc)
struct device *dev; struct device *dev;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq; int ret;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
pcie = irq_desc_get_handler_data(desc); pcie = irq_desc_get_handler_data(desc);
@ -658,11 +658,9 @@ static void altera_pcie_isr(struct irq_desc *desc)
/* clear interrupts */ /* clear interrupts */
cra_writel(pcie, 1 << bit, P2A_INT_STATUS); cra_writel(pcie, 1 << bit, P2A_INT_STATUS);
virq = irq_find_mapping(pcie->irq_domain, bit); ret = generic_handle_domain_irq(pcie->irq_domain, bit);
if (virq) if (ret)
generic_handle_irq(virq); dev_err_ratelimited(dev, "unexpected IRQ, INT%d\n", bit);
else
dev_err(dev, "unexpected IRQ, INT%d\n", bit);
} }
} }

View File

@ -476,7 +476,7 @@ static struct msi_domain_info brcm_msi_domain_info = {
static void brcm_pcie_msi_isr(struct irq_desc *desc) static void brcm_pcie_msi_isr(struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned long status, virq; unsigned long status;
struct brcm_msi *msi; struct brcm_msi *msi;
struct device *dev; struct device *dev;
u32 bit; u32 bit;
@ -489,10 +489,9 @@ static void brcm_pcie_msi_isr(struct irq_desc *desc)
status >>= msi->legacy_shift; status >>= msi->legacy_shift;
for_each_set_bit(bit, &status, msi->nr) { for_each_set_bit(bit, &status, msi->nr) {
virq = irq_find_mapping(msi->inner_domain, bit); int ret;
if (virq) ret = generic_handle_domain_irq(msi->inner_domain, bit);
generic_handle_irq(virq); if (ret)
else
dev_dbg(dev, "unexpected MSI\n"); dev_dbg(dev, "unexpected MSI\n");
} }

View File

@ -326,7 +326,6 @@ static void iproc_msi_handler(struct irq_desc *desc)
struct iproc_msi *msi; struct iproc_msi *msi;
u32 eq, head, tail, nr_events; u32 eq, head, tail, nr_events;
unsigned long hwirq; unsigned long hwirq;
int virq;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
@ -362,8 +361,7 @@ static void iproc_msi_handler(struct irq_desc *desc)
/* process all outstanding events */ /* process all outstanding events */
while (nr_events--) { while (nr_events--) {
hwirq = decode_msi_hwirq(msi, eq, head); hwirq = decode_msi_hwirq(msi, eq, head);
virq = irq_find_mapping(msi->inner_domain, hwirq); generic_handle_domain_irq(msi->inner_domain, hwirq);
generic_handle_irq(virq);
head++; head++;
head %= EQ_LEN; head %= EQ_LEN;

View File

@ -645,7 +645,6 @@ static void mtk_pcie_msi_handler(struct mtk_pcie_port *port, int set_idx)
{ {
struct mtk_msi_set *msi_set = &port->msi_sets[set_idx]; struct mtk_msi_set *msi_set = &port->msi_sets[set_idx];
unsigned long msi_enable, msi_status; unsigned long msi_enable, msi_status;
unsigned int virq;
irq_hw_number_t bit, hwirq; irq_hw_number_t bit, hwirq;
msi_enable = readl_relaxed(msi_set->base + PCIE_MSI_SET_ENABLE_OFFSET); msi_enable = readl_relaxed(msi_set->base + PCIE_MSI_SET_ENABLE_OFFSET);
@ -659,8 +658,7 @@ static void mtk_pcie_msi_handler(struct mtk_pcie_port *port, int set_idx)
for_each_set_bit(bit, &msi_status, PCIE_MSI_IRQS_PER_SET) { for_each_set_bit(bit, &msi_status, PCIE_MSI_IRQS_PER_SET) {
hwirq = bit + set_idx * PCIE_MSI_IRQS_PER_SET; hwirq = bit + set_idx * PCIE_MSI_IRQS_PER_SET;
virq = irq_find_mapping(port->msi_bottom_domain, hwirq); generic_handle_domain_irq(port->msi_bottom_domain, hwirq);
generic_handle_irq(virq);
} }
} while (true); } while (true);
} }
@ -670,18 +668,15 @@ static void mtk_pcie_irq_handler(struct irq_desc *desc)
struct mtk_pcie_port *port = irq_desc_get_handler_data(desc); struct mtk_pcie_port *port = irq_desc_get_handler_data(desc);
struct irq_chip *irqchip = irq_desc_get_chip(desc); struct irq_chip *irqchip = irq_desc_get_chip(desc);
unsigned long status; unsigned long status;
unsigned int virq;
irq_hw_number_t irq_bit = PCIE_INTX_SHIFT; irq_hw_number_t irq_bit = PCIE_INTX_SHIFT;
chained_irq_enter(irqchip, desc); chained_irq_enter(irqchip, desc);
status = readl_relaxed(port->base + PCIE_INT_STATUS_REG); status = readl_relaxed(port->base + PCIE_INT_STATUS_REG);
for_each_set_bit_from(irq_bit, &status, PCI_NUM_INTX + for_each_set_bit_from(irq_bit, &status, PCI_NUM_INTX +
PCIE_INTX_SHIFT) { PCIE_INTX_SHIFT)
virq = irq_find_mapping(port->intx_domain, generic_handle_domain_irq(port->intx_domain,
irq_bit - PCIE_INTX_SHIFT); irq_bit - PCIE_INTX_SHIFT);
generic_handle_irq(virq);
}
irq_bit = PCIE_MSI_SHIFT; irq_bit = PCIE_MSI_SHIFT;
for_each_set_bit_from(irq_bit, &status, PCIE_MSI_SET_NUM + for_each_set_bit_from(irq_bit, &status, PCIE_MSI_SET_NUM +

View File

@ -602,7 +602,6 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
struct mtk_pcie_port *port = irq_desc_get_handler_data(desc); struct mtk_pcie_port *port = irq_desc_get_handler_data(desc);
struct irq_chip *irqchip = irq_desc_get_chip(desc); struct irq_chip *irqchip = irq_desc_get_chip(desc);
unsigned long status; unsigned long status;
u32 virq;
u32 bit = INTX_SHIFT; u32 bit = INTX_SHIFT;
chained_irq_enter(irqchip, desc); chained_irq_enter(irqchip, desc);
@ -612,9 +611,8 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
for_each_set_bit_from(bit, &status, PCI_NUM_INTX + INTX_SHIFT) { for_each_set_bit_from(bit, &status, PCI_NUM_INTX + INTX_SHIFT) {
/* Clear the INTx */ /* Clear the INTx */
writel(1 << bit, port->base + PCIE_INT_STATUS); writel(1 << bit, port->base + PCIE_INT_STATUS);
virq = irq_find_mapping(port->irq_domain, generic_handle_domain_irq(port->irq_domain,
bit - INTX_SHIFT); bit - INTX_SHIFT);
generic_handle_irq(virq);
} }
} }
@ -623,10 +621,8 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
unsigned long imsi_status; unsigned long imsi_status;
while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) { while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) {
for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM) { for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM)
virq = irq_find_mapping(port->inner_domain, bit); generic_handle_domain_irq(port->inner_domain, bit);
generic_handle_irq(virq);
}
} }
/* Clear MSI interrupt status */ /* Clear MSI interrupt status */
writel(MSI_STATUS, port->base + PCIE_INT_STATUS); writel(MSI_STATUS, port->base + PCIE_INT_STATUS);

View File

@ -412,16 +412,14 @@ static void mc_handle_msi(struct irq_desc *desc)
port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq; int ret;
status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL);
if (status & PM_MSI_INT_MSI_MASK) { if (status & PM_MSI_INT_MSI_MASK) {
status = readl_relaxed(bridge_base_addr + ISTATUS_MSI); status = readl_relaxed(bridge_base_addr + ISTATUS_MSI);
for_each_set_bit(bit, &status, msi->num_vectors) { for_each_set_bit(bit, &status, msi->num_vectors) {
virq = irq_find_mapping(msi->dev_domain, bit); ret = generic_handle_domain_irq(msi->dev_domain, bit);
if (virq) if (ret)
generic_handle_irq(virq);
else
dev_err_ratelimited(dev, "bad MSI IRQ %d\n", dev_err_ratelimited(dev, "bad MSI IRQ %d\n",
bit); bit);
} }
@ -570,17 +568,15 @@ static void mc_handle_intx(struct irq_desc *desc)
port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq; int ret;
status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL);
if (status & PM_MSI_INT_INTX_MASK) { if (status & PM_MSI_INT_INTX_MASK) {
status &= PM_MSI_INT_INTX_MASK; status &= PM_MSI_INT_INTX_MASK;
status >>= PM_MSI_INT_INTX_SHIFT; status >>= PM_MSI_INT_INTX_SHIFT;
for_each_set_bit(bit, &status, PCI_NUM_INTX) { for_each_set_bit(bit, &status, PCI_NUM_INTX) {
virq = irq_find_mapping(port->intx_domain, bit); ret = generic_handle_domain_irq(port->intx_domain, bit);
if (virq) if (ret)
generic_handle_irq(virq);
else
dev_err_ratelimited(dev, "bad INTx IRQ %d\n", dev_err_ratelimited(dev, "bad INTx IRQ %d\n",
bit); bit);
} }
@ -745,7 +741,7 @@ static void mc_handle_event(struct irq_desc *desc)
events = get_events(port); events = get_events(port);
for_each_set_bit(bit, &events, NUM_EVENTS) for_each_set_bit(bit, &events, NUM_EVENTS)
generic_handle_irq(irq_find_mapping(port->event_domain, bit)); generic_handle_domain_irq(port->event_domain, bit);
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }

View File

@ -486,12 +486,10 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
while (reg) { while (reg) {
unsigned int index = find_first_bit(&reg, 32); unsigned int index = find_first_bit(&reg, 32);
unsigned int msi_irq; int ret;
msi_irq = irq_find_mapping(msi->domain->parent, index); ret = generic_handle_domain_irq(msi->domain->parent, index);
if (msi_irq) { if (ret) {
generic_handle_irq(msi_irq);
} else {
/* Unknown MSI, just clear it */ /* Unknown MSI, just clear it */
dev_dbg(dev, "unexpected MSI\n"); dev_dbg(dev, "unexpected MSI\n");
rcar_pci_write_reg(pcie, BIT(index), PCIEMSIFR); rcar_pci_write_reg(pcie, BIT(index), PCIEMSIFR);

View File

@ -517,7 +517,7 @@ static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc)
struct device *dev = rockchip->dev; struct device *dev = rockchip->dev;
u32 reg; u32 reg;
u32 hwirq; u32 hwirq;
u32 virq; int ret;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
@ -528,10 +528,8 @@ static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc)
hwirq = ffs(reg) - 1; hwirq = ffs(reg) - 1;
reg &= ~BIT(hwirq); reg &= ~BIT(hwirq);
virq = irq_find_mapping(rockchip->irq_domain, hwirq); ret = generic_handle_domain_irq(rockchip->irq_domain, hwirq);
if (virq) if (ret)
generic_handle_irq(virq);
else
dev_err(dev, "unexpected IRQ, INT%d\n", hwirq); dev_err(dev, "unexpected IRQ, INT%d\n", hwirq);
} }

View File

@ -222,7 +222,7 @@ static void xilinx_cpm_pcie_intx_flow(struct irq_desc *desc)
pcie_read(port, XILINX_CPM_PCIE_REG_IDRN)); pcie_read(port, XILINX_CPM_PCIE_REG_IDRN));
for_each_set_bit(i, &val, PCI_NUM_INTX) for_each_set_bit(i, &val, PCI_NUM_INTX)
generic_handle_irq(irq_find_mapping(port->intx_domain, i)); generic_handle_domain_irq(port->intx_domain, i);
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }
@ -282,7 +282,7 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc)
val = pcie_read(port, XILINX_CPM_PCIE_REG_IDR); val = pcie_read(port, XILINX_CPM_PCIE_REG_IDR);
val &= pcie_read(port, XILINX_CPM_PCIE_REG_IMR); val &= pcie_read(port, XILINX_CPM_PCIE_REG_IMR);
for_each_set_bit(i, &val, 32) for_each_set_bit(i, &val, 32)
generic_handle_irq(irq_find_mapping(port->cpm_domain, i)); generic_handle_domain_irq(port->cpm_domain, i);
pcie_write(port, val, XILINX_CPM_PCIE_REG_IDR); pcie_write(port, val, XILINX_CPM_PCIE_REG_IDR);
/* /*

View File

@ -318,18 +318,14 @@ static void nwl_pcie_leg_handler(struct irq_desc *desc)
struct nwl_pcie *pcie; struct nwl_pcie *pcie;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
pcie = irq_desc_get_handler_data(desc); pcie = irq_desc_get_handler_data(desc);
while ((status = nwl_bridge_readl(pcie, MSGF_LEG_STATUS) & while ((status = nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
MSGF_LEG_SR_MASKALL) != 0) { MSGF_LEG_SR_MASKALL) != 0) {
for_each_set_bit(bit, &status, PCI_NUM_INTX) { for_each_set_bit(bit, &status, PCI_NUM_INTX)
virq = irq_find_mapping(pcie->legacy_irq_domain, bit); generic_handle_domain_irq(pcie->legacy_irq_domain, bit);
if (virq)
generic_handle_irq(virq);
}
} }
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
@ -340,16 +336,13 @@ static void nwl_pcie_handle_msi_irq(struct nwl_pcie *pcie, u32 status_reg)
struct nwl_msi *msi; struct nwl_msi *msi;
unsigned long status; unsigned long status;
u32 bit; u32 bit;
u32 virq;
msi = &pcie->msi; msi = &pcie->msi;
while ((status = nwl_bridge_readl(pcie, status_reg)) != 0) { while ((status = nwl_bridge_readl(pcie, status_reg)) != 0) {
for_each_set_bit(bit, &status, 32) { for_each_set_bit(bit, &status, 32) {
nwl_bridge_writel(pcie, 1 << bit, status_reg); nwl_bridge_writel(pcie, 1 << bit, status_reg);
virq = irq_find_mapping(msi->dev_domain, bit); generic_handle_domain_irq(msi->dev_domain, bit);
if (virq)
generic_handle_irq(virq);
} }
} }
} }

View File

@ -385,7 +385,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
} }
if (status & (XILINX_PCIE_INTR_INTX | XILINX_PCIE_INTR_MSI)) { if (status & (XILINX_PCIE_INTR_INTX | XILINX_PCIE_INTR_MSI)) {
unsigned int irq; struct irq_domain *domain;
val = pcie_read(port, XILINX_PCIE_REG_RPIFR1); val = pcie_read(port, XILINX_PCIE_REG_RPIFR1);
@ -399,19 +399,18 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
if (val & XILINX_PCIE_RPIFR1_MSI_INTR) { if (val & XILINX_PCIE_RPIFR1_MSI_INTR) {
val = pcie_read(port, XILINX_PCIE_REG_RPIFR2) & val = pcie_read(port, XILINX_PCIE_REG_RPIFR2) &
XILINX_PCIE_RPIFR2_MSG_DATA; XILINX_PCIE_RPIFR2_MSG_DATA;
irq = irq_find_mapping(port->msi_domain->parent, val); domain = port->msi_domain->parent;
} else { } else {
val = (val & XILINX_PCIE_RPIFR1_INTR_MASK) >> val = (val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
XILINX_PCIE_RPIFR1_INTR_SHIFT; XILINX_PCIE_RPIFR1_INTR_SHIFT;
irq = irq_find_mapping(port->leg_domain, val); domain = port->leg_domain;
} }
/* Clear interrupt FIFO register 1 */ /* Clear interrupt FIFO register 1 */
pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK, pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
XILINX_PCIE_REG_RPIFR1); XILINX_PCIE_REG_RPIFR1);
if (irq) generic_handle_domain_irq(domain, val);
generic_handle_irq(irq);
} }
if (status & XILINX_PCIE_INTR_SLV_UNSUPP) if (status & XILINX_PCIE_INTR_SLV_UNSUPP)