Skip to contentSkip to conversation

Misc: Make watchdog devices using qemu_system_reset_request() use watchdog_perfom_action()

PATCH In review Abhiram Tilak 2 participants 4 messages Feb 16, 2024 – Feb 22, 2024

lore
Share & tools
lore
#0 lore raw

v2 cover Misc: Make watchdog devices using qemu_system_reset_request() use watchdog_perfom_action()

A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using watchdog_action. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do.

v2:
- Remove redundant comment in patch1 in m48t59.
- Exclude patch 3 from patch series due to current call being more preferable.

Abhiram Tilak (2):
misc: m48t59: replace qemu_system_reset_request() call with
watchdog_perform_action()
misc: pxa2xx_timer: replace qemu_system_reset_request() call with
watchdog_perform_action()

 hw/rtc/m48t59.c         | 4 ++--
 hw/timer/pxa2xx_timer.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.42.1
#1 lore raw

PATCH v2 1/2 misc: m48t59: replace qemu_system_reset_request() call with watchdog_perform_action()

A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using watchdog_action. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2124

---
 hw/rtc/m48t59.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rtc/m48t59.c +2 -2
index aa44c4b20c..1585a2d399 100644
@@ -36,6 +36,7 @@
 #include "qemu/bcd.h"
 #include "qemu/module.h"
 #include "trace.h"
+#include "sysemu/watchdog.h"
 
 #include "m48t59-internal.h"
 #include "migration/vmstate.h"
@@ -163,8 +164,7 @@ static void watchdog_cb (void *opaque)
     if (NVRAM->buffer[0x1FF7] & 0x80) {
         NVRAM->buffer[0x1FF7] = 0x00;
         NVRAM->buffer[0x1FFC] &= ~0x40;
-        /* May it be a hw CPU Reset instead ? */
-        qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+        watchdog_perform_action();
     } else {
         qemu_set_irq(NVRAM->IRQ, 1);
         qemu_set_irq(NVRAM->IRQ, 0);
Signature · 1 line
2.42.1
#2 lore raw

PATCH v2 2/2 misc: pxa2xx_timer: replace qemu_system_reset_request() call with watchdog_perform_action()

In reply to Abhiram Tilak

A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using watchdog_action. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2124

---
 hw/timer/pxa2xx_timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/timer/pxa2xx_timer.c +2 -1
index 6a7d5551f4..6479ab1a8b 100644
@@ -18,6 +18,7 @@
 #include "qemu/log.h"
 #include "qemu/module.h"
 #include "qom/object.h"
+#include "sysemu/watchdog.h"
 
 #define OSMR0	0x00
 #define OSMR1	0x04
@@ -417,7 +418,7 @@ static void pxa2xx_timer_tick(void *opaque)
     if (t->num == 3)
         if (i->reset3 & 1) {
             i->reset3 = 0;
-            qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+            watchdog_perform_action();
         }
 }
 
Signature · 1 line
2.42.1
#3 lore raw
In reply to Abhiram Tilak
Quoted 10 lines · Abhiram Tilak

A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using watchdog_action. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do.

v2:
- Remove redundant comment in patch1 in m48t59.
- Exclude patch 3 from patch series due to current call being more preferable.

Thanks for sending this contribution; I've applied it to target-arm.next and it should get into git either this week or early next week.

-- PMM