Received: from eggs.gnu.org ([140.186.70.92]:52816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRtsU-0007Zp-Bh for qemu-devel@nongnu.org; Wed, 01 Jun 2011 18:27:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRtsS-0005FM-KT for qemu-devel@nongnu.org; Wed, 01 Jun 2011 18:27:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRnka-00070Z-Kj for qemu-devel@nongnu.org; Wed, 01 Jun 2011 11:54:28 -0400 From: Luiz Capitulino Date: Wed, 1 Jun 2011 12:54:02 -0300 Message-Id: <1306943645-20313-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1306943645-20313-1-git-send-email-lcapitulino@redhat.com> References: <1306943645-20313-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 2/5] QMP: add inject-nmi qmp command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: Lai Jiangshan , qemu-devel@nongnu.org, armbru@redhat.com From: Lai Jiangshan 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 --- monitor.c | 17 +++++++++++++++++ qmp-commands.hx | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-) diff --git a/monitor.c b/monitor.c index f63cce0..81d3c9b 100644 --- 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) diff --git a/qmp-commands.hx b/qmp-commands.hx index a9f109a..ae08b7a 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -430,6 +430,33 @@ Example: 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 + + { .name = "migrate", .args_type = "detach:-d,blk:-b,inc:-i,uri:s", .params = "[-d] [-b] [-i] uri", -- 1.7.4.4