@samitouri / QOSamiQemu / commits / bb1573600b

monitor: Do not check multiple TARGET_* to build 'info tlb' command

This command is filtered at build-time for a selection of 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 once. Since the method depends on a pair of distinct targets, define it in its own stub file. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260427080738.77138-19-philmd@linaro.org>

Philippe Mathieu-Daudé committed Apr 10, 2026 at 19:09 UTC bb1573600b2d3435a9572ab65ac366f824ac00f3
3 files changed +15 -3
hmp-commands-info.hx
+2 -3
@@ -186,16 +186,15 @@ SRST
186 Show PCI information.
187 ERST
188
189 -#if defined(TARGET_I386) || defined(TARGET_SH4) || defined(TARGET_SPARC) || \
190 - defined(TARGET_PPC) || defined(TARGET_XTENSA) || defined(TARGET_M68K)
189 {
190 .name = "tlb",
191 .args_type = "",
192 .params = "",
193 .help = "show virtual to physical memory mappings",
194 .cmd = hmp_info_tlb,
195 + .arch_bitmask = QEMU_ARCH_I386 | QEMU_ARCH_SH4 | QEMU_ARCH_SPARC \
196 + | QEMU_ARCH_PPC | QEMU_ARCH_XTENSA | QEMU_ARCH_M68K,
197 },
198 -#endif
198
199 SRST
200 ``info tlb``
stubs/hmp-cmd-info_tlb.c new
+12
@@ -0,0 +1,12 @@
1 +/*
2 + * Human Monitor 'info tlb' stub
3 + *
4 + * Copyright (c) Linaro
5 + *
6 + * SPDX-License-Identifier: GPL-2.0-or-later
7 + */
8 +
9 +#include "qemu/osdep.h"
10 +#include "monitor/hmp.h"
11 +
12 +HMP_STUB(info_tlb)
stubs/meson.build
+1
@@ -89,6 +89,7 @@ if have_system
89 stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
90 stub_ss.add(files('hmp-cmd-info_mem.c'))
91 stub_ss.add(files('hmp-cmd-info_sev.c'))
92 + stub_ss.add(files('hmp-cmd-info_tlb.c'))
93 stub_ss.add(files('hmp-cmds-hw-s390x.c'))
94 stub_ss.add(files('hmp-cmds-target-i386.c'))
95 endif