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>
This commit is contained in:
Philippe Mathieu-Daudé
2026-04-10 19:42:30 +02:00
parent c9e3f16410
commit e935ce6e2c
5 changed files with 19 additions and 7 deletions

View File

@@ -515,6 +515,7 @@ S: Supported
F: docs/system/i386/amd-memory-encryption.rst
F: docs/system/i386/sgx.rst
F: hw/i386/sgx*
F: stubs/hmp-cmd-info_sev.c
F: stubs/qmp-i386-sev.c
F: stubs/qmp-i386-sgx.c
F: target/i386/kvm/

View File

@@ -805,15 +805,14 @@ SRST
enabled) memory in bytes.
ERST
#if defined(TARGET_I386)
{
.name = "sev",
.args_type = "",
.params = "",
.help = "show SEV information",
.cmd = hmp_info_sev,
.arch_bitmask = QEMU_ARCH_I386,
},
#endif
SRST
``info sev``

16
stubs/hmp-cmd-info_sev.c Normal file
View File

@@ -0,0 +1,16 @@
/*
* Human Monitor 'info sev' stub (CONFIG_SEV)
*
* Copyright (c) Linaro
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "monitor/hmp.h"
#include "monitor/monitor.h"
void hmp_info_sev(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "SEV is not available in this QEMU\n");
}

View File

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

View File

@@ -32,11 +32,6 @@ int sev_es_save_reset_vector(void *flash_ptr, uint64_t flash_size)
g_assert_not_reached();
}
void hmp_info_sev(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "SEV is not available in this QEMU\n");
}
void pc_system_parse_sev_metadata(uint8_t *flash_ptr, size_t flash_size)
{
}