Skip to content

Commit

Permalink
irqchip: xilinx: Use handle_domain_irq()
Browse files Browse the repository at this point in the history
Call generic domain specific irq handler which does the most of things
self. Also get rid of concurrent_irq counting which hasn't been exported
anywhere.
Based on this loop was also optimized by using do/while loop instead of
goto loop.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Stefan Asserhall <stefan.asserhall@xilinx.com>
State: pending
  • Loading branch information
Michal Simek committed May 27, 2021
1 parent 315b691 commit ec26ada
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 deletions.
5 changes: 0 additions & 5 deletions arch/microblaze/kernel/irq.c
Expand Up @@ -22,13 +22,8 @@

void __irq_entry do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
trace_hardirqs_off();

irq_enter();
handle_arch_irq(regs);
irq_exit();
set_irq_regs(old_regs);
trace_hardirqs_on();
}

Expand Down
45 changes: 15 additions & 30 deletions drivers/irqchip/irq-xilinx-intc.c
Expand Up @@ -124,21 +124,6 @@ static unsigned int xintc_get_irq_local(struct xintc_irq_chip *irqc)
return irq;
}

static unsigned int xintc_get_irq(void)
{
int hwirq, irq = -1;
unsigned int cpu_id = smp_processor_id();
struct xintc_irq_chip *irqc = per_cpu_ptr(&primary_intc, cpu_id);

hwirq = irqc->read_fn(irqc->base + IVR);
if (hwirq != -1U)
irq = irq_find_mapping(irqc->root_domain, hwirq);

pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq);

return irq;
}

static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
{
struct xintc_irq_chip *irqc = d->host_data;
Expand Down Expand Up @@ -178,23 +163,23 @@ static void xil_intc_irq_handler(struct irq_desc *desc)
chained_irq_exit(chip, desc);
}

static u32 concurrent_irq;

static void xil_intc_handle_irq(struct pt_regs *regs)
{
unsigned int irq;

irq = xintc_get_irq();
next_irq:
BUG_ON(!irq);
generic_handle_irq(irq);

irq = xintc_get_irq();
if (irq != -1U) {
pr_debug("next irq: %d\n", irq);
++concurrent_irq;
goto next_irq;
}
int ret;
unsigned int hwirq, cpu_id = smp_processor_id();
struct xintc_irq_chip *irqc = per_cpu_ptr(&primary_intc, cpu_id);

do {
hwirq = irqc->read_fn(irqc->base + IVR);
if (hwirq != -1U) {
ret = handle_domain_irq(irqc->root_domain, hwirq, regs);
WARN_ONCE(ret, "cpu %d: Unhandled HWIRQ %d\n",
cpu_id, hwirq);
continue;
}

break;
} while (1);
}

static int __init xilinx_intc_of_init(struct device_node *intc,
Expand Down

0 comments on commit ec26ada

Please sign in to comment.