summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/asm.h
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2023-09-28 01:48:00 +0300
committerPalmer Dabbelt <palmer@rivosinc.com>2023-10-28 00:43:06 +0300
commit82982fdd5133fa7e0b2dfaf746d18d6f29922b82 (patch)
tree40e0c20f8cb63a680cce12ebaf14df94c757d673 /arch/riscv/include/asm/asm.h
parentbe97d0db5f44c0674480cb79ac6f5b0529b84c76 (diff)
downloadlinux-82982fdd5133fa7e0b2dfaf746d18d6f29922b82.tar.xz
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>
Diffstat (limited to 'arch/riscv/include/asm/asm.h')
-rw-r--r--arch/riscv/include/asm/asm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/asm.h b/arch/riscv/include/asm/asm.h
index bfb4c26f113c..8e446be2d57c 100644
--- a/arch/riscv/include/asm/asm.h
+++ b/arch/riscv/include/asm/asm.h
@@ -104,6 +104,11 @@
.endm
#endif /* CONFIG_SMP */
+.macro load_per_cpu dst ptr tmp
+ asm_per_cpu \dst \ptr \tmp
+ REG_L \dst, 0(\dst)
+.endm
+
/* save all GPs except x1 ~ x5 */
.macro save_from_x6_to_x31
REG_S x6, PT_T1(sp)