[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] watchdog: Add new Virtual Watchdog action INJEC
From: |
Christian Borntraeger |
Subject: |
[Qemu-devel] [PATCH 6/6] watchdog: Add new Virtual Watchdog action INJECT-NMI |
Date: |
Thu, 11 Jun 2015 17:53:33 +0200 |
From: Mao Chuan Li <address@hidden>
This patch allows QEMU to inject a NMI into a guest when the
watchdog expires.
Signed-off-by: Mao Chuan Li <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
CC: Eric Blake <address@hidden>
CC: Markus Armbruster <address@hidden>
Signed-off-by: Christian Borntraeger <address@hidden>
---
hw/watchdog/watchdog.c | 10 ++++++++++
qapi-schema.json | 6 +++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
index 54440c9..8d4b0ee 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;
}
}
diff --git a/qapi-schema.json b/qapi-schema.json
index 6e17a5c..c4ee3ea 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3746,10 +3746,14 @@
#
# @none: nothing is done
#
+# @inject-nmi: a non-maskable interrupt is injected into the first VCPU (all
+# VCPUS on x86) (since 2.4)
+#
# Since: 2.1
##
{ 'enum': 'WatchdogExpirationAction',
- 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none' ] }
+ 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
+ 'inject-nmi' ] }
##
# @IoOperationType
--
2.3.0
- [Qemu-devel] [PATCH 0/6] s390x/watchdog: add diag288 based watchdog, Christian Borntraeger, 2015/06/11
- [Qemu-devel] [PATCH 5/6] nmi: Implement inject_nmi() for non-monitor context use, Christian Borntraeger, 2015/06/11
- [Qemu-devel] [PATCH 2/6] s390x/watchdog: introduce diag288 watchdog device, Christian Borntraeger, 2015/06/11
- [Qemu-devel] [PATCH 3/6] s390x/kvm: diag288 instruction interception and handling, Christian Borntraeger, 2015/06/11
- [Qemu-devel] [PATCH 1/6] watchdog: change option wording to allow for more watchdogs, Christian Borntraeger, 2015/06/11
- [Qemu-devel] [PATCH 6/6] watchdog: Add new Virtual Watchdog action INJECT-NMI,
Christian Borntraeger <=
- [Qemu-devel] [PATCH 4/6] s390x/watchdog: diag288 migration support, Christian Borntraeger, 2015/06/11