monitor: Do not check TARGET_I386 to build target/i386/ commands

These commands are filtered at build-time for i386/x86_64 binaries.
By using the recently introduced HMPCommand::arch_bitmask flag
we can filter them at runtime, making it possible to compile
hmp-commands[-info].hx files once.

Since these methods are used inconditionally within target/i386/,
define them in the same stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-15-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé
2026-04-10 19:57:31 +02:00
parent 1d6cf922e4
commit 7c8730243e
5 changed files with 17 additions and 7 deletions

View File

@@ -149,6 +149,7 @@ F: configs/targets/i386-softmmu.mak
F: configs/targets/x86_64-softmmu.mak
F: docs/system/i386/
F: docs/system/target-i386*
F: stubs/hmp-cmds-target-i386.c
F: target/i386/*.[ch]
F: target/i386/Kconfig
F: target/i386/meson.build

View File

@@ -106,16 +106,14 @@ SRST
Show the cpu registers.
ERST
#if defined(TARGET_I386)
{
.name = "lapic",
.args_type = "apic-id:i?",
.params = "[apic-id]",
.help = "show local apic state (apic-id: local apic to read, default is which of current CPU)",
.cmd = hmp_info_local_apic,
.arch_bitmask = QEMU_ARCH_I386,
},
#endif
SRST
``info lapic``

View File

@@ -1502,18 +1502,15 @@ SRST
Stop the QEMU embedded NBD server.
ERST
#if defined(TARGET_I386)
{
.name = "mce",
.args_type = "broadcast:-b,cpu_index:i,bank:i,status:l,mcg_status:l,addr:l,misc:l",
.params = "[-b] cpu bank status mcgstatus addr misc",
.help = "inject a MCE on the given CPU [and broadcast to other CPUs with -b option]",
.cmd = hmp_mce,
.arch_bitmask = QEMU_ARCH_I386,
},
#endif
SRST
``mce`` *cpu* *bank* *status* *mcgstatus* *addr* *misc*
Inject an MCE on the given CPU (x86 only).

View File

@@ -0,0 +1,13 @@
/*
* Human Monitor x86 stubs
*
* Copyright (c) Linaro
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "monitor/hmp.h"
HMP_STUB(info_local_apic)
HMP_STUB(mce)

View File

@@ -88,6 +88,7 @@ if have_system
stub_ss.add(files('qmp-cpu-s390x.c'))
stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
stub_ss.add(files('hmp-cmds-hw-s390x.c'))
stub_ss.add(files('hmp-cmds-target-i386.c'))
endif
if have_system or have_user