@@ -1498,3 +1498,15 @@
# Since: 0.14.0
##
{ 'option': 'vnc', 'data': 'VncConfig', 'implicit': 'address' }
+
+##
+# @inject-nmi:
+#
+# Inject an NMI on the guest.
+#
+# Returns: Nothing on success.
+# If the guest(non-x86) does not support NMI injection, Unsupported
+#
+# Since: 0.15.0
+##
+{ 'command': 'inject-nmi' }
@@ -379,3 +379,20 @@ StatusInfo *qmp_query_status(Error **errp)
return info;
}
+
+#if defined(TARGET_I386)
+void qmp_inject_nmi(Error **errp)
+{
+ CPUState *env;
+
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ cpu_interrupt(env, CPU_INTERRUPT_NMI);
+ }
+}
+#else
+void qmp_inject_nmi(Error **errp)
+{
+ error_set(errp, QERR_UNSUPPORTED,
+ "Injecting NMI is unsupported for the non-x86 guest");
+}
+#endif
inject-nmi command injects an NMI on all CPUs of guest. It is only supported for x86 guest currently, it will returns "Unsupported" error for non-x86 guest. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> --- qapi-schema.json | 12 ++++++++++++ qmp.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)