Skip to content

Commit 9962323

Browse files
jcmvbkbcczankel
authored andcommitted
xtensa: clean up do_interrupt/do_IRQ
- set up irq registers and call irq_enter/irq_exit once for each kernel entry due to interrupt; - don't attempt to clear current IRQ in the do_interrupt, IRQ handler will take care of it; - find pending interrupt with highest priority before every ISR invocation. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent cbd1de2 commit 9962323

2 files changed

Lines changed: 9 additions & 20 deletions

File tree

‎arch/xtensa/kernel/irq.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ atomic_t irq_err_count;
3030

3131
asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
3232
{
33-
struct pt_regs *old_regs = set_irq_regs(regs);
3433
int irq = irq_find_mapping(NULL, hwirq);
3534

3635
if (hwirq >= NR_IRQS) {
3736
printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
3837
__func__, hwirq);
3938
}
4039

41-
irq_enter();
42-
4340
#ifdef CONFIG_DEBUG_STACKOVERFLOW
4441
/* Debugging check for stack overflow: is there less than 1KB free? */
4542
{
@@ -54,9 +51,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
5451
}
5552
#endif
5653
generic_handle_irq(irq);
57-
58-
irq_exit();
59-
set_irq_regs(old_regs);
6054
}
6155

6256
int arch_show_interrupts(struct seq_file *p, int prec)

‎arch/xtensa/kernel/traps.c‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ void do_interrupt(struct pt_regs *regs)
212212
XCHAL_INTLEVEL6_MASK,
213213
XCHAL_INTLEVEL7_MASK,
214214
};
215+
struct pt_regs *old_regs = set_irq_regs(regs);
216+
217+
irq_enter();
215218

216219
for (;;) {
217220
unsigned intread = get_sr(interrupt);
@@ -227,21 +230,13 @@ void do_interrupt(struct pt_regs *regs)
227230
}
228231

229232
if (level == 0)
230-
return;
231-
232-
/*
233-
* Clear the interrupt before processing, in case it's
234-
* edge-triggered or software-generated
235-
*/
236-
while (int_at_level) {
237-
unsigned i = __ffs(int_at_level);
238-
unsigned mask = 1 << i;
239-
240-
int_at_level ^= mask;
241-
set_sr(mask, intclear);
242-
do_IRQ(i, regs);
243-
}
233+
break;
234+
235+
do_IRQ(__ffs(int_at_level), regs);
244236
}
237+
238+
irq_exit();
239+
set_irq_regs(old_regs);
245240
}
246241

247242
/*

0 commit comments

Comments
 (0)