All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] riscv: sifive_test: Add reset functionality
@ 2019-06-14 15:15 ` Bin Meng
  0 siblings, 0 replies; 26+ messages in thread
From: Bin Meng @ 2019-06-14 15:15 UTC (permalink / raw)
  To: qemu-riscv, qemu-devel, Alistair Francis, Palmer Dabbelt

This adds a reset opcode for sifive_test device to trigger a system
reset for testing purpose.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 hw/riscv/sifive_test.c         | 4 ++++
 include/hw/riscv/sifive_test.h | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
index 24a04d7..cd86831 100644
--- a/hw/riscv/sifive_test.c
+++ b/hw/riscv/sifive_test.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "qemu/module.h"
+#include "sysemu/sysemu.h"
 #include "target/riscv/cpu.h"
 #include "hw/riscv/sifive_test.h"
 
@@ -40,6 +41,9 @@ static void sifive_test_write(void *opaque, hwaddr addr,
             exit(code);
         case FINISHER_PASS:
             exit(0);
+        case FINISHER_RESET:
+            qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+            return;
         default:
             break;
         }
diff --git a/include/hw/riscv/sifive_test.h b/include/hw/riscv/sifive_test.h
index 71d4c9f..c186a31 100644
--- a/include/hw/riscv/sifive_test.h
+++ b/include/hw/riscv/sifive_test.h
@@ -34,7 +34,8 @@ typedef struct SiFiveTestState {
 
 enum {
     FINISHER_FAIL = 0x3333,
-    FINISHER_PASS = 0x5555
+    FINISHER_PASS = 0x5555,
+    FINISHER_RESET = 0x7777
 };
 
 DeviceState *sifive_test_create(hwaddr addr);
-- 
2.7.4



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

end of thread, other threads:[~2019-07-30 16:38 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 15:15 [Qemu-devel] [PATCH] riscv: sifive_test: Add reset functionality Bin Meng
2019-06-14 15:15 ` [Qemu-riscv] " Bin Meng
2019-06-17 17:12 ` [Qemu-devel] " Alistair Francis
2019-06-17 17:12   ` [Qemu-riscv] " Alistair Francis
2019-06-19 13:42   ` Bin Meng
2019-06-19 13:42     ` [Qemu-riscv] " Bin Meng
2019-06-21  2:53     ` Palmer Dabbelt
2019-06-21  2:53       ` [Qemu-riscv] " Palmer Dabbelt
2019-06-21  5:40       ` Bin Meng
2019-06-21  5:40         ` [Qemu-riscv] " Bin Meng
2019-06-23 14:40         ` Palmer Dabbelt
2019-06-23 14:40           ` [Qemu-riscv] " Palmer Dabbelt
2019-06-26  1:45           ` Bin Meng
2019-06-26  1:45             ` [Qemu-riscv] " Bin Meng
2019-07-09  9:48 ` Palmer Dabbelt
2019-07-09  9:48   ` [Qemu-riscv] " Palmer Dabbelt
2019-07-14  3:38   ` [Qemu-devel] " Bin Meng
2019-07-14  3:38     ` [Qemu-riscv] " Bin Meng
2019-07-20  1:47 ` [Qemu-devel] " Palmer Dabbelt
2019-07-20  1:47   ` [Qemu-riscv] " Palmer Dabbelt
2019-07-23  5:30   ` [Qemu-devel] " Bin Meng
2019-07-23  5:30     ` [Qemu-riscv] " Bin Meng
2019-07-29 19:47     ` [Qemu-devel] " Palmer Dabbelt
2019-07-29 19:47       ` [Qemu-riscv] " Palmer Dabbelt
2019-07-30 16:37       ` [Qemu-devel] " Bin Meng
2019-07-30 16:37         ` [Qemu-riscv] " Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.