From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj155-0005xU-QF for qemu-devel@nongnu.org; Fri, 17 Apr 2015 03:52:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yj152-0006Xz-Vb for qemu-devel@nongnu.org; Fri, 17 Apr 2015 03:52:55 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:45839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj152-0006XB-Ma for qemu-devel@nongnu.org; Fri, 17 Apr 2015 03:52:52 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 17 Apr 2015 08:52:50 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0F61B2190063 for ; Fri, 17 Apr 2015 08:52:33 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t3H7qmuR60882992 for ; Fri, 17 Apr 2015 07:52:48 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t3H2lDDj007642 for ; Thu, 16 Apr 2015 22:47:13 -0400 From: Cornelia Huck Date: Fri, 17 Apr 2015 09:52:41 +0200 Message-Id: <1429257161-29597-7-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1429257161-29597-1-git-send-email-cornelia.huck@de.ibm.com> References: <1429257161-29597-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 6/6] watchdog: Add new Virtual Watchdog action INJECT-NMI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com, mdroth@linux.vnet.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Mao Chuan Li , Cornelia Huck , lcapitulino@redhat.com From: Mao Chuan Li This patch allows QEMU to inject a NMI into a guest when the watchdog expires. Signed-off-by: Mao Chuan Li Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- 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 ac9594d..2d3bce2 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3606,10 +3606,14 @@ # # @none: nothing is done # +# @inject-nmi: a non-maskable interrupt is injected into the first VCPU (all +# VCPUS on x86) +# # Since: 2.1 ## { 'enum': 'WatchdogExpirationAction', - 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none' ] } + 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none', + 'inject-nmi' ] } ## # @IoOperationType -- 2.3.5