From patchwork Wed Apr 20 06:19:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lai Jiangshan X-Patchwork-Id: 92090 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 A3C6CB7054 for ; Wed, 20 Apr 2011 16:18:31 +1000 (EST) Received: from localhost ([::1]:59254 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCQk8-0004tJ-Pc for incoming@patchwork.ozlabs.org; Wed, 20 Apr 2011 02:18:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCQiz-0003Eh-Fd for qemu-devel@nongnu.org; Wed, 20 Apr 2011 02:17:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCQiy-0000n7-Ij for qemu-devel@nongnu.org; Wed, 20 Apr 2011 02:17:17 -0400 Received: from [222.73.24.84] (port=62776 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCQiy-0000mx-9s for qemu-devel@nongnu.org; Wed, 20 Apr 2011 02:17:16 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 6E4A5170128; Wed, 20 Apr 2011 14:17:14 +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 p3K6HDkK029405; Wed, 20 Apr 2011 14:17:13 +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 2011042014174448-103282 ; Wed, 20 Apr 2011 14:17:44 +0800 Message-ID: <4DAE7AFA.6030703@cn.fujitsu.com> Date: Wed, 20 Apr 2011 14:19:38 +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 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:44, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-04-20 14:17:47, Serialize complete at 2011-04-20 14:17:47 X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-Received-From: 222.73.24.84 Cc: Lai Jiangshan , kvm@vger.kernel.org, qemu-devel@nongnu.org, Markus Armbruster , Avi Kivity Subject: [Qemu-devel] [RFC PATCH 2/3 V8] qapi, nmi: add inject-nmi qmp command 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 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 --- qapi-schema.json | 12 ++++++++++++ qmp.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index de6c9a3..6a94d78 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -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' } diff --git a/qmp.c b/qmp.c index 9fdde8f..dac411a 100644 --- a/qmp.c +++ b/qmp.c @@ -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