Re: lib: sbi: Make per-HART stack size configurable via Kconfig
Anup Patel <[email protected]> Tue, 16 Jun 2026 20:37:48 +0530
| Newsgroups | org.infradead.lists.opensbi |
|---|---|
| Message-ID | <CAAhSdy0yOJV9mY2q9TE5_S7g6TK=kGpne9gQukCe7hxjFP_JeQ@mail.gmail.com> |
Hi Oriol Catalan, On Tue, May 19, 2026 at 2:29 PM Oriol Catalan | OPENCHIP <[email protected]> wrote: > > lib: sbi: Make per-HART stack size configurable via Kconfig No need to repeat the subject in patch description. > > The per-HART stack size for exception/interrupt handling is currently > hardcoded to 8192 bytes in SBI_PLATFORM_DEFAULT_HART_STACK_SIZE. This > may not be sufficient for platforms with deeper call stacks (e.g., those > enabling additional SBI extensions) or may be wasteful for minimal > platforms. > > Introduce a HART_STACK_SIZE Kconfig option in lib/sbi/Kconfig with a > valid range of 8192 to 1048576 bytes and a default of 8192 bytes to > preserve existing behavior. The SBI_PLATFORM_DEFAULT_HART_STACK_SIZE > macro now resolves to CONFIG_HART_STACK_SIZE, allowing all platforms > to benefit from a single configuration knob without any source changes. > > Signed-off-by: Oriol Catalan <[email protected]> > > diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h > index fe382b56..7ea9b961 100644 > --- a/include/sbi/sbi_platform.h > +++ b/include/sbi/sbi_platform.h > @@ -160,7 +160,7 @@ struct sbi_platform_operations { > }; > > /** Platform default per-HART stack size for exception/interrupt handling */ > -#define SBI_PLATFORM_DEFAULT_HART_STACK_SIZE 8192 > +#define SBI_PLATFORM_DEFAULT_HART_STACK_SIZE CONFIG_HART_STACK_SIZE > > /** Platform default heap size */ > #define SBI_PLATFORM_DEFAULT_HEAP_SIZE(__num_hart) \ > diff --git a/lib/sbi/Kconfig b/lib/sbi/Kconfig > index c6cc04bc..2f6fa3a4 100644 > --- a/lib/sbi/Kconfig > +++ b/lib/sbi/Kconfig > @@ -2,6 +2,11 @@ > > menu "Generic SBI Support" > > +config HART_STACK_SIZE > + int "Per-HART stack size (bytes)" > + range 8192 1048576 > + default 8192 > + I am not sure how you send this patch. It seems all tabs are converted to spaces and I am unable to apply this patch. I will manually do the changes at the time of merging. Please use git format-patch for generating patches and use git send-email to send patches to the OpenSBI mailing list. Reviewed-by: Anup Patel <[email protected]> Applied this patch to the riscv/opensbi repo. Thanks, Anup -- opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi