From patchwork Wed Apr 20 06:19:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lai Jiangshan X-Patchwork-Id: 720641 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3K6HV2Z025884 for ; Wed, 20 Apr 2011 06:17:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752647Ab1DTGRS (ORCPT ); Wed, 20 Apr 2011 02:17:18 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:59275 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752148Ab1DTGRR (ORCPT ); Wed, 20 Apr 2011 02:17:17 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 4CA8517012E; Wed, 20 Apr 2011 14:17:15 +0800 (CST) Received: from mailserver.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p3K6HESB029409; Wed, 20 Apr 2011 14:17:14 +0800 Received: from lai.fc14.fnst ([10.167.225.146]) by mailserver.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011042014174815-103283 ; Wed, 20 Apr 2011 14:17:48 +0800 Message-ID: <4DAE7AFE.5030508@cn.fujitsu.com> Date: Wed, 20 Apr 2011 14:19:42 +0800 From: Lai Jiangshan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4 MIME-Version: 1.0 To: Luiz Capitulino CC: Anthony Liguori , Lai Jiangshan , kvm@vger.kernel.org, Markus Armbruster , qemu-devel@nongnu.org, Avi Kivity , "Daniel P. Berrange" Subject: [RFC PATCH 3/3 V8] qapi-hmp: Convert HMP nmi to use QMP References: <4D74A8C9.2020408@cn.fujitsu.com> <4D74A974.6090509@cn.fujitsu.com> <20110404105949.GA30324@redhat.com> <4D99BF99.1040305@redhat.com> <4D99C22C.4070401@codemonkey.ws> <20110406144723.45333682@doriath> <4D9CAAF9.7000509@codemonkey.ws> <20110406150818.56707b9b@doriath> In-Reply-To: <20110406150818.56707b9b@doriath> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-04-20 14:17:48, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-04-20 14:17:48, Serialize complete at 2011-04-20 14:17:48 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 20 Apr 2011 06:17:51 +0000 (UTC) Convert the name of HMP nmi to inject-nmi, and use QMP inject-nmi. The behavier is also changed, it injects NMI to all CPUs of the guest. When the guest is non-x86, it reports "Unsupported" error. Signed-off-by: Lai Jiangshan --- hmp-commands.hx | 18 ++++++++---------- hmp.c | 12 ++++++++++++ hmp.h | 1 + monitor.c | 14 -------------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index c0719eb..70a9dd9 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -705,19 +705,17 @@ The values that can be specified here depend on the machine type, but are the same that can be specified in the @code{-boot} command line option. 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, + .name = "inject-nmi", + .args_type = "", + .params = "", + .help = "inject an NMI on the guest", + .mhandler.cmd = hmp_inject_nmi, }, -#endif STEXI -@item nmi @var{cpu} -@findex nmi -Inject an NMI on the given CPU (x86 only). +@item inject-nmi +@findex inject-nmi +Inject an NMI on the guest (x86 only). ETEXI { diff --git a/hmp.c b/hmp.c index 758b085..07170fd 100644 --- a/hmp.c +++ b/hmp.c @@ -369,6 +369,18 @@ void hmp_closefd(Monitor *mon, const QDict *qdict) monitor_printf(mon, "closefd: Command Not Supported, use QMP\n"); } +void hmp_inject_nmi(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + + qmp_inject_nmi(&err); + + if (err) { + monitor_printf(mon, "inject-nmi: %s\n", error_get_pretty(err)); + error_free(err); + } +} + void hmp_info_version(Monitor *mon) { VersionInfo *info; diff --git a/hmp.h b/hmp.h index d205b3e..3bc1f54 100644 --- a/hmp.h +++ b/hmp.h @@ -31,6 +31,7 @@ void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); void hmp_getfd(Monitor *mon, const QDict *qdict); void hmp_closefd(Monitor *mon, const QDict *qdict); +void hmp_inject_nmi(Monitor *mon, const QDict *qdict); void hmp_info_version(Monitor *mon); void hmp_info_status(Monitor *mon); diff --git a/monitor.c b/monitor.c index 25a4ab5..925c143 100644 --- a/monitor.c +++ b/monitor.c @@ -1768,20 +1768,6 @@ 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; - } -} -#endif - static qemu_acl *find_acl(Monitor *mon, const char *name) { qemu_acl *acl = qemu_acl_find(name);