[PATCH v2 7/7] lib: sbi: ISA extension emulation (Zvbb).
Vivian Wang
wangruikang at iscas.ac.cn
Mon Nov 17 05:16:05 PST 2025
On 11/17/25 20:35, Vivian Wang wrote:
> Hi Benedikt,
>
> Thank you for your patch. We have found it very useful.
>
> Han Gao (cc'd) has been testing this on the SG2044. We have some minor
> suggestions and a bug report regarding patch 7. Please see below.
>
Oops, almost forgot there's another thing:
> diff --git a/lib/sbi/sbi_insn_emu_v.c b/lib/sbi/sbi_insn_emu_v.c
> new file mode 100644
> index 0000000..517791e
> --- /dev/null
> +++ b/lib/sbi/sbi_insn_emu_v.c
> +static inline void foreach_velem_vv(int vl, int sew, bool masked, int vd,
> + int vs1, int vs2, u64 op(u64, u64))
> +{
> + sbi_vector_data vs1_data;
> + sbi_vector_data vs2_data;
> + sbi_vector_data vd_data;
While testing, we've also found that using local variables this large is
prone to overflowing the stack space. I'm not sure what the exact
condition to trigger this is, but we've had to increase the stack size
in include/sbi/sbi_platform.h from:
#define SBI_PLATFORM_DEFAULT_HART_STACK_SIZE 8192
To 16384. Otherwise bizarre errors occur Linux secondary CPU startup,
presumably during CPU speed measurement.
Perhaps it's worth testing cases where there are many CPUs using
emulated instructions simultaneously.
Vivian "dramforever" Wang
More information about the opensbi
mailing list