qemu/target-info: Factor target_arch() out

To keep "qemu/target-info.h" self-contained to native
types, declare target_arch() -- which returns a QAPI
type -- in "qemu/target-info-qapi.h".

No logical change.

Keeping native types in "qemu/target-info.h" is necessary
to keep building tests such tests/tcg/plugins/mem.c, as
per the comment added in commit ecbcc9ead2 ("tests/tcg:
add a system test to check memory instrumentation"):

/*
 * plugins should not include anything from QEMU aside from the
 * API header. However as this is a test plugin to exercise the
 * internals of QEMU and we want to avoid needless code duplication we
 * do so here. bswap.h is pretty self-contained although it needs a
 * few things provided by compiler.h.
 */

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250708215320.70426-3-philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2025-07-08 23:53:13 +02:00 committed by Michael S. Tsirkin
parent fafcff5f30
commit 0af00042a9
4 changed files with 33 additions and 6 deletions

View file

@ -8,7 +8,9 @@
#include "qemu/osdep.h"
#include "qemu/target-info.h"
#include "qemu/target-info-qapi.h"
#include "qemu/target-info-impl.h"
#include "qapi/error.h"
const char *target_name(void)
{
@ -20,6 +22,12 @@ unsigned target_long_bits(void)
return target_info()->long_bits;
}
SysEmuTarget target_arch(void)
{
return qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
&error_abort);
}
const char *target_cpu_type(void)
{
return target_info()->cpu_type;