include: sbi: Align SBI trap registers to a nice boundary

Align SBI_TRAP_CONTEXT_SIZE to a multiple of 16 bytes. If it is not
aligned to 16 bytes for RV64, it can create performance problems.
Aligning it correctly can fix the performance issues.

Signed-off-by: Raj Vishwanathan <Raj.Vishwanathan@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Raj Vishwanathan
2025-02-11 13:46:39 -08:00
committed by Anup Patel
parent 3f25380d85
commit 4f12f8b02f

View File

@@ -112,10 +112,13 @@
/** Size (in bytes) of sbi_trap_info */ /** Size (in bytes) of sbi_trap_info */
#define SBI_TRAP_INFO_SIZE SBI_TRAP_INFO_OFFSET(last) #define SBI_TRAP_INFO_SIZE SBI_TRAP_INFO_OFFSET(last)
#define STACK_BOUNDARY 16
#define ALIGN_TO_BOUNDARY(x, a) (((x) + (a) - 1) & ~((a) - 1))
/** Size (in bytes) of sbi_trap_context */ /** Size (in bytes) of sbi_trap_context */
#define SBI_TRAP_CONTEXT_SIZE (SBI_TRAP_REGS_SIZE + \ #define SBI_TRAP_CONTEXT_SIZE ALIGN_TO_BOUNDARY((SBI_TRAP_REGS_SIZE + \
SBI_TRAP_INFO_SIZE + \ SBI_TRAP_INFO_SIZE + \
__SIZEOF_POINTER__) __SIZEOF_POINTER__), STACK_BOUNDARY)
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__