|
27 | 27 | #include <asm/syscall.h> |
28 | 28 | #include <asm/thread_info.h> |
29 | 29 | #include <asm/vector.h> |
| 30 | +#include <asm/irq_stack.h> |
30 | 31 |
|
31 | 32 | int show_unhandled_signals = 1; |
32 | 33 |
|
@@ -327,16 +328,46 @@ asmlinkage __visible noinstr void do_page_fault(struct pt_regs *regs) |
327 | 328 | } |
328 | 329 | #endif |
329 | 330 |
|
330 | | -asmlinkage __visible noinstr void do_irq(struct pt_regs *regs) |
| 331 | +static void noinstr handle_riscv_irq(struct pt_regs *regs) |
331 | 332 | { |
332 | 333 | struct pt_regs *old_regs; |
333 | | - irqentry_state_t state = irqentry_enter(regs); |
334 | 334 |
|
335 | 335 | irq_enter_rcu(); |
336 | 336 | old_regs = set_irq_regs(regs); |
337 | 337 | handle_arch_irq(regs); |
338 | 338 | set_irq_regs(old_regs); |
339 | 339 | irq_exit_rcu(); |
| 340 | +} |
| 341 | + |
| 342 | +asmlinkage void noinstr do_irq(struct pt_regs *regs) |
| 343 | +{ |
| 344 | + irqentry_state_t state = irqentry_enter(regs); |
| 345 | +#ifdef CONFIG_IRQ_STACKS |
| 346 | + if (on_thread_stack()) { |
| 347 | + ulong *sp = per_cpu(irq_stack_ptr, smp_processor_id()) |
| 348 | + + IRQ_STACK_SIZE/sizeof(ulong); |
| 349 | + __asm__ __volatile( |
| 350 | + "addi sp, sp, -"RISCV_SZPTR "\n" |
| 351 | + REG_S" ra, (sp) \n" |
| 352 | + "addi sp, sp, -"RISCV_SZPTR "\n" |
| 353 | + REG_S" s0, (sp) \n" |
| 354 | + "addi s0, sp, 2*"RISCV_SZPTR "\n" |
| 355 | + "move sp, %[sp] \n" |
| 356 | + "move a0, %[regs] \n" |
| 357 | + "call handle_riscv_irq \n" |
| 358 | + "addi sp, s0, -2*"RISCV_SZPTR"\n" |
| 359 | + REG_L" s0, (sp) \n" |
| 360 | + "addi sp, sp, "RISCV_SZPTR "\n" |
| 361 | + REG_L" ra, (sp) \n" |
| 362 | + "addi sp, sp, "RISCV_SZPTR "\n" |
| 363 | + : |
| 364 | + : [sp] "r" (sp), [regs] "r" (regs) |
| 365 | + : "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", |
| 366 | + "t0", "t1", "t2", "t3", "t4", "t5", "t6", |
| 367 | + "memory"); |
| 368 | + } else |
| 369 | +#endif |
| 370 | + handle_riscv_irq(regs); |
340 | 371 |
|
341 | 372 | irqentry_exit(regs, state); |
342 | 373 | } |
|
0 commit comments