]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
riscv: Fix 32-bit call_on_irq_stack() frame pointer ABI
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 24 Jun 2026 11:31:48 +0000 (19:31 +0800)
committerPaul Walmsley <pjw@kernel.org>
Thu, 25 Jun 2026 19:44:27 +0000 (13:44 -0600)
commitc4c7756a81b5baef286bf9be1ea404f3e4dd7a3c
treeb93f139c874fe87f08e64b190a07a2d9df091ce3
parent57ad674d032baf5426a38b0d6b2ddd60cbd3913f
riscv: Fix 32-bit call_on_irq_stack() frame pointer ABI

call_on_irq_stack() uses struct member offsets to set up its link in the
frame record list. On riscv32, struct stackframe is the wrong size to
maintain stack pointer alignment, so STACKFRAME_SIZE_ON_STACK includes
padding. However, the ABI requires the frame record to be placed
immediately below the address stored in s0, so the padding must come
before the struct members.

Fix the layout by making STACKFRAME_FP and STACKFRAME_RA the negative
offsets from s0, instead of the positive offsets from sp.

Fixes: 82982fdd5133 ("riscv: Deduplicate IRQ stack switching")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Matthew Bystrin <dev.mbstr@gmail.com>
Signed-off-by: Rui Qi <qirui.001@bytedance.com>
Link: https://lore.kernel.org/all/20240530001733.1407654-2-samuel.holland@sifive.com/
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://patch.msgid.link/20260624113148.3723541-1-qirui.001@bytedance.com
[pjw@kernel.org: cleaned up the patch tags and added Matthew's Reviewed-by]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/asm-offsets.c
arch/riscv/kernel/entry.S