[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2 V9] qmp, inject-nmi: convert do_inject_nmi() to
From: |
Lai Jiangshan |
Subject: |
[Qemu-devel] [PATCH 2/2 V9] qmp, inject-nmi: convert do_inject_nmi() to QObject |
Date: |
Thu, 28 Apr 2011 11:35:33 +0800 |
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 |
Make we can inject NMI via qemu-monitor-protocol.
We use "inject-nmi" for the command name, the meaning is clearer.
The behavior is cheanged to "injecting NMI to all CPU" which
simulates the Real hardware NMI button.
The command "inject-nmi" is only supported for x86 guest
currently, it will returns "Unsupported" error for non-x86 guest.
This error and this behavior are described in the comments.
Signed-off-by: Lai Jiangshan <address@hidden>
---
hmp-commands.hx | 21 +++++++++++----------
monitor.c | 20 +++++++++++++-------
qmp-commands.hx | 29 +++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 17 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 834e6a8..b511850 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -737,19 +737,20 @@ 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 guest.\n"
+ "Returns \"Unsupported\" error when the guest does"
+ "not support NMI injection",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_inject_nmi,
},
-#endif
STEXI
address@hidden nmi @var{cpu}
address@hidden nmi
-Inject an NMI on the given CPU (x86 only).
address@hidden inject-nmi
address@hidden inject-nmi
+Inject an NMI on the guest (x86 only).
ETEXI
{
diff --git a/monitor.c b/monitor.c
index 5f3bc72..129eed1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2544,16 +2544,22 @@ 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)
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
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;
- }
+ for (env = first_cpu; env != NULL; env = env->next_cpu) {
+ cpu_interrupt(env, CPU_INTERRUPT_NMI);
+ }
+
+ return 0;
+}
+#else
+static int do_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ qerror_report(QERR_UNSUPPORTED,
+ "Injecting NMI is unsupported for the non-x86 guest");
+ return -1;
}
#endif
diff --git a/qmp-commands.hx b/qmp-commands.hx
index fbd98ee..e1b9b40 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -430,6 +430,35 @@ Example:
EQMP
{
+ .name = "inject-nmi",
+ .args_type = "",
+ .params = "",
+ .help = "Inject an NMI on guest.\n"
+ "Returns \"Unsupported\" error when the guest does"
+ "not support NMI injection",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_inject_nmi,
+ },
+
+SQMP
+inject-nmi
+----------
+
+Inject an NMI on guest.
+
+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
- Re: [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: add inject-nmi qmp command, (continued)
- Re: [Qemu-devel] [PATCH 2/2 V7] qemu,qmp: add inject-nmi qmp command, Avi Kivity, 2011/04/10
- [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Lai Jiangshan, 2011/04/20
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Lai Jiangshan, 2011/04/20
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Luiz Capitulino, 2011/04/26
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Anthony Liguori, 2011/04/26
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Lai Jiangshan, 2011/04/26
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Luiz Capitulino, 2011/04/27
- [Qemu-devel] [PATCH 1/2 V9] qemu, qmp: QError: New QERR_UNSUPPORTED, Lai Jiangshan, 2011/04/27
- [Qemu-devel] [PATCH 0/2 V9] hmp,qmp: add inject-nmi, Lai Jiangshan, 2011/04/27
- Re: [Qemu-devel] [PATCH 0/2 V9] hmp,qmp: add inject-nmi, Luiz Capitulino, 2011/04/29
- [Qemu-devel] [PATCH 2/2 V9] qmp, inject-nmi: convert do_inject_nmi() to QObject,
Lai Jiangshan <=
- Re: [Qemu-devel] [RFC PATCH 0/3 V8] QAPI: add inject-nmi qmp command, Michael Roth, 2011/04/25
- [Qemu-devel] [RFC PATCH 1/3 V8] QError: Introduce QERR_UNSUPPORTED, Lai Jiangshan, 2011/04/20
- [Qemu-devel] [RFC PATCH 2/3 V8] qapi, nmi: add inject-nmi qmp command, Lai Jiangshan, 2011/04/20
- [Qemu-devel] [RFC PATCH 3/3 V8] qapi-hmp: Convert HMP nmi to use QMP, Lai Jiangshan, 2011/04/20