From patchwork Fri Apr 29 22:40:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 93486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4C30BB6EF0 for ; Sat, 30 Apr 2011 08:41:04 +1000 (EST) Received: from localhost ([::1]:40653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFwMv-0007KS-GJ for incoming@patchwork.ozlabs.org; Fri, 29 Apr 2011 18:41:01 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFwMX-0007FI-BD for qemu-devel@nongnu.org; Fri, 29 Apr 2011 18:40:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFwMT-0007nC-Q7 for qemu-devel@nongnu.org; Fri, 29 Apr 2011 18:40:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFwMT-0007md-1p for qemu-devel@nongnu.org; Fri, 29 Apr 2011 18:40:33 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3TMeTT7024696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Apr 2011 18:40:29 -0400 Received: from localhost (ovpn-113-116.phx2.redhat.com [10.3.113.116]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3TMeSrb032542; Fri, 29 Apr 2011 18:40:29 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 29 Apr 2011 19:40:21 -0300 Message-Id: <1304116821-18201-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1304116821-18201-1-git-send-email-lcapitulino@redhat.com> References: <1304116821-18201-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: armbru@redhat.com, laijs@cn.fujitsu.com Subject: [Qemu-devel] [PATCH 3/3] HMP: Use QMP inject nmi implementation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This **CHANGES** the human monitor "nmi" command behavior. Currently it accepts an CPU argument which, when provided, will send the NMI to the specified CPU. This feature is of discussable value though and HMP shouldn't have more features than QMP, so let's use QMP's instead (it's also simpler). Signed-off-by: Luiz Capitulino --- hmp-commands.hx | 9 +++++---- monitor.c | 16 ++-------------- qmp-commands.hx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 834e6a8..6ad8806 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -740,10 +740,11 @@ ETEXI #if defined(TARGET_I386) { .name = "nmi", - .args_type = "cpu_index:i", - .params = "cpu", - .help = "inject an NMI on the given CPU", - .mhandler.cmd = do_inject_nmi, + .args_type = "", + .params = "", + .help = "inject an NMI on all guest's CPUs", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_inject_nmi, }, #endif STEXI diff --git a/monitor.c b/monitor.c index 455a528..1ba98b0 100644 --- a/monitor.c +++ b/monitor.c @@ -2544,19 +2544,7 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict) #endif #if defined(TARGET_I386) -static void do_inject_nmi(Monitor *mon, const QDict *qdict) -{ - CPUState *env; - int cpu_index = qdict_get_int(qdict, "cpu_index"); - - for (env = first_cpu; env != NULL; env = env->next_cpu) - if (env->cpu_index == cpu_index) { - cpu_interrupt(env, CPU_INTERRUPT_NMI); - break; - } -} - -static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data) +static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data) { CPUState *env; @@ -2567,7 +2555,7 @@ static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_dat return 0; } #else -static int do_inject_nmi_all(Monitor *mon, const QDict *qdict, QObject **ret_data) +static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data) { qerror_report(QERR_UNSUPPORTED); return -1; diff --git a/qmp-commands.hx b/qmp-commands.hx index 1058c38..1957730 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -435,7 +435,7 @@ EQMP .params = "", .help = "", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_inject_nmi_all, + .mhandler.cmd_new = do_inject_nmi, }, SQMP