]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: sbi: add new SBI error mappings
authorClément Léger <cleger@rivosinc.com>
Fri, 23 May 2025 10:19:20 +0000 (12:19 +0200)
committerPalmer Dabbelt <palmer@dabbelt.com>
Wed, 4 Jun 2025 22:11:00 +0000 (15:11 -0700)
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@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20250523101932.1594077-4-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
arch/riscv/include/asm/sbi.h

index bb077d0c912fb5b57a2d48f24287376570327010..0938f2a8d01bad6854199ada723437fc24d1df07 100644 (file)
@@ -536,11 +536,21 @@ 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:
                return -EINVAL;
+       case SBI_ERR_BAD_RANGE:
+               return -ERANGE;
        case SBI_ERR_INVALID_ADDRESS:
                return -EFAULT;
+       case SBI_ERR_NO_SHMEM:
+               return -ENOMEM;
+       case SBI_ERR_TIMEOUT:
+               return -ETIMEDOUT;
+       case SBI_ERR_IO:
+               return -EIO;
        case SBI_ERR_NOT_SUPPORTED:
        case SBI_ERR_FAILURE:
        default: