@@ -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
{
@@ -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;
@@ -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);
@@ -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);
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(-)