]> git.proxmox.com Git - qemu.git/commitdiff
QMP: add inject-nmi qmp command
authorLai Jiangshan <laijs@cn.fujitsu.com>
Mon, 7 Mar 2011 09:05:15 +0000 (17:05 +0800)
committerLuiz Capitulino <lcapitulino@redhat.com>
Wed, 1 Jun 2011 14:42:25 +0000 (11:42 -0300)
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: Luiz Capitulino <lcapitulino@redhat.com>
monitor.c
qmp-commands.hx

index f63cce050f130cb84adc3d30aa52563ef22e5308..81d3c9b7481525800065e42d590c58d8a5e7a98e 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -2555,6 +2555,23 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict)
             break;
         }
 }
+
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    CPUState *env;
+
+    for (env = first_cpu; env != NULL; env = env->next_cpu) {
+        cpu_interrupt(env, CPU_INTERRUPT_NMI);
+    }
+
+    return 0;
+}
+#else
+static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    qerror_report(QERR_UNSUPPORTED);
+    return -1;
+}
 #endif
 
 static void do_info_status_print(Monitor *mon, const QObject *data)
index a9f109a391e9cfcb650ccde70f5e03c32ea60e09..ae08b7a59dc5e4ea582eae8b02acccc8091c7e4c 100644 (file)
@@ -427,6 +427,33 @@ Example:
                             "filename": "/tmp/physical-mem-dump" } }
 <- { "return": {} }
 
+EQMP
+
+    {
+        .name       = "inject-nmi",
+        .args_type  = "",
+        .params     = "",
+        .help       = "",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_inject_nmi_all,
+    },
+
+SQMP
+inject-nmi
+----------
+
+Inject an NMI on guest's CPUs.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "inject-nmi" }
+<- { "return": {} }
+
+Note: inject-nmi is only supported for x86 guest currently, it will
+      returns "Unsupported" error for non-x86 guest.
+
 EQMP
 
     {