Skip to contentSkip to conversation

riscv: sifive_test: Add reset functionality

PATCH In review Bin Meng 2 participants 3 messages Sep 5, 2019

Subsystems (2)
lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/1 riscv: sifive_test: Add reset functionality

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

---

Changes in v2:
- fix build error in the "for-master" branch of Palmer's RISC-V repo that was rebased on QEMU master

 hw/riscv/sifive_test.c         | 4 ++++
 include/hw/riscv/sifive_test.h | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
hw/riscv/sifive_test.c +4 -0
index afbb3aa..3557e16 100644
@@ -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;
         }
include/hw/riscv/sifive_test.h +2 -1
index 3a603a6..1ec416a 100644
@@ -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);
Signature · 1 line
2.7.4
author
#1 lore raw

Hi Palmer,

Quoted 9 lines · Bin Meng

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

---

Quoted 8 lines

Changes in v2:
- fix build error in the "for-master" branch of Palmer's RISC-V repo that was rebased on QEMU master

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

Please drop the already applied v1 patch in your "for-master" branch and apply this v2.

After you rebased the "for-master' branch, this patch no longer build any more due to changes in QEMU master.

Regards,
Bin

#2 lore raw
Quoted 21 lines · On Thu, 05 Sep 2019 08:57:44 PDT (-0700), [email protected] wrote:

Hi Palmer,

Quoted 9 lines · Bin Meng

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

---

Quoted 8 lines

Changes in v2:
- fix build error in the "for-master" branch of Palmer's RISC-V repo that was rebased on QEMU master

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

Please drop the already applied v1 patch in your "for-master" branch and apply this v2.

After you rebased the "for-master' branch, this patch no longer build any more due to changes in QEMU master.

Regards,
Bin

Thanks!