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>
This commit is contained in:
parent
f9a535e089
commit
795dc6e46d
@ -27,6 +27,7 @@
|
|||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "sysemu/watchdog.h"
|
#include "sysemu/watchdog.h"
|
||||||
#include "qapi-event.h"
|
#include "qapi-event.h"
|
||||||
|
#include "hw/nmi.h"
|
||||||
|
|
||||||
/* Possible values for action parameter. */
|
/* Possible values for action parameter. */
|
||||||
#define WDT_RESET 1 /* Hard reset. */
|
#define WDT_RESET 1 /* Hard reset. */
|
||||||
@ -35,6 +36,7 @@
|
|||||||
#define WDT_PAUSE 4 /* Pause. */
|
#define WDT_PAUSE 4 /* Pause. */
|
||||||
#define WDT_DEBUG 5 /* Prints a message and continues running. */
|
#define WDT_DEBUG 5 /* Prints a message and continues running. */
|
||||||
#define WDT_NONE 6 /* Do nothing. */
|
#define WDT_NONE 6 /* Do nothing. */
|
||||||
|
#define WDT_NMI 7 /* Inject nmi into the guest */
|
||||||
|
|
||||||
static int watchdog_action = WDT_RESET;
|
static int watchdog_action = WDT_RESET;
|
||||||
static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
|
static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
|
||||||
@ -95,6 +97,8 @@ int select_watchdog_action(const char *p)
|
|||||||
watchdog_action = WDT_DEBUG;
|
watchdog_action = WDT_DEBUG;
|
||||||
else if (strcasecmp(p, "none") == 0)
|
else if (strcasecmp(p, "none") == 0)
|
||||||
watchdog_action = WDT_NONE;
|
watchdog_action = WDT_NONE;
|
||||||
|
else if (strcasecmp(p, "inject-nmi") == 0)
|
||||||
|
watchdog_action = WDT_NMI;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -138,5 +142,11 @@ void watchdog_perform_action(void)
|
|||||||
case WDT_NONE:
|
case WDT_NONE:
|
||||||
qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, &error_abort);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WDT_NMI:
|
||||||
|
qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_INJECT_NMI,
|
||||||
|
&error_abort);
|
||||||
|
inject_nmi();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3746,10 +3746,14 @@
|
|||||||
#
|
#
|
||||||
# @none: nothing is done
|
# @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
|
# Since: 2.1
|
||||||
##
|
##
|
||||||
{ 'enum': 'WatchdogExpirationAction',
|
{ 'enum': 'WatchdogExpirationAction',
|
||||||
'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none' ] }
|
'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
|
||||||
|
'inject-nmi' ] }
|
||||||
|
|
||||||
##
|
##
|
||||||
# @IoOperationType
|
# @IoOperationType
|
||||||
|
Loading…
Reference in New Issue
Block a user