@samitouri / QOSamiQemu / commits / e935ce6e2c

monitor: Do not check TARGET_I386 to build 'info sev' command

This command is filtered at build-time for i386/x86_64 binaries. By using the recently introduced HMPCommand::arch_bitmask flag we can filter it at runtime, making it possible to compile hmp-commands-info.hx once. Since the method depends on the CONFIG_SEV definition, 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-17-philmd@linaro.org>

Philippe Mathieu-Daudé committed Apr 10, 2026 at 19:42 UTC e935ce6e2ca6c54a2f7e7f2418f22510fa5f72fb
5 files changed +19 -7
MAINTAINERS
+1
@@ -515,6 +515,7 @@ S: Supported
515 F: docs/system/i386/amd-memory-encryption.rst
516 F: docs/system/i386/sgx.rst
517 F: hw/i386/sgx*
518 +F: stubs/hmp-cmd-info_sev.c
519 F: stubs/qmp-i386-sev.c
520 F: stubs/qmp-i386-sgx.c
521 F: target/i386/kvm/
hmp-commands-info.hx
+1 -2
@@ -805,15 +805,14 @@ SRST
805 enabled) memory in bytes.
806 ERST
807
808 -#if defined(TARGET_I386)
808 {
809 .name = "sev",
810 .args_type = "",
811 .params = "",
812 .help = "show SEV information",
813 .cmd = hmp_info_sev,
814 + .arch_bitmask = QEMU_ARCH_I386,
815 },
816 -#endif
816
817 SRST
818 ``info sev``
stubs/hmp-cmd-info_sev.c new
+16
@@ -0,0 +1,16 @@
1 +/*
2 + * Human Monitor 'info sev' stub (CONFIG_SEV)
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 +#include "monitor/monitor.h"
12 +
13 +void hmp_info_sev(Monitor *mon, const QDict *qdict)
14 +{
15 + monitor_printf(mon, "SEV is not available in this QEMU\n");
16 +}
stubs/meson.build
+1
@@ -87,6 +87,7 @@ if have_system
87 stub_ss.add(files('qmp-cpu.c'))
88 stub_ss.add(files('qmp-cpu-s390x.c'))
89 stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
90 + stub_ss.add(files('hmp-cmd-info_sev.c'))
91 stub_ss.add(files('hmp-cmds-hw-s390x.c'))
92 stub_ss.add(files('hmp-cmds-target-i386.c'))
93 endif
target/i386/sev-system-stub.c
-5
@@ -32,11 +32,6 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size)
32 g_assert_not_reached();
33 }
34
35 -void hmp_info_sev(Monitor *mon, const QDict *qdict)
36 -{
37 - monitor_printf(mon, "SEV is not available in this QEMU\n");
38 -}
39 -
35 void pc_system_parse_sev_metadata(uint8_t *flash_ptr, size_t flash_size)
36 {
37 }