[PATCH 1/3] include: sbi: Add sbi_scratch_hartindex() macro
Nicholas Piggin
npiggin at gmail.com
Wed Apr 22 23:55:06 PDT 2026
On Wed, Apr 15, 2026 at 04:30:00PM +0530, Anup Patel wrote:
> Add helper macro to extract hart index from scratch pointer. This
> can be used to check whether scratch pointer belongs to a particular
> hart or not.
Reviewed-by: Nicholas Piggin <npiggin at gmail.com>
>
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>
> ---
> include/sbi/sbi_scratch.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
> index 58d54628..c12aa796 100644
> --- a/include/sbi/sbi_scratch.h
> +++ b/include/sbi/sbi_scratch.h
> @@ -166,9 +166,11 @@ do { \
> = (__type)(__ptr); \
> } while (0)
>
> +/** Get the hart index of a particular sbi_scratch */
> +#define sbi_scratch_hartindex(__scratch) ((__scratch)->hartindex)
> +
> /** Get the hart index of the current hart */
> -#define current_hartindex() \
> - (sbi_scratch_thishart_ptr()->hartindex)
> +#define current_hartindex() sbi_scratch_hartindex(sbi_scratch_thishart_ptr())
>
> /** Number of harts managed by this OpenSBI instance */
> extern u32 sbi_scratch_hart_count;
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list