Re: [PATCH 1/1] sbi: make SBI_HARTMASK_MAX_BITS customizable, default 256

Anup Patel <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <CAAhSdy3k1L7X4WBTtkb97P15E_gOE=bwhxuGhjhScSuOQugv9w@mail.gmail.com>
On Mon, Jul 6, 2026 at 9:35 PM Heinrich Schuchardt
<[email protected]> wrote:
>
> Linux has raised the default number of 64bit CPUs to 256 in commit
> 0fa749771993 ("riscv: Raise default NR_CPUS for 64BIT to 256").
> OpenSBI should use a matching value for SBI_HARTMASK_MAX_BITS.
>
> Introduce configuration variable CONFIG_HARTMASK_MAX_BITS with
> range 32-512 and default 256.
>
> Signed-off-by: Heinrich Schuchardt <[email protected]>

LGTM.

Reviewed-by: Anup Patel <[email protected]>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  include/sbi/sbi_hartmask.h | 2 +-
>  lib/sbi/Kconfig            | 9 +++++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/include/sbi/sbi_hartmask.h b/include/sbi/sbi_hartmask.h
> index 200ab6e5..339cd40f 100644
> --- a/include/sbi/sbi_hartmask.h
> +++ b/include/sbi/sbi_hartmask.h
> @@ -20,7 +20,7 @@
>   * also represents the maximum number of HART ids generic OpenSBI
>   * can handle.
>   */
> -#define SBI_HARTMASK_MAX_BITS          128
> +#define SBI_HARTMASK_MAX_BITS          CONFIG_HARTMASK_MAX_BITS
>
>  /** Representation of hartmask */
>  struct sbi_hartmask {
> diff --git a/lib/sbi/Kconfig b/lib/sbi/Kconfig
> index e76aecca..24132eaa 100644
> --- a/lib/sbi/Kconfig
> +++ b/lib/sbi/Kconfig
> @@ -2,6 +2,15 @@
>
>  menu "Generic SBI Support"
>
> +config HARTMASK_MAX_BITS
> +       int "Maximum number of hart mask bits (32-512)"
> +       range 32 512
> +       default 256
> +       help
> +         The hartmask is indexed using physical hart IDs so this setting
> +         also represents the maximum number of hart IDs generic OpenSBI
> +         can handle.
> +
>  config DEFAULT_HART_STACK_SIZE
>         int "Default per-HART stack size (bytes)"
>         range 8192 1048576
> --
> 2.53.0
>

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.