Re: [PATCH v4 01/23] riscv: Add new error codes defined by SBI v3.0

From: Anup Patel
Date: Mon Jun 09 2025 - 01:58:28 EST


On Sat, Jun 7, 2025 at 5:21 AM Atish Patra <atish.patra@xxxxxxxxx> wrote:
>
>
> On 5/25/25 1:46 AM, Anup Patel wrote:
> > The SBI v3.0 defines new error codes so add these new error codes
> > to the asm/sbi.h for use by newer SBI extensions.
>
> This patch can be dropped as it is part of the FWFT series with minor
> modifications in error mappings.
>
> https://lore.kernel.org/linux-riscv/20250523101932.1594077-4-cleger@xxxxxxxxxxxx/

Yes, I am aware of Clement's patch. I was temporarily carrying
this patch over here.

Regards,
Anup

>
>
> > Signed-off-by: Anup Patel <apatel@xxxxxxxxxxxxxxxx>
> > ---
> > arch/riscv/include/asm/sbi.h | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> > index 3d250824178b..4dd6aafb8468 100644
> > --- a/arch/riscv/include/asm/sbi.h
> > +++ b/arch/riscv/include/asm/sbi.h
> > @@ -419,6 +419,11 @@ enum sbi_ext_nacl_feature {
> > #define SBI_ERR_ALREADY_STARTED -7
> > #define SBI_ERR_ALREADY_STOPPED -8
> > #define SBI_ERR_NO_SHMEM -9
> > +#define SBI_ERR_INVALID_STATE -10
> > +#define SBI_ERR_BAD_RANGE -11
> > +#define SBI_ERR_TIMEOUT -12
> > +#define SBI_ERR_IO -13
> > +#define SBI_ERR_DENIED_LOCKED -14
> >
> > extern unsigned long sbi_spec_version;
> > struct sbiret {
> > @@ -503,11 +508,18 @@ 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_TIMEOUT:
> > + return -ETIMEDOUT;
> > + case SBI_ERR_IO:
> > + return -EIO;
> > case SBI_ERR_NOT_SUPPORTED:
> > case SBI_ERR_FAILURE:
> > default: