[PATCH] lib: sbi: Fix SHMEM_PHYS_ADDR for RV64

Anup Patel anup at brainfault.org
Mon Apr 14 22:53:42 PDT 2025


On Wed, Mar 19, 2025 at 6:08 PM Xiang W <wxjstz at 126.com> wrote:
>
> Obtaining a 64-bit address under rv64 dose not require combining
> 32-bit registers

For rv64, we are already ignoring addr_hi so we should say that for
rv32 we don't need to combine two 32-bit registers.

The patch subject and description needs to be improved as-per above.
I will take care of this at the time of merging this patch.

>
> Signed-off-by: Xiang W <wxjstz at 126.com>
> ---
>  lib/sbi/sbi_mpxy.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/lib/sbi/sbi_mpxy.c b/lib/sbi/sbi_mpxy.c
> index c5d9d1bb..0a4c500e 100644
> --- a/lib/sbi/sbi_mpxy.c
> +++ b/lib/sbi/sbi_mpxy.c
> @@ -66,13 +66,7 @@ static SBI_LIST_HEAD(mpxy_channel_list);
>  #define CAP_DISABLE(_c, _m)    INSERT_FIELD(_c, _m, 0)
>  #define CAP_GET(_c, _m)                EXTRACT_FIELD(_c, _m)
>
> -#if __riscv_xlen == 64
>  #define SHMEM_PHYS_ADDR(_hi, _lo) (_lo)
> -#elif __riscv_xlen == 32
> -#define SHMEM_PHYS_ADDR(_hi, _lo) (((u64)(_hi) << 32) | (_lo))
> -#else
> -#error "Undefined XLEN"
> -#endif
>
>  /** Per hart shared memory */
>  struct mpxy_shmem {
> --
> 2.47.2
>

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup



More information about the opensbi mailing list