aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/cppc
diff options
context:
space:
mode:
authorBo Gan <ganboing@gmail.com>2025-12-15 21:25:28 -0800
committerAnup Patel <anup@brainfault.org>2025-12-27 11:21:27 +0530
commit4c1c77e085599f6f95df4b94714e1d7829ebefbf (patch)
tree26d4b8196d334bb2373b92177ec646a281d3be5a /lib/utils/cppc
parentf7b81034aa4c19199afac6be4e033270f3755bf5 (diff)
downloadopensbi-4c1c77e085599f6f95df4b94714e1d7829ebefbf.zip
opensbi-4c1c77e085599f6f95df4b94714e1d7829ebefbf.tar.gz
opensbi-4c1c77e085599f6f95df4b94714e1d7829ebefbf.tar.bz2
include: riscv_asm: Optimize csr_xyz() macros to reduce stack usage
When using debug builds, aka., DEBUG=1, csr_write_num() function can trigger stack overflow. This is caused by the large amount of macro expansion of csr_write(...), which, under debug builds, will generate massive amount of stack variables (tested with GCC 13.2.0). The issue is masked previously as we didn't have too many csr_write()'s before commit 55296fd27c0c, but now, it does overflow the default 4KB stack. The csr_read(relaxed) macros already use the "register" modifier to optimize stack usage (perhaps unknowingly?), so this patch just follows suit. Fixes: 55296fd27c0c ("lib: Allow custom CSRs in csr_read_num() and csr_write_num()") Signed-off-by: Bo Gan <ganboing@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251216052528.18896-1-ganboing@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/utils/cppc')
0 files changed, 0 insertions, 0 deletions