aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2019-09-05 08:55:16 -0700
committerPalmer Dabbelt <palmer@sifive.com>2019-09-17 08:42:44 -0700
commit9a2551ed6f946e96cd54ea3f3499d785a1f27c3d (patch)
treee5fd710818cf96d5bef1c010c7fe8adc41d9445e /hw
parentdf42fdd6cc0df027d6f52b9abbd9cddac8f7c453 (diff)
downloadqemu-9a2551ed6f946e96cd54ea3f3499d785a1f27c3d.zip
qemu-9a2551ed6f946e96cd54ea3f3499d785a1f27c3d.tar.gz
qemu-9a2551ed6f946e96cd54ea3f3499d785a1f27c3d.tar.bz2
riscv: sifive_test: Add reset functionality
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> Reviewed-by: Palmer Dabbelt <palmer@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/riscv/sifive_test.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c
index afbb3aa..3557e16 100644
--- a/hw/riscv/sifive_test.c
+++ b/hw/riscv/sifive_test.c
@@ -22,6 +22,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "qemu/module.h"
+#include "sysemu/runstate.h"
#include "target/riscv/cpu.h"
#include "hw/hw.h"
#include "hw/riscv/sifive_test.h"
@@ -42,6 +43,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;
}