[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-riscv] [PATCH v8 02/32] riscv: sifive_test: Add reset functionalit
From: |
Bin Meng |
Subject: |
[Qemu-riscv] [PATCH v8 02/32] riscv: sifive_test: Add reset functionality |
Date: |
Fri, 6 Sep 2019 09:19:49 -0700 |
This adds a reset opcode for sifive_test device to trigger a system
reset for testing purpose.
Signed-off-by: Bin Meng <address@hidden>
Reviewed-by: Palmer Dabbelt <address@hidden>
---
Changes in v8:
- newly included in v8 to ease patch inter dependencies
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 3a14f9f..7117409 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/runstate.h"
#include "target/riscv/cpu.h"
#include "hw/hw.h"
#include "hw/riscv/sifive_test.h"
@@ -41,6 +42,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 3a603a6..1ec416a 100644
--- a/include/hw/riscv/sifive_test.h
+++ b/include/hw/riscv/sifive_test.h
@@ -36,7 +36,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
- [Qemu-riscv] [PATCH v8 00/32] riscv: sifive_u: Improve the emulation fidelity of sifive_u machine, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 01/32] riscv: hw: Remove duplicated "hw/hw.h" inclusion, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 02/32] riscv: sifive_test: Add reset functionality,
Bin Meng <=
- [Qemu-riscv] [PATCH v8 05/32] riscv: hw: Remove not needed PLIC properties in device tree, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 03/32] riscv: hw: Remove superfluous "linux, phandle" property, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 04/32] riscv: hw: Use qemu_fdt_setprop_cell() for property with only 1 cell, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 08/32] riscv: hw: Remove the unnecessary include of target/riscv/cpu.h, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 12/32] riscv: sifive_e: prci: Fix a typo of hfxosccfg register programming, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 07/32] riscv: hw: Change to use qemu_log_mask(LOG_GUEST_ERROR, ...) instead, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 09/32] riscv: roms: Remove executable attribute of opensbi images, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 06/32] riscv: hw: Change create_fdt() to return void, Bin Meng, 2019/09/06
- [Qemu-riscv] [PATCH v8 13/32] riscv: sifive_e: prci: Update the PRCI register block size, Bin Meng, 2019/09/06