riscv: Deduplicate IRQ stack switching
authorSami Tolvanen <samitolvanen@google.com>
Wed, 27 Sep 2023 22:48:00 +0000 (22:48 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 27 Oct 2023 21:43:06 +0000 (14:43 -0700)
commit82982fdd5133fa7e0b2dfaf746d18d6f29922b82
tree40e0c20f8cb63a680cce12ebaf14df94c757d673
parentbe97d0db5f44c0674480cb79ac6f5b0529b84c76
riscv: Deduplicate IRQ stack switching

With CONFIG_IRQ_STACKS, we switch to a separate per-CPU IRQ stack
before calling handle_riscv_irq or __do_softirq. We currently
have duplicate inline assembly snippets for stack switching in
both code paths. Now that we can access per-CPU variables in
assembly, implement call_on_irq_stack in assembly, and use that
instead of redundant inline assembly.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/20230927224757.1154247-10-samitolvanen@google.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/asm.h
arch/riscv/include/asm/irq_stack.h
arch/riscv/kernel/asm-offsets.c
arch/riscv/kernel/entry.S
arch/riscv/kernel/irq.c
arch/riscv/kernel/traps.c