Skip to content

Commit 1e36492

Browse files
Michal SimekMarc Zyngier
authored andcommitted
irqchip/xilinx: Switch to GENERIC_IRQ_MULTI_HANDLER
Register the Xilinx driver as the root interrupt controller using the GENERIC_IRQ_MULTI_HANDLER API, instead of the arch-specific hack. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Stefan Asserhall <stefan.asserhall@xilinx.com> [maz: repainted commit message] Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/e6c6595a81f662bf839cee3109d0fa58a596ea47.1646380284.git.michal.simek@xilinx.com
1 parent e414c25 commit 1e36492

4 files changed

Lines changed: 19 additions & 32 deletions

File tree

arch/microblaze/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ config MICROBLAZE
4545
select SET_FS
4646
select ZONE_DMA
4747
select TRACE_IRQFLAGS_SUPPORT
48+
select GENERIC_IRQ_MULTI_HANDLER
49+
select HANDLE_DOMAIN_IRQ
4850

4951
# Endianness selection
5052
choice

arch/microblaze/include/asm/irq.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@
1111
struct pt_regs;
1212
extern void do_IRQ(struct pt_regs *regs);
1313

14-
/* should be defined in each interrupt controller driver */
15-
extern unsigned int xintc_get_irq(void);
16-
1714
#endif /* _ASM_MICROBLAZE_IRQ_H */

arch/microblaze/kernel/irq.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,13 @@
2020
#include <linux/irqchip.h>
2121
#include <linux/of_irq.h>
2222

23-
static u32 concurrent_irq;
24-
2523
void __irq_entry do_IRQ(struct pt_regs *regs)
2624
{
27-
unsigned int irq;
2825
struct pt_regs *old_regs = set_irq_regs(regs);
2926
trace_hardirqs_off();
3027

3128
irq_enter();
32-
irq = xintc_get_irq();
33-
next_irq:
34-
BUG_ON(!irq);
35-
generic_handle_irq(irq);
36-
37-
irq = xintc_get_irq();
38-
if (irq != -1U) {
39-
pr_debug("next irq: %d\n", irq);
40-
++concurrent_irq;
41-
goto next_irq;
42-
}
43-
29+
handle_arch_irq(regs);
4430
irq_exit();
4531
set_irq_regs(old_regs);
4632
trace_hardirqs_on();

drivers/irqchip/irq-xilinx-intc.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define MER_ME (1<<0)
3333
#define MER_HIE (1<<1)
3434

35+
#define SPURIOUS_IRQ (-1U)
36+
3537
static DEFINE_STATIC_KEY_FALSE(xintc_is_be);
3638

3739
struct xintc_irq_chip {
@@ -110,20 +112,6 @@ static struct irq_chip intc_dev = {
110112
.irq_mask_ack = intc_mask_ack,
111113
};
112114

113-
unsigned int xintc_get_irq(void)
114-
{
115-
unsigned int irq = -1;
116-
u32 hwirq;
117-
118-
hwirq = xintc_read(primary_intc, IVR);
119-
if (hwirq != -1U)
120-
irq = irq_find_mapping(primary_intc->root_domain, hwirq);
121-
122-
pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq);
123-
124-
return irq;
125-
}
126-
127115
static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
128116
{
129117
struct xintc_irq_chip *irqc = d->host_data;
@@ -164,6 +152,19 @@ static void xil_intc_irq_handler(struct irq_desc *desc)
164152
chained_irq_exit(chip, desc);
165153
}
166154

155+
static void xil_intc_handle_irq(struct pt_regs *regs)
156+
{
157+
u32 hwirq;
158+
159+
do {
160+
hwirq = xintc_read(primary_intc, IVR);
161+
if (unlikely(hwirq == SPURIOUS_IRQ))
162+
break;
163+
164+
generic_handle_domain_irq(primary_intc->root_domain, hwirq);
165+
} while (true);
166+
}
167+
167168
static int __init xilinx_intc_of_init(struct device_node *intc,
168169
struct device_node *parent)
169170
{
@@ -233,6 +234,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
233234
} else {
234235
primary_intc = irqc;
235236
irq_set_default_host(primary_intc->root_domain);
237+
set_handle_irq(xil_intc_handle_irq);
236238
}
237239

238240
return 0;

0 commit comments

Comments
 (0)