[PATCH v4 02/18] riscv: sbi: add new SBI error mappings
Andrew Jones
ajones at ventanamicro.com
Sat Mar 22 05:06:04 PDT 2025
On Mon, Mar 17, 2025 at 06:06:08PM +0100, Clément Léger wrote:
> A few new errors have been added with SBI V3.0, maps them as close as
> possible to errno values.
>
> Signed-off-by: Clément Léger <cleger at rivosinc.com>
> ---
> arch/riscv/include/asm/sbi.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index bb077d0c912f..d11d22717b49 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -536,11 +536,20 @@ static inline int sbi_err_map_linux_errno(int err)
> case SBI_SUCCESS:
> return 0;
> case SBI_ERR_DENIED:
> + case SBI_ERR_DENIED_LOCKED:
> return -EPERM;
> case SBI_ERR_INVALID_PARAM:
> + case SBI_ERR_INVALID_STATE:
> + case SBI_ERR_BAD_RANGE:
> return -EINVAL;
> case SBI_ERR_INVALID_ADDRESS:
> return -EFAULT;
> + case SBI_ERR_NO_SHMEM:
> + return -ENOMEM;
> + case SBI_ERR_TIMEOUT:
> + return -ETIME;
> + case SBI_ERR_IO:
> + return -EIO;
> case SBI_ERR_NOT_SUPPORTED:
> case SBI_ERR_FAILURE:
> default:
> --
> 2.47.2
>
I'm not a huge fan sbi_err_map_linux_errno() since the mappings seem a bit
arbitrary, but if we're going to do it, then these look pretty good to me.
Only other thought I had was E2BIG for bad-range, but nah...
Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
Thanks,
drew
More information about the linux-riscv
mailing list