qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific SBI
@ 2024-03-25 10:14 Alexei Filippov
  2024-03-25 11:51 ` Daniel Henrique Barboza
  0 siblings, 1 reply; 26+ messages in thread
From: Alexei Filippov @ 2024-03-25 10:14 UTC (permalink / raw)
  To: palmer, alistair.francis, bin.meng, liwei1518, dbarboza,
	zhiwei_liu
  Cc: qemu-riscv, qemu-devel, Alexei Filippov

kvm_riscv_handle_sbi() may return not supported return code to not trigger
qemu abort with vendor-specific sbi.

Added SBI related return code's defines.

Signed-off-by: Alexei Filippov <alexei.filippov@syntacore.com>
---
 target/riscv/kvm/kvm-cpu.c         |  5 +++--
 target/riscv/sbi_ecall_interface.h | 11 +++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
index 6a6c6cae80..a4f84ad950 100644
--- a/target/riscv/kvm/kvm-cpu.c
+++ b/target/riscv/kvm/kvm-cpu.c
@@ -1404,7 +1404,7 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
         if (ret == sizeof(ch)) {
             run->riscv_sbi.ret[0] = ch;
         } else {
-            run->riscv_sbi.ret[0] = -1;
+            run->riscv_sbi.ret[0] = SBI_ERR_FAILURE;
         }
         ret = 0;
         break;
@@ -1412,7 +1412,8 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
         qemu_log_mask(LOG_UNIMP,
                       "%s: un-handled SBI EXIT, specific reasons is %lu\n",
                       __func__, run->riscv_sbi.extension_id);
-        ret = -1;
+        run->riscv_sbi.ret[0] = SBI_ERR_NOT_SUPPORTED;
+        ret = 0;
         break;
     }
     return ret;
diff --git a/target/riscv/sbi_ecall_interface.h b/target/riscv/sbi_ecall_interface.h
index 43899d08f6..0279e92a36 100644
--- a/target/riscv/sbi_ecall_interface.h
+++ b/target/riscv/sbi_ecall_interface.h
@@ -69,4 +69,15 @@
 #define SBI_EXT_VENDOR_END              0x09FFFFFF
 /* clang-format on */
 
+/* SBI return error codes */
+#define SBI_SUCCESS                  0
+#define SBI_ERR_FAILURE             -1
+#define SBI_ERR_NOT_SUPPORTED       -2
+#define SBI_ERR_INVALID_PARAM       -3
+#define SBI_ERR_DENIED              -4
+#define SBI_ERR_INVALID_ADDRESS     -5
+#define SBI_ERR_ALREADY_AVAILABLE   -6
+#define SBI_ERR_ALREADY_STARTED     -7
+#define SBI_ERR_ALREADY_STOPPED     -8
+
 #endif
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2024-09-18 13:41 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 10:14 [PATCH] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific SBI Alexei Filippov
2024-03-25 11:51 ` Daniel Henrique Barboza
2024-03-25 13:01   ` [PATCH v2] " Alexei Filippov
2024-03-26  4:54     ` Alistair Francis
2024-03-27 12:57       ` [PATCH v3] " Alexei Filippov
2024-03-26  9:50     ` [PATCH v2] " Andrew Jones
2024-04-13 11:25       ` [PATCH v4] " Alexei Filippov
2024-04-15 14:03         ` Andrew Jones
2024-04-22  3:55         ` Alistair Francis
2024-04-22  8:12           ` Andrew Jones
2024-04-22 11:24             ` [PATCH v5] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific sbi Alexei Filippov
2024-04-22 11:40               ` Aleksei Filippov
2024-04-22 11:42             ` [PATCH v6] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific SBI Alexei Filippov
2024-04-22 12:31               ` Andrew Jones
2024-04-25  9:21                 ` Andrew Jones
2024-05-03 10:39                   ` Aleksei Filippov
2024-05-03 11:55                     ` Andrew Jones
2024-05-27 13:48                       ` [PATCH v7] " Alexei Filippov
2024-05-27 15:03                         ` Andrew Jones
2024-06-25 15:02                           ` [PATCH v8] " Alexei Filippov
2024-06-26 15:18                             ` Andrew Jones
2024-09-17 11:54                               ` [PATCH v9] " Alexei Filippov
2024-09-17 12:29                                 ` Andrew Jones
2024-09-17 13:10                                   ` Andrew Jones
2024-09-18 13:37                                     ` Aleksei Filippov
2024-09-18 13:41                                       ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).