summaryrefslogtreecommitdiff
path: root/hw/watchdog
diff options
context:
space:
mode:
authorMao Chuan Li <maochuan@linux.vnet.ibm.com>2015-02-05 18:28:36 +0800
committerChristian Borntraeger <borntraeger@de.ibm.com>2015-06-11 17:45:50 +0200
commit795dc6e46d953d70b4b7ddd3f4956f8f4b9d8565 (patch)
treeedca133f06b93785714ca44e59cc2c0f0bde6336 /hw/watchdog
parentf9a535e089abcbc7ac99db83c8c6e4644e395b12 (diff)
downloadqemu-795dc6e46d953d70b4b7ddd3f4956f8f4b9d8565.zip
watchdog: Add new Virtual Watchdog action INJECT-NMI
This patch allows QEMU to inject a NMI into a guest when the watchdog expires. Signed-off-by: Mao Chuan Li <maochuan@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> CC: Eric Blake <eblake@redhat.com> CC: Markus Armbruster <armbru@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'hw/watchdog')
-rw-r--r--hw/watchdog/watchdog.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
index 54440c91c5..8d4b0eeeb0 100644
--- a/hw/watchdog/watchdog.c
+++ b/hw/watchdog/watchdog.c
@@ -27,6 +27,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/watchdog.h"
#include "qapi-event.h"
+#include "hw/nmi.h"
/* Possible values for action parameter. */
#define WDT_RESET 1 /* Hard reset. */
@@ -35,6 +36,7 @@
#define WDT_PAUSE 4 /* Pause. */
#define WDT_DEBUG 5 /* Prints a message and continues running. */
#define WDT_NONE 6 /* Do nothing. */
+#define WDT_NMI 7 /* Inject nmi into the guest */
static int watchdog_action = WDT_RESET;
static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
@@ -95,6 +97,8 @@ int select_watchdog_action(const char *p)
watchdog_action = WDT_DEBUG;
else if (strcasecmp(p, "none") == 0)
watchdog_action = WDT_NONE;
+ else if (strcasecmp(p, "inject-nmi") == 0)
+ watchdog_action = WDT_NMI;
else
return -1;
@@ -138,5 +142,11 @@ void watchdog_perform_action(void)
case WDT_NONE:
qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, &error_abort);
break;
+
+ case WDT_NMI:
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_INJECT_NMI,
+ &error_abort);
+ inject_nmi();
+ break;
}
}