qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Lai Jiangshan <eag0628@gmail.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org,
	Markus Armbruster <armbru@redhat.com>,
	Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [RFC PATCH 3/3 V8] qapi-hmp: Convert HMP nmi to use QMP
Date: Wed, 20 Apr 2011 14:19:42 +0800	[thread overview]
Message-ID: <4DAE7AFE.5030508@cn.fujitsu.com> (raw)
In-Reply-To: <20110406150818.56707b9b@doriath>


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 <laijs@cn.fujitsu.com>
---
 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);
-- 
1.7.4

      parent reply	other threads:[~2011-04-20  6:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07  9:43 [Qemu-devel] [PATCH 0/2 V7] add inject-nmi qmp command Lai Jiangshan
2011-03-07  9:45 ` [Qemu-devel] [PATCH 1/2] qemu,qmp: QError: New QERR_UNSUPPORTED Lai Jiangshan
2011-03-07  9:46 ` [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: add inject-nmi qmp command Lai Jiangshan
2011-04-04 10:59   ` Daniel P. Berrange
2011-04-04 12:19     ` Markus Armbruster
2011-04-04 13:04       ` Luiz Capitulino
2011-04-04 13:09       ` Anthony Liguori
2011-04-04 13:34         ` Luiz Capitulino
2011-04-20  1:53         ` [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: " Lai Jiangshan
2011-04-20  3:02           ` Lai Jiangshan
2011-04-25 15:00           ` Luiz Capitulino
2011-04-04 12:54     ` [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: " Avi Kivity
2011-04-04 13:05       ` Anthony Liguori
2011-04-06 17:47         ` Luiz Capitulino
2011-04-06 18:03           ` Anthony Liguori
2011-04-06 18:08             ` Luiz Capitulino
2011-04-06 18:17               ` Jan Kiszka
2011-04-06 19:00                 ` Luiz Capitulino
2011-04-06 19:27                   ` Peter Maydell
2011-04-06 19:34                     ` Anthony Liguori
2011-04-07  7:29                       ` Jan Kiszka
2011-04-07 18:10                       ` Peter Maydell
2011-04-07 18:32                         ` Anthony Liguori
2011-04-07 18:51                           ` Gleb Natapov
2011-04-07 19:04                             ` Blue Swirl
2011-04-07 19:17                               ` Gleb Natapov
2011-04-07 21:41                                 ` Anthony Liguori
2011-04-08  6:04                                   ` Gleb Natapov
2011-04-08 19:17                                     ` Blue Swirl
2011-04-08 19:32                                       ` Anthony Liguori
2011-04-08 20:07                                         ` Blue Swirl
2011-05-03 10:01                                       ` [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: " Jamie Lokier
2011-04-10  8:52                                   ` [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: " Avi Kivity
2011-04-11  7:01                                     ` Markus Armbruster
2011-04-11 17:15                                       ` [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: " Blue Swirl
2011-04-12  7:52                                         ` Avi Kivity
2011-04-12 18:31                                           ` Blue Swirl
2011-04-13 13:08                                             ` Luiz Capitulino
2011-04-13 19:56                                               ` Blue Swirl
2011-04-14  6:41                                                 ` Markus Armbruster
2011-04-14  9:55                                                 ` Daniel P. Berrange
2011-04-15 16:37                                                   ` Blue Swirl
2011-04-07 21:39                             ` [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: " Anthony Liguori
2011-04-08  5:54                               ` Gleb Natapov
2011-05-03  9:54                                 ` [Qemu-devel] [PATCH 2/2 V7] qemu, qmp: " Jamie Lokier
2011-04-10  8:57                               ` [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: " Avi Kivity
2011-04-20  6:19               ` [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: " Lai Jiangshan
2011-04-21  3:23                 ` Lai Jiangshan
2011-04-26 13:26                   ` Luiz Capitulino
2011-04-26 13:29                     ` Anthony Liguori
2011-04-27  1:54                       ` Lai Jiangshan
2011-04-27 14:33                         ` Luiz Capitulino
2011-04-28  3:35                           ` [Qemu-devel] [PATCH 0/2 V9] hmp,qmp: add inject-nmi Lai Jiangshan
2011-04-29 22:24                             ` Luiz Capitulino
2011-04-28  3:35                           ` [Qemu-devel] [PATCH 1/2 V9] qemu, qmp: QError: New QERR_UNSUPPORTED Lai Jiangshan
2011-04-28  3:35                           ` [Qemu-devel] [PATCH 2/2 V9] qmp, inject-nmi: convert do_inject_nmi() to QObject Lai Jiangshan
2011-04-25 17:07                 ` [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command Michael Roth
2011-04-20  6:19               ` [Qemu-devel] [RFC PATCH 1/3 V8] QError: Introduce QERR_UNSUPPORTED Lai Jiangshan
2011-04-20  6:19               ` [Qemu-devel] [RFC PATCH 2/3 V8] qapi, nmi: add inject-nmi qmp command Lai Jiangshan
2011-04-20  6:19               ` Lai Jiangshan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DAE7AFE.5030508@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=eag0628@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).