* [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h'
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
@ 2025-04-03 23:48 ` Philippe Mathieu-Daudé
2025-04-04 16:41 ` Pierrick Bouvier
2025-04-03 23:48 ` [RFC PATCH-for-10.1 02/19] qemu: Convert target_name() to TargetInfo API Philippe Mathieu-Daudé
` (17 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:48 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
meson.build | 9 +++++++++
include/exec/poison.h | 1 +
include/qemu/target_info-impl.h | 21 +++++++++++++++++++++
include/qemu/target_info.h | 18 ++++++++++++++++++
target_info-stub.c | 23 +++++++++++++++++++++++
target_info.c | 16 ++++++++++++++++
6 files changed, 88 insertions(+)
create mode 100644 include/qemu/target_info-impl.h
create mode 100644 include/qemu/target_info.h
create mode 100644 target_info-stub.c
create mode 100644 target_info.c
diff --git a/meson.build b/meson.build
index bcb9d39a387..de9c9dacd35 100644
--- a/meson.build
+++ b/meson.build
@@ -3262,6 +3262,9 @@ host_kconfig = \
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
+target_info = [
+]
+
default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
actual_target_dirs = []
fdt_required = []
@@ -3368,6 +3371,9 @@ foreach target : target_dirs
config_target_data.set(k, v)
endif
endforeach
+ if target not in target_info
+ config_target_data.set('TARGET_INFO_STUB_NEEDED', 1)
+ endif
config_target_data.set('QEMU_ARCH',
'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper())
config_target_h += {target: configure_file(output: target + '-config-target.h',
@@ -3807,6 +3813,9 @@ endif
common_ss.add(pagevary)
specific_ss.add(files('page-target.c', 'page-vary-target.c'))
+specific_ss.add(files('target_info-stub.c'))
+common_ss.add(files('target_info.c'))
+
subdir('backends')
subdir('disas')
subdir('migration')
diff --git a/include/exec/poison.h b/include/exec/poison.h
index bc422719d80..00aedc41d82 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -38,6 +38,7 @@
#pragma GCC poison TARGET_BIG_ENDIAN
#pragma GCC poison TCG_GUEST_DEFAULT_MO
#pragma GCC poison TARGET_HAS_PRECISE_SMC
+#pragma GCC poison TARGET_INFO_STUB_NEEDED
#pragma GCC poison TARGET_LONG_BITS
#pragma GCC poison TARGET_FMT_lx
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
new file mode 100644
index 00000000000..b340e192fce
--- /dev/null
+++ b/include/qemu/target_info-impl.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU binary helpers
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_TARGET_INFO_IMPL_H
+#define QEMU_TARGET_INFO_IMPL_H
+
+#include "qemu/target_info.h"
+
+struct BinaryTargetInfo {
+
+ /* runtime equivalent of TARGET_INFO_STUB_NEEDED definition */
+ bool is_stub;
+
+};
+
+#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
new file mode 100644
index 00000000000..fab3f3153ea
--- /dev/null
+++ b/include/qemu/target_info.h
@@ -0,0 +1,18 @@
+/*
+ * QEMU binary helpers
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_TARGET_INFO_H
+#define QEMU_TARGET_INFO_H
+
+typedef struct BinaryTargetInfo BinaryTargetInfo;
+
+const BinaryTargetInfo *target_info(void);
+
+bool target_info_is_stub(void);
+
+#endif
diff --git a/target_info-stub.c b/target_info-stub.c
new file mode 100644
index 00000000000..d683a05977d
--- /dev/null
+++ b/target_info-stub.c
@@ -0,0 +1,23 @@
+/*
+ * QEMU target info stubs
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target_info-impl.h"
+
+#ifdef TARGET_INFO_STUB_NEEDED
+
+static const BinaryTargetInfo target_info_stub = {
+ .is_stub = true,
+};
+
+const BinaryTargetInfo *target_info(void)
+{
+ return &target_info_stub;
+}
+
+#endif /* TARGET_INFO_STUB_NEEDED */
diff --git a/target_info.c b/target_info.c
new file mode 100644
index 00000000000..cb17d29b86d
--- /dev/null
+++ b/target_info.c
@@ -0,0 +1,16 @@
+/*
+ * QEMU legacy binary helpers
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target_info-impl.h"
+#include "qemu/target_info.h"
+
+bool target_info_is_stub(void)
+{
+ return target_info()->is_stub;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h'
2025-04-03 23:48 ` [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h' Philippe Mathieu-Daudé
@ 2025-04-04 16:41 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:48, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> meson.build | 9 +++++++++
> include/exec/poison.h | 1 +
> include/qemu/target_info-impl.h | 21 +++++++++++++++++++++
> include/qemu/target_info.h | 18 ++++++++++++++++++
> target_info-stub.c | 23 +++++++++++++++++++++++
> target_info.c | 16 ++++++++++++++++
> 6 files changed, 88 insertions(+)
> create mode 100644 include/qemu/target_info-impl.h
> create mode 100644 include/qemu/target_info.h
> create mode 100644 target_info-stub.c
> create mode 100644 target_info.c
>
> diff --git a/meson.build b/meson.build
> index bcb9d39a387..de9c9dacd35 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3262,6 +3262,9 @@ host_kconfig = \
>
> ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
>
> +target_info = [
> +]
> +
To follow what is already implemented, we should use a dictionary per
target, pointing to the associated source file.
This way, it allows to move files listing directly to each architecture,
and the top meson.build only needs to add stub if it is not defined.
> default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
> actual_target_dirs = []
> fdt_required = []
> @@ -3368,6 +3371,9 @@ foreach target : target_dirs
> config_target_data.set(k, v)
> endif
> endforeach
> + if target not in target_info
> + config_target_data.set('TARGET_INFO_STUB_NEEDED', 1)
> + endif
With the dictionary, this is not needed anymore.
> config_target_data.set('QEMU_ARCH',
> 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper())
> config_target_h += {target: configure_file(output: target + '-config-target.h',
> @@ -3807,6 +3813,9 @@ endif
> common_ss.add(pagevary)
> specific_ss.add(files('page-target.c', 'page-vary-target.c'))
>
> +specific_ss.add(files('target_info-stub.c'))
> +common_ss.add(files('target_info.c'))
> +
> subdir('backends')
> subdir('disas')
> subdir('migration')
> diff --git a/include/exec/poison.h b/include/exec/poison.h
> index bc422719d80..00aedc41d82 100644
> --- a/include/exec/poison.h
> +++ b/include/exec/poison.h
> @@ -38,6 +38,7 @@
> #pragma GCC poison TARGET_BIG_ENDIAN
> #pragma GCC poison TCG_GUEST_DEFAULT_MO
> #pragma GCC poison TARGET_HAS_PRECISE_SMC
> +#pragma GCC poison TARGET_INFO_STUB_NEEDED
>
> #pragma GCC poison TARGET_LONG_BITS
> #pragma GCC poison TARGET_FMT_lx
> diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
> new file mode 100644
> index 00000000000..b340e192fce
> --- /dev/null
> +++ b/include/qemu/target_info-impl.h
> @@ -0,0 +1,21 @@
> +/*
> + * QEMU binary helpers
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef QEMU_TARGET_INFO_IMPL_H
> +#define QEMU_TARGET_INFO_IMPL_H
> +
> +#include "qemu/target_info.h"
> +
> +struct BinaryTargetInfo {
> +
I would be in favor to rename exising TargetInfo in QMPTargetInfo, and
reuse that name here.
> + /* runtime equivalent of TARGET_INFO_STUB_NEEDED definition */
> + bool is_stub;
Why do we want to know if it's a stub at runtime?
> +
> +};
> +
> +#endif
> diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
> new file mode 100644
> index 00000000000..fab3f3153ea
> --- /dev/null
> +++ b/include/qemu/target_info.h
> @@ -0,0 +1,18 @@
> +/*
> + * QEMU binary helpers
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef QEMU_TARGET_INFO_H
> +#define QEMU_TARGET_INFO_H
> +
> +typedef struct BinaryTargetInfo BinaryTargetInfo;
> +
> +const BinaryTargetInfo *target_info(void);
> +
> +bool target_info_is_stub(void);
> +
> +#endif
> diff --git a/target_info-stub.c b/target_info-stub.c
> new file mode 100644
> index 00000000000..d683a05977d
> --- /dev/null
> +++ b/target_info-stub.c
> @@ -0,0 +1,23 @@
> +/*
> + * QEMU target info stubs
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/target_info-impl.h"
> +
> +#ifdef TARGET_INFO_STUB_NEEDED
> +
> +static const BinaryTargetInfo target_info_stub = {
> + .is_stub = true,
> +};
> +
> +const BinaryTargetInfo *target_info(void)
> +{
> + return &target_info_stub;
> +}
> +
> +#endif /* TARGET_INFO_STUB_NEEDED */
> diff --git a/target_info.c b/target_info.c
> new file mode 100644
> index 00000000000..cb17d29b86d
> --- /dev/null
> +++ b/target_info.c
> @@ -0,0 +1,16 @@
> +/*
> + * QEMU legacy binary helpers
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/target_info-impl.h"
> +#include "qemu/target_info.h"
> +
> +bool target_info_is_stub(void)
> +{
> + return target_info()->is_stub;
> +}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 02/19] qemu: Convert target_name() to TargetInfo API
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
2025-04-03 23:48 ` [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h' Philippe Mathieu-Daudé
@ 2025-04-03 23:48 ` Philippe Mathieu-Daudé
2025-04-04 16:42 ` Pierrick Bouvier
2025-04-03 23:48 ` [RFC PATCH-for-10.1 03/19] qemu: Factor target_system_arch() out Philippe Mathieu-Daudé
` (16 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:48 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 2 --
include/qemu/target_info-impl.h | 3 +++
include/qemu/target_info.h | 2 ++
cpu-target.c | 5 -----
hw/core/machine-qmp-cmds.c | 1 +
plugins/loader.c | 2 +-
system/vl.c | 2 +-
target_info-stub.c | 1 +
target_info.c | 5 +++++
9 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 5b645df59f5..9d9448341d1 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1115,8 +1115,6 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
void cpu_exec_reset_hold(CPUState *cpu);
-const char *target_name(void);
-
#ifdef COMPILING_PER_TARGET
extern const VMStateDescription vmstate_cpu_common;
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
index b340e192fce..00bb746572b 100644
--- a/include/qemu/target_info-impl.h
+++ b/include/qemu/target_info-impl.h
@@ -16,6 +16,9 @@ struct BinaryTargetInfo {
/* runtime equivalent of TARGET_INFO_STUB_NEEDED definition */
bool is_stub;
+ /* runtime equivalent of TARGET_NAME definition */
+ const char *const name;
+
};
#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
index fab3f3153ea..5b8f17a15a3 100644
--- a/include/qemu/target_info.h
+++ b/include/qemu/target_info.h
@@ -15,4 +15,6 @@ const BinaryTargetInfo *target_info(void);
bool target_info_is_stub(void);
+const char *target_name(void);
+
#endif
diff --git a/cpu-target.c b/cpu-target.c
index c99d208a7c4..3f82d3ea444 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -165,8 +165,3 @@ bool target_words_bigendian(void)
{
return TARGET_BIG_ENDIAN;
}
-
-const char *target_name(void)
-{
- return TARGET_NAME;
-}
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 3130c5cd456..6701e210f54 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -19,6 +19,7 @@
#include "qapi/qobject-input-visitor.h"
#include "qapi/type-helpers.h"
#include "qemu/uuid.h"
+#include "qemu/target_info.h"
#include "qom/qom-qobject.h"
#include "system/hostmem.h"
#include "system/hw_accel.h"
diff --git a/plugins/loader.c b/plugins/loader.c
index 7523d554f03..36a4e88d4db 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -29,7 +29,7 @@
#include "qemu/xxhash.h"
#include "qemu/plugin.h"
#include "qemu/memalign.h"
-#include "hw/core/cpu.h"
+#include "qemu/target_info.h"
#include "exec/tb-flush.h"
#include "plugin.h"
diff --git a/system/vl.c b/system/vl.c
index c17945c4939..d8a0fe713c9 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -40,6 +40,7 @@
#include "qemu/help_option.h"
#include "qemu/hw-version.h"
#include "qemu/uuid.h"
+#include "qemu/target_info.h"
#include "system/reset.h"
#include "system/runstate.h"
#include "system/runstate-action.h"
@@ -79,7 +80,6 @@
#include "hw/block/block.h"
#include "hw/i386/x86.h"
#include "hw/i386/pc.h"
-#include "hw/core/cpu.h"
#include "migration/cpr.h"
#include "migration/misc.h"
#include "migration/snapshot.h"
diff --git a/target_info-stub.c b/target_info-stub.c
index d683a05977d..db61a335908 100644
--- a/target_info-stub.c
+++ b/target_info-stub.c
@@ -13,6 +13,7 @@
static const BinaryTargetInfo target_info_stub = {
.is_stub = true,
+ .name = TARGET_NAME,
};
const BinaryTargetInfo *target_info(void)
diff --git a/target_info.c b/target_info.c
index cb17d29b86d..6b44ea9fc0e 100644
--- a/target_info.c
+++ b/target_info.c
@@ -14,3 +14,8 @@ bool target_info_is_stub(void)
{
return target_info()->is_stub;
}
+
+const char *target_name(void)
+{
+ return target_info()->name;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 02/19] qemu: Convert target_name() to TargetInfo API
2025-04-03 23:48 ` [RFC PATCH-for-10.1 02/19] qemu: Convert target_name() to TargetInfo API Philippe Mathieu-Daudé
@ 2025-04-04 16:42 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:48, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 2 --
> include/qemu/target_info-impl.h | 3 +++
> include/qemu/target_info.h | 2 ++
> cpu-target.c | 5 -----
> hw/core/machine-qmp-cmds.c | 1 +
> plugins/loader.c | 2 +-
> system/vl.c | 2 +-
> target_info-stub.c | 1 +
> target_info.c | 5 +++++
> 9 files changed, 14 insertions(+), 9 deletions(-)
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 03/19] qemu: Factor target_system_arch() out
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
2025-04-03 23:48 ` [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h' Philippe Mathieu-Daudé
2025-04-03 23:48 ` [RFC PATCH-for-10.1 02/19] qemu: Convert target_name() to TargetInfo API Philippe Mathieu-Daudé
@ 2025-04-03 23:48 ` Philippe Mathieu-Daudé
2025-04-04 16:44 ` Pierrick Bouvier
2025-04-03 23:48 ` [RFC PATCH-for-10.1 04/19] qemu: Convert target_words_bigendian() to TargetInfo API Philippe Mathieu-Daudé
` (15 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:48 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qemu/target_info-impl.h | 4 ++++
include/qemu/target_info.h | 4 ++++
hw/core/machine-qmp-cmds.c | 6 ++----
target_info-stub.c | 1 +
target_info.c | 12 ++++++++++++
5 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
index 00bb746572b..0cec211e362 100644
--- a/include/qemu/target_info-impl.h
+++ b/include/qemu/target_info-impl.h
@@ -10,6 +10,7 @@
#define QEMU_TARGET_INFO_IMPL_H
#include "qemu/target_info.h"
+#include "qapi/qapi-types-machine.h"
struct BinaryTargetInfo {
@@ -19,6 +20,9 @@ struct BinaryTargetInfo {
/* runtime equivalent of TARGET_NAME definition */
const char *const name;
+ /* related to TARGET_ARCH definition */
+ SysEmuTarget system_arch;
+
};
#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
index 5b8f17a15a3..6ca36dae8a3 100644
--- a/include/qemu/target_info.h
+++ b/include/qemu/target_info.h
@@ -9,6 +9,8 @@
#ifndef QEMU_TARGET_INFO_H
#define QEMU_TARGET_INFO_H
+#include "qapi/qapi-types-machine.h"
+
typedef struct BinaryTargetInfo BinaryTargetInfo;
const BinaryTargetInfo *target_info(void);
@@ -17,4 +19,6 @@ bool target_info_is_stub(void);
const char *target_name(void);
+SysEmuTarget target_system_arch(void);
+
#endif
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 6701e210f54..9e2dd348c06 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -36,8 +36,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
MachineState *ms = MACHINE(qdev_get_machine());
MachineClass *mc = MACHINE_GET_CLASS(ms);
CpuInfoFastList *head = NULL, **tail = &head;
- SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, target_name(),
- -1, &error_abort);
+ SysEmuTarget target = target_system_arch();
CPUState *cpu;
CPU_FOREACH(cpu) {
@@ -137,8 +136,7 @@ TargetInfo *qmp_query_target(Error **errp)
{
TargetInfo *info = g_malloc0(sizeof(*info));
- info->arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
- &error_abort);
+ info->arch = target_system_arch();
return info;
}
diff --git a/target_info-stub.c b/target_info-stub.c
index db61a335908..46a240ac66a 100644
--- a/target_info-stub.c
+++ b/target_info-stub.c
@@ -14,6 +14,7 @@
static const BinaryTargetInfo target_info_stub = {
.is_stub = true,
.name = TARGET_NAME,
+ .system_arch = -1,
};
const BinaryTargetInfo *target_info(void)
diff --git a/target_info.c b/target_info.c
index 6b44ea9fc0e..be4f19009b3 100644
--- a/target_info.c
+++ b/target_info.c
@@ -9,6 +9,7 @@
#include "qemu/osdep.h"
#include "qemu/target_info-impl.h"
#include "qemu/target_info.h"
+#include "qapi/error.h"
bool target_info_is_stub(void)
{
@@ -19,3 +20,14 @@ const char *target_name(void)
{
return target_info()->name;
}
+
+SysEmuTarget target_system_arch(void)
+{
+ SysEmuTarget system_arch = target_info()->system_arch;
+
+ if (system_arch >= SYS_EMU_TARGET__MAX) {
+ system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
+ &error_abort);
+ }
+ return system_arch;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 03/19] qemu: Factor target_system_arch() out
2025-04-03 23:48 ` [RFC PATCH-for-10.1 03/19] qemu: Factor target_system_arch() out Philippe Mathieu-Daudé
@ 2025-04-04 16:44 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:48, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/qemu/target_info-impl.h | 4 ++++
> include/qemu/target_info.h | 4 ++++
> hw/core/machine-qmp-cmds.c | 6 ++----
> target_info-stub.c | 1 +
> target_info.c | 12 ++++++++++++
> 5 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
> index 00bb746572b..0cec211e362 100644
> --- a/include/qemu/target_info-impl.h
> +++ b/include/qemu/target_info-impl.h
> @@ -10,6 +10,7 @@
> #define QEMU_TARGET_INFO_IMPL_H
>
> #include "qemu/target_info.h"
> +#include "qapi/qapi-types-machine.h"
>
> struct BinaryTargetInfo {
>
> @@ -19,6 +20,9 @@ struct BinaryTargetInfo {
> /* runtime equivalent of TARGET_NAME definition */
> const char *const name;
>
> + /* related to TARGET_ARCH definition */
> + SysEmuTarget system_arch;
> +
> };
>
> #endif
> diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
> index 5b8f17a15a3..6ca36dae8a3 100644
> --- a/include/qemu/target_info.h
> +++ b/include/qemu/target_info.h
> @@ -9,6 +9,8 @@
> #ifndef QEMU_TARGET_INFO_H
> #define QEMU_TARGET_INFO_H
>
> +#include "qapi/qapi-types-machine.h"
> +
> typedef struct BinaryTargetInfo BinaryTargetInfo;
>
> const BinaryTargetInfo *target_info(void);
> @@ -17,4 +19,6 @@ bool target_info_is_stub(void);
>
> const char *target_name(void);
>
> +SysEmuTarget target_system_arch(void);
> +
> #endif
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 6701e210f54..9e2dd348c06 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -36,8 +36,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
> MachineState *ms = MACHINE(qdev_get_machine());
> MachineClass *mc = MACHINE_GET_CLASS(ms);
> CpuInfoFastList *head = NULL, **tail = &head;
> - SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, target_name(),
> - -1, &error_abort);
> + SysEmuTarget target = target_system_arch();
> CPUState *cpu;
>
> CPU_FOREACH(cpu) {
> @@ -137,8 +136,7 @@ TargetInfo *qmp_query_target(Error **errp)
> {
> TargetInfo *info = g_malloc0(sizeof(*info));
>
> - info->arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
> - &error_abort);
> + info->arch = target_system_arch();
>
> return info;
> }
> diff --git a/target_info-stub.c b/target_info-stub.c
> index db61a335908..46a240ac66a 100644
> --- a/target_info-stub.c
> +++ b/target_info-stub.c
> @@ -14,6 +14,7 @@
> static const BinaryTargetInfo target_info_stub = {
> .is_stub = true,
> .name = TARGET_NAME,
> + .system_arch = -1,
> };
>
> const BinaryTargetInfo *target_info(void)
> diff --git a/target_info.c b/target_info.c
> index 6b44ea9fc0e..be4f19009b3 100644
> --- a/target_info.c
> +++ b/target_info.c
> @@ -9,6 +9,7 @@
> #include "qemu/osdep.h"
> #include "qemu/target_info-impl.h"
> #include "qemu/target_info.h"
> +#include "qapi/error.h"
>
> bool target_info_is_stub(void)
> {
> @@ -19,3 +20,14 @@ const char *target_name(void)
> {
> return target_info()->name;
> }
> +
> +SysEmuTarget target_system_arch(void)
> +{
> + SysEmuTarget system_arch = target_info()->system_arch;
> +
> + if (system_arch >= SYS_EMU_TARGET__MAX) {
> + system_arch = qapi_enum_parse(&SysEmuTarget_lookup, target_name(), -1,
> + &error_abort);
> + }
> + return system_arch;
> +}
Maybe we could leave that out for now, and focus on representing compile
time defines only as a first step.
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 04/19] qemu: Convert target_words_bigendian() to TargetInfo API
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-04-03 23:48 ` [RFC PATCH-for-10.1 03/19] qemu: Factor target_system_arch() out Philippe Mathieu-Daudé
@ 2025-04-03 23:48 ` Philippe Mathieu-Daudé
2025-04-04 16:45 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 05/19] qemu: Introduce target_long_bits() Philippe Mathieu-Daudé
` (14 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:48 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/tswap.h | 13 +------------
include/qemu/target_info-impl.h | 4 ++++
include/qemu/target_info.h | 11 +++++++++++
cpu-target.c | 6 ------
hw/core/cpu-system.c | 2 +-
hw/display/vga.c | 2 +-
hw/virtio/virtio.c | 2 +-
system/qtest.c | 1 +
target_info-stub.c | 1 +
target_info.c | 5 +++++
10 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
index 84060a49994..415781b2bcc 100644
--- a/include/exec/tswap.h
+++ b/include/exec/tswap.h
@@ -9,18 +9,7 @@
#define TSWAP_H
#include "qemu/bswap.h"
-
-/**
- * target_words_bigendian:
- * Returns true if the (default) endianness of the target is big endian,
- * false otherwise. Common code should normally never need to know about the
- * endianness of the target, so please do *not* use this function unless you
- * know very well what you are doing!
- */
-bool target_words_bigendian(void);
-#ifdef COMPILING_PER_TARGET
-#define target_words_bigendian() TARGET_BIG_ENDIAN
-#endif
+#include "qemu/target_info.h"
/*
* If we're in target-specific code, we can hard-code the swapping
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
index 0cec211e362..14566e4a913 100644
--- a/include/qemu/target_info-impl.h
+++ b/include/qemu/target_info-impl.h
@@ -10,6 +10,7 @@
#define QEMU_TARGET_INFO_IMPL_H
#include "qemu/target_info.h"
+#include "qapi/qapi-types-common.h"
#include "qapi/qapi-types-machine.h"
struct BinaryTargetInfo {
@@ -23,6 +24,9 @@ struct BinaryTargetInfo {
/* related to TARGET_ARCH definition */
SysEmuTarget system_arch;
+ /* related to TARGET_BIG_ENDIAN definition */
+ EndianMode endianness;
+
};
#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
index 6ca36dae8a3..e84f16d1034 100644
--- a/include/qemu/target_info.h
+++ b/include/qemu/target_info.h
@@ -21,4 +21,15 @@ const char *target_name(void);
SysEmuTarget target_system_arch(void);
+/**
+ * target_words_bigendian:
+ * Returns true if the (default) endianness of the target is big endian,
+ * false otherwise. Note that in target-specific code, you can use
+ * TARGET_BIG_ENDIAN directly instead. On the other hand, common
+ * code should normally never need to know about the endianness of the
+ * target, so please do *not* use this function unless you know very well
+ * what you are doing!
+ */
+bool target_words_bigendian(void);
+
#endif
diff --git a/cpu-target.c b/cpu-target.c
index 3f82d3ea444..761c2d28645 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -159,9 +159,3 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
#endif
abort();
}
-
-#undef target_words_bigendian
-bool target_words_bigendian(void)
-{
- return TARGET_BIG_ENDIAN;
-}
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 82b68b8927d..32700c49b43 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -24,7 +24,7 @@
#include "exec/cputlb.h"
#include "system/memory.h"
#include "exec/tb-flush.h"
-#include "exec/tswap.h"
+#include "qemu/target_info.h"
#include "hw/qdev-core.h"
#include "hw/qdev-properties.h"
#include "hw/core/sysemu-cpu-ops.h"
diff --git a/hw/display/vga.c b/hw/display/vga.c
index b01f67c65fb..1883e03d3d8 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -26,7 +26,7 @@
#include "qemu/units.h"
#include "system/reset.h"
#include "qapi/error.h"
-#include "exec/tswap.h"
+#include "qemu/target_info.h"
#include "hw/display/vga.h"
#include "hw/i386/x86.h"
#include "hw/pci/pci.h"
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 85110bce374..4ef56c183b2 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -20,7 +20,7 @@
#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
-#include "exec/tswap.h"
+#include "qemu/target_info.h"
#include "qom/object_interfaces.h"
#include "hw/core/cpu.h"
#include "hw/virtio/virtio.h"
diff --git a/system/qtest.c b/system/qtest.c
index 523a0479959..6146a7bfdc0 100644
--- a/system/qtest.c
+++ b/system/qtest.c
@@ -29,6 +29,7 @@
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qemu/cutils.h"
+#include "qemu/target_info.h"
#include "qom/object_interfaces.h"
#define MAX_IRQ 256
diff --git a/target_info-stub.c b/target_info-stub.c
index 46a240ac66a..c1a15f5cc12 100644
--- a/target_info-stub.c
+++ b/target_info-stub.c
@@ -15,6 +15,7 @@ static const BinaryTargetInfo target_info_stub = {
.is_stub = true,
.name = TARGET_NAME,
.system_arch = -1,
+ .endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
};
const BinaryTargetInfo *target_info(void)
diff --git a/target_info.c b/target_info.c
index be4f19009b3..22796dda543 100644
--- a/target_info.c
+++ b/target_info.c
@@ -31,3 +31,8 @@ SysEmuTarget target_system_arch(void)
}
return system_arch;
}
+
+bool target_words_bigendian(void)
+{
+ return target_info()->endianness == ENDIAN_MODE_BIG;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 04/19] qemu: Convert target_words_bigendian() to TargetInfo API
2025-04-03 23:48 ` [RFC PATCH-for-10.1 04/19] qemu: Convert target_words_bigendian() to TargetInfo API Philippe Mathieu-Daudé
@ 2025-04-04 16:45 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:45 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:48, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/exec/tswap.h | 13 +------------
> include/qemu/target_info-impl.h | 4 ++++
> include/qemu/target_info.h | 11 +++++++++++
> cpu-target.c | 6 ------
> hw/core/cpu-system.c | 2 +-
> hw/display/vga.c | 2 +-
> hw/virtio/virtio.c | 2 +-
> system/qtest.c | 1 +
> target_info-stub.c | 1 +
> target_info.c | 5 +++++
> 10 files changed, 26 insertions(+), 21 deletions(-)
>
> diff --git a/include/exec/tswap.h b/include/exec/tswap.h
> index 84060a49994..415781b2bcc 100644
> --- a/include/exec/tswap.h
> +++ b/include/exec/tswap.h
> @@ -9,18 +9,7 @@
> #define TSWAP_H
>
> #include "qemu/bswap.h"
> -
> -/**
> - * target_words_bigendian:
> - * Returns true if the (default) endianness of the target is big endian,
> - * false otherwise. Common code should normally never need to know about the
> - * endianness of the target, so please do *not* use this function unless you
> - * know very well what you are doing!
> - */
> -bool target_words_bigendian(void);
> -#ifdef COMPILING_PER_TARGET
> -#define target_words_bigendian() TARGET_BIG_ENDIAN
> -#endif
> +#include "qemu/target_info.h"
>
> /*
> * If we're in target-specific code, we can hard-code the swapping
> diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
> index 0cec211e362..14566e4a913 100644
> --- a/include/qemu/target_info-impl.h
> +++ b/include/qemu/target_info-impl.h
> @@ -10,6 +10,7 @@
> #define QEMU_TARGET_INFO_IMPL_H
>
> #include "qemu/target_info.h"
> +#include "qapi/qapi-types-common.h"
> #include "qapi/qapi-types-machine.h"
>
> struct BinaryTargetInfo {
> @@ -23,6 +24,9 @@ struct BinaryTargetInfo {
> /* related to TARGET_ARCH definition */
> SysEmuTarget system_arch;
>
> + /* related to TARGET_BIG_ENDIAN definition */
> + EndianMode endianness;
> +
> };
>
> #endif
> diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
> index 6ca36dae8a3..e84f16d1034 100644
> --- a/include/qemu/target_info.h
> +++ b/include/qemu/target_info.h
> @@ -21,4 +21,15 @@ const char *target_name(void);
>
> SysEmuTarget target_system_arch(void);
>
> +/**
> + * target_words_bigendian:
> + * Returns true if the (default) endianness of the target is big endian,
> + * false otherwise. Note that in target-specific code, you can use
> + * TARGET_BIG_ENDIAN directly instead. On the other hand, common
> + * code should normally never need to know about the endianness of the
> + * target, so please do *not* use this function unless you know very well
> + * what you are doing!
> + */
> +bool target_words_bigendian(void);
> +
We don't want to reintroduce TARGET_BIG_ENDIAN in the comment, it was
purposefully removed previously.
> #endif
> diff --git a/cpu-target.c b/cpu-target.c
> index 3f82d3ea444..761c2d28645 100644
> --- a/cpu-target.c
> +++ b/cpu-target.c
> @@ -159,9 +159,3 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
> #endif
> abort();
> }
> -
> -#undef target_words_bigendian
> -bool target_words_bigendian(void)
> -{
> - return TARGET_BIG_ENDIAN;
> -}
> diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
> index 82b68b8927d..32700c49b43 100644
> --- a/hw/core/cpu-system.c
> +++ b/hw/core/cpu-system.c
> @@ -24,7 +24,7 @@
> #include "exec/cputlb.h"
> #include "system/memory.h"
> #include "exec/tb-flush.h"
> -#include "exec/tswap.h"
> +#include "qemu/target_info.h"
> #include "hw/qdev-core.h"
> #include "hw/qdev-properties.h"
> #include "hw/core/sysemu-cpu-ops.h"
> diff --git a/hw/display/vga.c b/hw/display/vga.c
> index b01f67c65fb..1883e03d3d8 100644
> --- a/hw/display/vga.c
> +++ b/hw/display/vga.c
> @@ -26,7 +26,7 @@
> #include "qemu/units.h"
> #include "system/reset.h"
> #include "qapi/error.h"
> -#include "exec/tswap.h"
> +#include "qemu/target_info.h"
> #include "hw/display/vga.h"
> #include "hw/i386/x86.h"
> #include "hw/pci/pci.h"
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 85110bce374..4ef56c183b2 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -20,7 +20,7 @@
> #include "qemu/log.h"
> #include "qemu/main-loop.h"
> #include "qemu/module.h"
> -#include "exec/tswap.h"
> +#include "qemu/target_info.h"
> #include "qom/object_interfaces.h"
> #include "hw/core/cpu.h"
> #include "hw/virtio/virtio.h"
> diff --git a/system/qtest.c b/system/qtest.c
> index 523a0479959..6146a7bfdc0 100644
> --- a/system/qtest.c
> +++ b/system/qtest.c
> @@ -29,6 +29,7 @@
> #include "qemu/error-report.h"
> #include "qemu/module.h"
> #include "qemu/cutils.h"
> +#include "qemu/target_info.h"
> #include "qom/object_interfaces.h"
>
> #define MAX_IRQ 256
> diff --git a/target_info-stub.c b/target_info-stub.c
> index 46a240ac66a..c1a15f5cc12 100644
> --- a/target_info-stub.c
> +++ b/target_info-stub.c
> @@ -15,6 +15,7 @@ static const BinaryTargetInfo target_info_stub = {
> .is_stub = true,
> .name = TARGET_NAME,
> .system_arch = -1,
> + .endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
> };
>
> const BinaryTargetInfo *target_info(void)
> diff --git a/target_info.c b/target_info.c
> index be4f19009b3..22796dda543 100644
> --- a/target_info.c
> +++ b/target_info.c
> @@ -31,3 +31,8 @@ SysEmuTarget target_system_arch(void)
> }
> return system_arch;
> }
> +
> +bool target_words_bigendian(void)
> +{
> + return target_info()->endianness == ENDIAN_MODE_BIG;
> +}
With the comment update,
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 05/19] qemu: Introduce target_long_bits()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-04-03 23:48 ` [RFC PATCH-for-10.1 04/19] qemu: Convert target_words_bigendian() to TargetInfo API Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:46 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits() Philippe Mathieu-Daudé
` (13 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qemu/target_info-impl.h | 3 +++
include/qemu/target_info.h | 2 ++
target_info-stub.c | 1 +
target_info.c | 5 +++++
4 files changed, 11 insertions(+)
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
index 14566e4a913..8fa585f8138 100644
--- a/include/qemu/target_info-impl.h
+++ b/include/qemu/target_info-impl.h
@@ -27,6 +27,9 @@ struct BinaryTargetInfo {
/* related to TARGET_BIG_ENDIAN definition */
EndianMode endianness;
+ /* runtime equivalent of TARGET_LONG_BITS definition */
+ unsigned long_bits;
+
};
#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
index e84f16d1034..66c43b329cc 100644
--- a/include/qemu/target_info.h
+++ b/include/qemu/target_info.h
@@ -32,4 +32,6 @@ SysEmuTarget target_system_arch(void);
*/
bool target_words_bigendian(void);
+unsigned target_long_bits(void);
+
#endif
diff --git a/target_info-stub.c b/target_info-stub.c
index c1a15f5cc12..a5374caed6c 100644
--- a/target_info-stub.c
+++ b/target_info-stub.c
@@ -16,6 +16,7 @@ static const BinaryTargetInfo target_info_stub = {
.name = TARGET_NAME,
.system_arch = -1,
.endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
+ .long_bits = TARGET_LONG_BITS,
};
const BinaryTargetInfo *target_info(void)
diff --git a/target_info.c b/target_info.c
index 22796dda543..2fd32931e13 100644
--- a/target_info.c
+++ b/target_info.c
@@ -36,3 +36,8 @@ bool target_words_bigendian(void)
{
return target_info()->endianness == ENDIAN_MODE_BIG;
}
+
+unsigned target_long_bits(void)
+{
+ return target_info()->long_bits;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 05/19] qemu: Introduce target_long_bits() Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:48 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 07/19] target/hppa: " Philippe Mathieu-Daudé
` (12 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/tricore/translate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index 7cd26d8eaba..ad959f3b0a1 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -24,6 +24,7 @@
#include "tcg/tcg-op.h"
#include "accel/tcg/cpu-ldst.h"
#include "qemu/qemu-print.h"
+#include "qemu/target_info.h"
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
@@ -5922,6 +5923,7 @@ static void decode_rr_logical_shift(DisasContext *ctx)
{
uint32_t op2;
int r3, r2, r1;
+ unsigned long_bits = target_long_bits();
r3 = MASK_OP_RR_D(ctx->opcode);
r2 = MASK_OP_RR_S2(ctx->opcode);
@@ -5937,7 +5939,7 @@ static void decode_rr_logical_shift(DisasContext *ctx)
break;
case OPC2_32_RR_CLO:
tcg_gen_not_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]);
- tcg_gen_clzi_tl(cpu_gpr_d[r3], cpu_gpr_d[r3], TARGET_LONG_BITS);
+ tcg_gen_clzi_tl(cpu_gpr_d[r3], cpu_gpr_d[r3], long_bits);
break;
case OPC2_32_RR_CLO_H:
gen_helper_clo_h(cpu_gpr_d[r3], cpu_gpr_d[r1]);
@@ -5949,7 +5951,7 @@ static void decode_rr_logical_shift(DisasContext *ctx)
gen_helper_cls_h(cpu_gpr_d[r3], cpu_gpr_d[r1]);
break;
case OPC2_32_RR_CLZ:
- tcg_gen_clzi_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], TARGET_LONG_BITS);
+ tcg_gen_clzi_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], long_bits);
break;
case OPC2_32_RR_CLZ_H:
gen_helper_clz_h(cpu_gpr_d[r3], cpu_gpr_d[r1]);
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits() Philippe Mathieu-Daudé
@ 2025-04-04 16:48 ` Pierrick Bouvier
2025-04-04 17:53 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/tricore/translate.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
The temptation is good, but please do not touch any target code at this
point. We want to focus on defining the API first, and we can perform
codebase changes as a second step, without letting any occurrences of
the old macros/functions, instead of just adding "another way to do it".
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-04 16:48 ` Pierrick Bouvier
@ 2025-04-04 17:53 ` Philippe Mathieu-Daudé
2025-04-17 18:00 ` Paolo Bonzini
0 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-04 17:53 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 18:48, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/tricore/translate.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>
> The temptation is good, but please do not touch any target code at this
> point. We want to focus on defining the API first, and we can perform
> codebase changes as a second step, without letting any occurrences of
> the old macros/functions, instead of just adding "another way to do it".
I meant to remove these patch before posting, to focus on ARM, but
apparently forgot to do so...
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-04 17:53 ` Philippe Mathieu-Daudé
@ 2025-04-17 18:00 ` Paolo Bonzini
2025-04-17 18:32 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Paolo Bonzini @ 2025-04-17 18:00 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 19:53, Philippe Mathieu-Daudé wrote:
> On 4/4/25 18:48, Pierrick Bouvier wrote:
>> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>> target/tricore/translate.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>
>> The temptation is good, but please do not touch any target code at
>> this point. We want to focus on defining the API first, and we can
>> perform codebase changes as a second step, without letting any
>> occurrences of the old macros/functions, instead of just adding
>> "another way to do it".
>
> I meant to remove these patch before posting, to focus on ARM, but
> apparently forgot to do so...
In this particular case TARGET_LONG_BITS is a constant 32 (and 32 is
present many times in the code), so it can be replaced as a cleanup.
Paolo
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-17 18:00 ` Paolo Bonzini
@ 2025-04-17 18:32 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-17 18:32 UTC (permalink / raw)
To: Paolo Bonzini, Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 17/4/25 20:00, Paolo Bonzini wrote:
> On 4/4/25 19:53, Philippe Mathieu-Daudé wrote:
>> On 4/4/25 18:48, Pierrick Bouvier wrote:
>>> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>> ---
>>>> target/tricore/translate.c | 6 ++++--
>>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>
>>> The temptation is good, but please do not touch any target code at
>>> this point. We want to focus on defining the API first, and we can
>>> perform codebase changes as a second step, without letting any
>>> occurrences of the old macros/functions, instead of just adding
>>> "another way to do it".
>>
>> I meant to remove these patch before posting, to focus on ARM, but
>> apparently forgot to do so...
>
> In this particular case TARGET_LONG_BITS is a constant 32 (and 32 is
> present many times in the code), so it can be replaced as a cleanup.
Indeed. Richard suggested a similar cleanup (~ s/tl/i32/) for TriCore:
https://lore.kernel.org/qemu-devel/7f6fc0ae-6cdd-4996-b411-762019efb003@linaro.org/
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 07/19] target/hppa: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 06/19] target/tricore: Replace TARGET_LONG_BITS -> target_long_bits() Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:48 ` Pierrick Bouvier
2025-04-17 17:27 ` Paolo Bonzini
2025-04-03 23:49 ` [RFC PATCH-for-10.1 08/19] target/riscv: " Philippe Mathieu-Daudé
` (11 subsequent siblings)
18 siblings, 2 replies; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hppa/mem_helper.c | 3 ++-
target/hppa/translate.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index 554d7bf4d14..03cd103f284 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
+#include "qemu/target_info.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "exec/cputlb.h"
@@ -101,7 +102,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, HPPATLBEntry *ent,
tlb_flush_range_by_mmuidx(cs, ent->itree.start,
ent->itree.last - ent->itree.start + 1,
- HPPA_MMU_FLUSH_MASK, TARGET_LONG_BITS);
+ HPPA_MMU_FLUSH_MASK, target_long_bits());
/* Never clear BTLBs, unless forced to do so. */
is_btlb = ent < &env->tlb[HPPA_BTLB_ENTRIES(env)];
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 14f38333222..81f535589cf 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/target_info.h"
#include "cpu.h"
#include "qemu/host-utils.h"
#include "exec/exec-all.h"
@@ -3731,7 +3732,7 @@ static bool trans_shrp_imm(DisasContext *ctx, arg_shrp_imm *a)
t2 = load_gpr(ctx, a->r2);
if (a->r1 == 0) {
tcg_gen_extract_i64(dest, t2, sa, width - sa);
- } else if (width == TARGET_LONG_BITS) {
+ } else if (width == target_long_bits()) {
tcg_gen_extract2_i64(dest, t2, cpu_gr[a->r1], sa);
} else {
assert(!a->d);
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 07/19] target/hppa: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 07/19] target/hppa: " Philippe Mathieu-Daudé
@ 2025-04-04 16:48 ` Pierrick Bouvier
2025-04-04 17:54 ` Philippe Mathieu-Daudé
2025-04-17 17:27 ` Paolo Bonzini
1 sibling, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/hppa/mem_helper.c | 3 ++-
> target/hppa/translate.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
> index 554d7bf4d14..03cd103f284 100644
> --- a/target/hppa/mem_helper.c
> +++ b/target/hppa/mem_helper.c
> @@ -19,6 +19,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu/log.h"
> +#include "qemu/target_info.h"
> #include "cpu.h"
> #include "exec/exec-all.h"
> #include "exec/cputlb.h"
> @@ -101,7 +102,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, HPPATLBEntry *ent,
>
> tlb_flush_range_by_mmuidx(cs, ent->itree.start,
> ent->itree.last - ent->itree.start + 1,
> - HPPA_MMU_FLUSH_MASK, TARGET_LONG_BITS);
> + HPPA_MMU_FLUSH_MASK, target_long_bits());
>
> /* Never clear BTLBs, unless forced to do so. */
> is_btlb = ent < &env->tlb[HPPA_BTLB_ENTRIES(env)];
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index 14f38333222..81f535589cf 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -18,6 +18,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qemu/target_info.h"
> #include "cpu.h"
> #include "qemu/host-utils.h"
> #include "exec/exec-all.h"
> @@ -3731,7 +3732,7 @@ static bool trans_shrp_imm(DisasContext *ctx, arg_shrp_imm *a)
> t2 = load_gpr(ctx, a->r2);
> if (a->r1 == 0) {
> tcg_gen_extract_i64(dest, t2, sa, width - sa);
> - } else if (width == TARGET_LONG_BITS) {
> + } else if (width == target_long_bits()) {
> tcg_gen_extract2_i64(dest, t2, cpu_gr[a->r1], sa);
> } else {
> assert(!a->d);
The temptation is good, but please do not touch any target code at this
point. We want to focus on defining the API first, and we can perform
codebase changes as a second step, without letting any occurrences of
the old macros/functions, instead of just adding "another way to do it".
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 07/19] target/hppa: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-04 16:48 ` Pierrick Bouvier
@ 2025-04-04 17:54 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-04 17:54 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 18:48, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/hppa/mem_helper.c | 3 ++-
>> target/hppa/translate.c | 3 ++-
>> 2 files changed, 4 insertions(+), 2 deletions(-)
> The temptation is good, but please do not touch any target code at this
> point. We want to focus on defining the API first, and we can perform
> codebase changes as a second step, without letting any occurrences of
> the old macros/functions, instead of just adding "another way to do it".
I meant to remove these patch before posting, to focus on ARM, but
apparently forgot to do so...
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 07/19] target/hppa: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 07/19] target/hppa: " Philippe Mathieu-Daudé
2025-04-04 16:48 ` Pierrick Bouvier
@ 2025-04-17 17:27 ` Paolo Bonzini
1 sibling, 0 replies; 51+ messages in thread
From: Paolo Bonzini @ 2025-04-17 17:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
On 4/4/25 01:49, Philippe Mathieu-Daudé wrote:
> @@ -101,7 +102,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, HPPATLBEntry *ent,
>
> tlb_flush_range_by_mmuidx(cs, ent->itree.start,
> ent->itree.last - ent->itree.start + 1,
> - HPPA_MMU_FLUSH_MASK, TARGET_LONG_BITS);
> + HPPA_MMU_FLUSH_MASK, target_long_bits());
This ignores the fact that TCG is still using the target_long type, so
there's no real hope at this point of differentiating TARGET_LONG_BITS
this way.
I think that you really need to make sure that target_long/target_ulong
are little more than a shortcut used by TCG backends to invoke *_tl
functions. Basically remove all uses outside target/ and tcg/ (a lot of
uses in hw/ are for sPAPR devices and they can be replaced easily with
uint64_t; there are actually not many).
Then let cpu.h define target_long/target_ulong so that you can remove
the uses in tcg/ as well, and poison TARGET_LONG_BITS outside target/.
This way TARGET_LONG_BITS does not need to be part of the TargetInfo.
On the other hand, if I'm missing something in your plan just tell me.
Paolo
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 08/19] target/riscv: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 07/19] target/hppa: " Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:48 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 09/19] qemu: Introduce target_cpu_type() Philippe Mathieu-Daudé
` (10 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/riscv/riscv-iommu.c | 3 ++-
hw/riscv/riscv_hart.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
index 65411b3e4c0..37563b2102f 100644
--- a/hw/riscv/riscv-iommu.c
+++ b/hw/riscv/riscv-iommu.c
@@ -26,6 +26,7 @@
#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qemu/timer.h"
+#include "qemu/target_info.h"
#include "cpu_bits.h"
#include "riscv-iommu.h"
@@ -393,7 +394,7 @@ static int riscv_iommu_spa_fetch(RISCVIOMMUState *s, RISCVIOMMUContext *ctx,
if (pass == S_STAGE && va_len > 32) {
target_ulong mask, masked_msbs;
- mask = (1L << (TARGET_LONG_BITS - (va_len - 1))) - 1;
+ mask = (1L << (target_long_bits() - (va_len - 1))) - 1;
masked_msbs = (addr >> (va_len - 1)) & mask;
if (masked_msbs != 0 && masked_msbs != mask) {
diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c
index a55d1566687..667d3b0a507 100644
--- a/hw/riscv/riscv_hart.c
+++ b/hw/riscv/riscv_hart.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "qemu/target_info.h"
#include "system/reset.h"
#include "system/qtest.h"
#include "qemu/cutils.h"
@@ -72,7 +73,7 @@ static void csr_call(char *cmd, uint64_t cpu_num, int csrno, uint64_t *val)
ret = riscv_csrr(env, csrno, (target_ulong *)val);
} else if (strcmp(cmd, "set_csr") == 0) {
ret = riscv_csrrw(env, csrno, NULL, *(target_ulong *)val,
- MAKE_64BIT_MASK(0, TARGET_LONG_BITS));
+ MAKE_64BIT_MASK(0, target_long_bits()));
}
g_assert(ret == RISCV_EXCP_NONE);
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 08/19] target/riscv: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 08/19] target/riscv: " Philippe Mathieu-Daudé
@ 2025-04-04 16:48 ` Pierrick Bouvier
2025-04-04 17:54 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/riscv/riscv-iommu.c | 3 ++-
> hw/riscv/riscv_hart.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
> index 65411b3e4c0..37563b2102f 100644
> --- a/hw/riscv/riscv-iommu.c
> +++ b/hw/riscv/riscv-iommu.c
> @@ -26,6 +26,7 @@
> #include "migration/vmstate.h"
> #include "qapi/error.h"
> #include "qemu/timer.h"
> +#include "qemu/target_info.h"
>
> #include "cpu_bits.h"
> #include "riscv-iommu.h"
> @@ -393,7 +394,7 @@ static int riscv_iommu_spa_fetch(RISCVIOMMUState *s, RISCVIOMMUContext *ctx,
> if (pass == S_STAGE && va_len > 32) {
> target_ulong mask, masked_msbs;
>
> - mask = (1L << (TARGET_LONG_BITS - (va_len - 1))) - 1;
> + mask = (1L << (target_long_bits() - (va_len - 1))) - 1;
> masked_msbs = (addr >> (va_len - 1)) & mask;
>
> if (masked_msbs != 0 && masked_msbs != mask) {
> diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c
> index a55d1566687..667d3b0a507 100644
> --- a/hw/riscv/riscv_hart.c
> +++ b/hw/riscv/riscv_hart.c
> @@ -21,6 +21,7 @@
> #include "qemu/osdep.h"
> #include "qapi/error.h"
> #include "qemu/module.h"
> +#include "qemu/target_info.h"
> #include "system/reset.h"
> #include "system/qtest.h"
> #include "qemu/cutils.h"
> @@ -72,7 +73,7 @@ static void csr_call(char *cmd, uint64_t cpu_num, int csrno, uint64_t *val)
> ret = riscv_csrr(env, csrno, (target_ulong *)val);
> } else if (strcmp(cmd, "set_csr") == 0) {
> ret = riscv_csrrw(env, csrno, NULL, *(target_ulong *)val,
> - MAKE_64BIT_MASK(0, TARGET_LONG_BITS));
> + MAKE_64BIT_MASK(0, target_long_bits()));
> }
>
> g_assert(ret == RISCV_EXCP_NONE);
The temptation is good, but please do not touch any target code at this
point. We want to focus on defining the API first, and we can perform
codebase changes as a second step, without letting any occurrences of
the old macros/functions, instead of just adding "another way to do it".
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 08/19] target/riscv: Replace TARGET_LONG_BITS -> target_long_bits()
2025-04-04 16:48 ` Pierrick Bouvier
@ 2025-04-04 17:54 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-04 17:54 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 18:48, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/riscv/riscv-iommu.c | 3 ++-
>> hw/riscv/riscv_hart.c | 3 ++-
>> 2 files changed, 4 insertions(+), 2 deletions(-)
> The temptation is good, but please do not touch any target code at this
> point. We want to focus on defining the API first, and we can perform
> codebase changes as a second step, without letting any occurrences of
> the old macros/functions, instead of just adding "another way to do it".
I meant to remove these patch before posting, to focus on ARM, but
apparently forgot to do so...
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 09/19] qemu: Introduce target_cpu_type()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 08/19] target/riscv: " Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:48 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 10/19] cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
` (9 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qemu/target_info-impl.h | 3 +++
include/qemu/target_info.h | 2 ++
target_info-stub.c | 2 ++
target_info.c | 5 +++++
4 files changed, 12 insertions(+)
diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
index 8fa585f8138..d6d671a03c0 100644
--- a/include/qemu/target_info-impl.h
+++ b/include/qemu/target_info-impl.h
@@ -30,6 +30,9 @@ struct BinaryTargetInfo {
/* runtime equivalent of TARGET_LONG_BITS definition */
unsigned long_bits;
+ /* runtime equivalent of CPU_RESOLVING_TYPE definition */
+ const char *const cpu_resolving_type;
+
};
#endif
diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
index 66c43b329cc..407ce328e85 100644
--- a/include/qemu/target_info.h
+++ b/include/qemu/target_info.h
@@ -34,4 +34,6 @@ bool target_words_bigendian(void);
unsigned target_long_bits(void);
+const char *target_cpu_type(void);
+
#endif
diff --git a/target_info-stub.c b/target_info-stub.c
index a5374caed6c..7d21675d4c0 100644
--- a/target_info-stub.c
+++ b/target_info-stub.c
@@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include "qemu/target_info-impl.h"
+#include "cpu.h"
#ifdef TARGET_INFO_STUB_NEEDED
@@ -17,6 +18,7 @@ static const BinaryTargetInfo target_info_stub = {
.system_arch = -1,
.endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
.long_bits = TARGET_LONG_BITS,
+ .cpu_resolving_type = CPU_RESOLVING_TYPE,
};
const BinaryTargetInfo *target_info(void)
diff --git a/target_info.c b/target_info.c
index 2fd32931e13..4ad205636c2 100644
--- a/target_info.c
+++ b/target_info.c
@@ -41,3 +41,8 @@ unsigned target_long_bits(void)
{
return target_info()->long_bits;
}
+
+const char *target_cpu_type(void)
+{
+ return target_info()->cpu_resolving_type;
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 09/19] qemu: Introduce target_cpu_type()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 09/19] qemu: Introduce target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-04 16:48 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/qemu/target_info-impl.h | 3 +++
> include/qemu/target_info.h | 2 ++
> target_info-stub.c | 2 ++
> target_info.c | 5 +++++
> 4 files changed, 12 insertions(+)
>
> diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h
> index 8fa585f8138..d6d671a03c0 100644
> --- a/include/qemu/target_info-impl.h
> +++ b/include/qemu/target_info-impl.h
> @@ -30,6 +30,9 @@ struct BinaryTargetInfo {
> /* runtime equivalent of TARGET_LONG_BITS definition */
> unsigned long_bits;
>
> + /* runtime equivalent of CPU_RESOLVING_TYPE definition */
> + const char *const cpu_resolving_type;
> +
> };
>
> #endif
> diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h
> index 66c43b329cc..407ce328e85 100644
> --- a/include/qemu/target_info.h
> +++ b/include/qemu/target_info.h
> @@ -34,4 +34,6 @@ bool target_words_bigendian(void);
>
> unsigned target_long_bits(void);
>
> +const char *target_cpu_type(void);
> +
> #endif
> diff --git a/target_info-stub.c b/target_info-stub.c
> index a5374caed6c..7d21675d4c0 100644
> --- a/target_info-stub.c
> +++ b/target_info-stub.c
> @@ -8,6 +8,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu/target_info-impl.h"
> +#include "cpu.h"
>
> #ifdef TARGET_INFO_STUB_NEEDED
>
> @@ -17,6 +18,7 @@ static const BinaryTargetInfo target_info_stub = {
> .system_arch = -1,
> .endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
> .long_bits = TARGET_LONG_BITS,
> + .cpu_resolving_type = CPU_RESOLVING_TYPE,
> };
>
> const BinaryTargetInfo *target_info(void)
> diff --git a/target_info.c b/target_info.c
> index 2fd32931e13..4ad205636c2 100644
> --- a/target_info.c
> +++ b/target_info.c
> @@ -41,3 +41,8 @@ unsigned target_long_bits(void)
> {
> return target_info()->long_bits;
> }
> +
> +const char *target_cpu_type(void)
> +{
> + return target_info()->cpu_resolving_type;
> +}
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 10/19] cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 09/19] qemu: Introduce target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:51 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 11/19] accel/tcg: " Philippe Mathieu-Daudé
` (8 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
cpu-target.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cpu-target.c b/cpu-target.c
index 761c2d28645..01b0064b91f 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -22,6 +22,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
+#include "qemu/target_info.h"
#include "system/accel-ops.h"
#include "system/cpus.h"
#include "exec/cpu-common.h"
@@ -37,7 +38,7 @@ QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
char *cpu_model_from_type(const char *typename)
{
- const char *suffix = "-" CPU_RESOLVING_TYPE;
+ g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
if (!object_class_by_name(typename)) {
return NULL;
@@ -63,7 +64,7 @@ const char *parse_cpu_option(const char *cpu_option)
exit(1);
}
- oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
+ oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
if (oc == NULL) {
error_report("unable to find CPU model '%s'", model_pieces[0]);
g_strfreev(model_pieces);
@@ -92,7 +93,7 @@ static void cpu_list_entry(gpointer data, gpointer user_data)
void list_cpus(void)
{
- CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
+ CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
if (cc->list_cpus) {
cc->list_cpus();
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 10/19] cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 10/19] cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-04 16:51 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> cpu-target.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/cpu-target.c b/cpu-target.c
> index 761c2d28645..01b0064b91f 100644
> --- a/cpu-target.c
> +++ b/cpu-target.c
> @@ -22,6 +22,7 @@
> #include "qapi/error.h"
> #include "qemu/error-report.h"
> #include "qemu/qemu-print.h"
> +#include "qemu/target_info.h"
> #include "system/accel-ops.h"
> #include "system/cpus.h"
> #include "exec/cpu-common.h"
> @@ -37,7 +38,7 @@ QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
>
> char *cpu_model_from_type(const char *typename)
> {
> - const char *suffix = "-" CPU_RESOLVING_TYPE;
> + g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
>
> if (!object_class_by_name(typename)) {
> return NULL;
> @@ -63,7 +64,7 @@ const char *parse_cpu_option(const char *cpu_option)
> exit(1);
> }
>
> - oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
> + oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
> if (oc == NULL) {
> error_report("unable to find CPU model '%s'", model_pieces[0]);
> g_strfreev(model_pieces);
> @@ -92,7 +93,7 @@ static void cpu_list_entry(gpointer data, gpointer user_data)
>
> void list_cpus(void)
> {
> - CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
> + CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
>
> if (cc->list_cpus) {
> cc->list_cpus();
This change can be done as it's not target dependent.
Please also squash other commits doing the same for other files, so we
have a single commit doing the change for whole codebase.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 11/19] accel/tcg: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 10/19] cpus: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:51 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 12/19] cpus: Move target-agnostic methods out of cpu-target.c Philippe Mathieu-Daudé
` (7 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/tcg-all.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index bf27c5c0fb3..a13cb39644f 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -35,6 +35,7 @@
#include "qapi/qapi-types-common.h"
#include "qapi/qapi-builtin-visit.h"
#include "qemu/units.h"
+#include "qemu/target_info.h"
#if defined(CONFIG_USER_ONLY)
#include "hw/qdev-core.h"
#else
@@ -44,7 +45,6 @@
#include "accel/tcg/cpu-ops.h"
#include "internal-common.h"
#include "cpu-param.h"
-#include "cpu.h"
struct TCGState {
@@ -73,7 +73,7 @@ bool qemu_tcg_mttcg_enabled(void)
static void mttcg_init(TCGState *s)
{
- CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
+ CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
bool mttcg_supported = cc->tcg_ops->mttcg_supported;
if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) {
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 11/19] accel/tcg: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 11/19] accel/tcg: " Philippe Mathieu-Daudé
@ 2025-04-04 16:51 ` Pierrick Bouvier
2025-04-04 17:56 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/tcg/tcg-all.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index bf27c5c0fb3..a13cb39644f 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -35,6 +35,7 @@
> #include "qapi/qapi-types-common.h"
> #include "qapi/qapi-builtin-visit.h"
> #include "qemu/units.h"
> +#include "qemu/target_info.h"
> #if defined(CONFIG_USER_ONLY)
> #include "hw/qdev-core.h"
> #else
> @@ -44,7 +45,6 @@
> #include "accel/tcg/cpu-ops.h"
> #include "internal-common.h"
> #include "cpu-param.h"
> -#include "cpu.h"
>
>
> struct TCGState {
> @@ -73,7 +73,7 @@ bool qemu_tcg_mttcg_enabled(void)
>
> static void mttcg_init(TCGState *s)
> {
> - CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
> + CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
> bool mttcg_supported = cc->tcg_ops->mttcg_supported;
>
> if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) {
It can be squashed with previous commit.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 11/19] accel/tcg: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-04 16:51 ` Pierrick Bouvier
@ 2025-04-04 17:56 ` Philippe Mathieu-Daudé
2025-04-04 18:04 ` Pierrick Bouvier
0 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-04 17:56 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 18:51, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> accel/tcg/tcg-all.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
>> index bf27c5c0fb3..a13cb39644f 100644
>> --- a/accel/tcg/tcg-all.c
>> +++ b/accel/tcg/tcg-all.c
>> @@ -35,6 +35,7 @@
>> #include "qapi/qapi-types-common.h"
>> #include "qapi/qapi-builtin-visit.h"
>> #include "qemu/units.h"
>> +#include "qemu/target_info.h"
>> #if defined(CONFIG_USER_ONLY)
>> #include "hw/qdev-core.h"
>> #else
>> @@ -44,7 +45,6 @@
>> #include "accel/tcg/cpu-ops.h"
>> #include "internal-common.h"
>> #include "cpu-param.h"
>> -#include "cpu.h"
>> struct TCGState {
>> @@ -73,7 +73,7 @@ bool qemu_tcg_mttcg_enabled(void)
>> static void mttcg_init(TCGState *s)
>> {
>> - CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
>> + CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
>> bool mttcg_supported = cc->tcg_ops->mttcg_supported;
>> if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) {
>
> It can be squashed with previous commit.
Not exactly the same set of maintainers, but can do.
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Thanks!
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 11/19] accel/tcg: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-04 17:56 ` Philippe Mathieu-Daudé
@ 2025-04-04 18:04 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 18:04 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 10:56, Philippe Mathieu-Daudé wrote:
> On 4/4/25 18:51, Pierrick Bouvier wrote:
>> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>> accel/tcg/tcg-all.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
>>> index bf27c5c0fb3..a13cb39644f 100644
>>> --- a/accel/tcg/tcg-all.c
>>> +++ b/accel/tcg/tcg-all.c
>>> @@ -35,6 +35,7 @@
>>> #include "qapi/qapi-types-common.h"
>>> #include "qapi/qapi-builtin-visit.h"
>>> #include "qemu/units.h"
>>> +#include "qemu/target_info.h"
>>> #if defined(CONFIG_USER_ONLY)
>>> #include "hw/qdev-core.h"
>>> #else
>>> @@ -44,7 +45,6 @@
>>> #include "accel/tcg/cpu-ops.h"
>>> #include "internal-common.h"
>>> #include "cpu-param.h"
>>> -#include "cpu.h"
>>> struct TCGState {
>>> @@ -73,7 +73,7 @@ bool qemu_tcg_mttcg_enabled(void)
>>> static void mttcg_init(TCGState *s)
>>> {
>>> - CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE));
>>> + CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
>>> bool mttcg_supported = cc->tcg_ops->mttcg_supported;
>>> if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) {
>>
>> It can be squashed with previous commit.
>
> Not exactly the same set of maintainers, but can do.
>
For mechanical changes like this, I guess it's less important than when
really touching a specific subsystem.
>> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>
> Thanks!
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 12/19] cpus: Move target-agnostic methods out of cpu-target.c
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 11/19] accel/tcg: " Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:53 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 13/19] accel: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
` (6 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
cpu-target.c | 78 +-------------------------------------------
hw/core/cpu-common.c | 74 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 77 deletions(-)
diff --git a/cpu-target.c b/cpu-target.c
index 01b0064b91f..20db5ff3108 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -19,94 +19,18 @@
#include "qemu/osdep.h"
#include "cpu.h"
-#include "qapi/error.h"
-#include "qemu/error-report.h"
-#include "qemu/qemu-print.h"
-#include "qemu/target_info.h"
#include "system/accel-ops.h"
#include "system/cpus.h"
#include "exec/cpu-common.h"
-#include "exec/tswap.h"
#include "exec/replay-core.h"
#include "exec/log.h"
-#include "accel/accel-cpu-target.h"
+#include "hw/core/cpu.h"
#include "trace/trace-root.h"
/* Validate correct placement of CPUArchState. */
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
-char *cpu_model_from_type(const char *typename)
-{
- g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
-
- if (!object_class_by_name(typename)) {
- return NULL;
- }
-
- if (g_str_has_suffix(typename, suffix)) {
- return g_strndup(typename, strlen(typename) - strlen(suffix));
- }
-
- return g_strdup(typename);
-}
-
-const char *parse_cpu_option(const char *cpu_option)
-{
- ObjectClass *oc;
- CPUClass *cc;
- gchar **model_pieces;
- const char *cpu_type;
-
- model_pieces = g_strsplit(cpu_option, ",", 2);
- if (!model_pieces[0]) {
- error_report("-cpu option cannot be empty");
- exit(1);
- }
-
- oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
- if (oc == NULL) {
- error_report("unable to find CPU model '%s'", model_pieces[0]);
- g_strfreev(model_pieces);
- exit(EXIT_FAILURE);
- }
-
- cpu_type = object_class_get_name(oc);
- cc = CPU_CLASS(oc);
- cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
- g_strfreev(model_pieces);
- return cpu_type;
-}
-
-static void cpu_list_entry(gpointer data, gpointer user_data)
-{
- CPUClass *cc = CPU_CLASS(OBJECT_CLASS(data));
- const char *typename = object_class_get_name(OBJECT_CLASS(data));
- g_autofree char *model = cpu_model_from_type(typename);
-
- if (cc->deprecation_note) {
- qemu_printf(" %s (deprecated)\n", model);
- } else {
- qemu_printf(" %s\n", model);
- }
-}
-
-void list_cpus(void)
-{
- CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
-
- if (cc->list_cpus) {
- cc->list_cpus();
- } else {
- GSList *list;
-
- list = object_class_get_list_sorted(TYPE_CPU, false);
- qemu_printf("Available CPUs:\n");
- g_slist_foreach(list, cpu_list_entry, NULL);
- g_slist_free(list);
- }
-}
-
/* enable or disable single step mode. EXCP_DEBUG is returned by the
CPU loop after each instruction */
void cpu_single_step(CPUState *cpu, int enabled)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 9064dd24f82..6d0788331c7 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -25,6 +25,9 @@
#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/lockcnt.h"
+#include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
+#include "qemu/target_info.h"
#include "exec/log.h"
#include "exec/gdbstub.h"
#include "system/tcg.h"
@@ -152,6 +155,21 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
return NULL;
}
+char *cpu_model_from_type(const char *typename)
+{
+ g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
+
+ if (!object_class_by_name(typename)) {
+ return NULL;
+ }
+
+ if (g_str_has_suffix(typename, suffix)) {
+ return g_strndup(typename, strlen(typename) - strlen(suffix));
+ }
+
+ return g_strdup(typename);
+}
+
static void cpu_common_parse_features(const char *typename, char *features,
Error **errp)
{
@@ -183,6 +201,33 @@ static void cpu_common_parse_features(const char *typename, char *features,
}
}
+const char *parse_cpu_option(const char *cpu_option)
+{
+ ObjectClass *oc;
+ CPUClass *cc;
+ gchar **model_pieces;
+ const char *cpu_type;
+
+ model_pieces = g_strsplit(cpu_option, ",", 2);
+ if (!model_pieces[0]) {
+ error_report("-cpu option cannot be empty");
+ exit(1);
+ }
+
+ oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
+ if (oc == NULL) {
+ error_report("unable to find CPU model '%s'", model_pieces[0]);
+ g_strfreev(model_pieces);
+ exit(EXIT_FAILURE);
+ }
+
+ cpu_type = object_class_get_name(oc);
+ cc = CPU_CLASS(oc);
+ cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
+ g_strfreev(model_pieces);
+ return cpu_type;
+}
+
bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
{
if (!accel_cpu_common_realize(cpu, errp)) {
@@ -359,3 +404,32 @@ static void cpu_register_types(void)
}
type_init(cpu_register_types)
+
+static void cpu_list_entry(gpointer data, gpointer user_data)
+{
+ CPUClass *cc = CPU_CLASS(OBJECT_CLASS(data));
+ const char *typename = object_class_get_name(OBJECT_CLASS(data));
+ g_autofree char *model = cpu_model_from_type(typename);
+
+ if (cc->deprecation_note) {
+ qemu_printf(" %s (deprecated)\n", model);
+ } else {
+ qemu_printf(" %s\n", model);
+ }
+}
+
+void list_cpus(void)
+{
+ CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
+
+ if (cc->list_cpus) {
+ cc->list_cpus();
+ } else {
+ GSList *list;
+
+ list = object_class_get_list_sorted(TYPE_CPU, false);
+ qemu_printf("Available CPUs:\n");
+ g_slist_foreach(list, cpu_list_entry, NULL);
+ g_slist_free(list);
+ }
+}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 12/19] cpus: Move target-agnostic methods out of cpu-target.c
2025-04-03 23:49 ` [RFC PATCH-for-10.1 12/19] cpus: Move target-agnostic methods out of cpu-target.c Philippe Mathieu-Daudé
@ 2025-04-04 16:53 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:53 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> cpu-target.c | 78 +-------------------------------------------
> hw/core/cpu-common.c | 74 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 75 insertions(+), 77 deletions(-)
>
> diff --git a/cpu-target.c b/cpu-target.c
> index 01b0064b91f..20db5ff3108 100644
> --- a/cpu-target.c
> +++ b/cpu-target.c
> @@ -19,94 +19,18 @@
>
> #include "qemu/osdep.h"
> #include "cpu.h"
> -#include "qapi/error.h"
> -#include "qemu/error-report.h"
> -#include "qemu/qemu-print.h"
> -#include "qemu/target_info.h"
> #include "system/accel-ops.h"
> #include "system/cpus.h"
> #include "exec/cpu-common.h"
> -#include "exec/tswap.h"
> #include "exec/replay-core.h"
> #include "exec/log.h"
> -#include "accel/accel-cpu-target.h"
> +#include "hw/core/cpu.h"
> #include "trace/trace-root.h"
>
> /* Validate correct placement of CPUArchState. */
> QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
> QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
>
> -char *cpu_model_from_type(const char *typename)
> -{
> - g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
> -
> - if (!object_class_by_name(typename)) {
> - return NULL;
> - }
> -
> - if (g_str_has_suffix(typename, suffix)) {
> - return g_strndup(typename, strlen(typename) - strlen(suffix));
> - }
> -
> - return g_strdup(typename);
> -}
> -
> -const char *parse_cpu_option(const char *cpu_option)
> -{
> - ObjectClass *oc;
> - CPUClass *cc;
> - gchar **model_pieces;
> - const char *cpu_type;
> -
> - model_pieces = g_strsplit(cpu_option, ",", 2);
> - if (!model_pieces[0]) {
> - error_report("-cpu option cannot be empty");
> - exit(1);
> - }
> -
> - oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
> - if (oc == NULL) {
> - error_report("unable to find CPU model '%s'", model_pieces[0]);
> - g_strfreev(model_pieces);
> - exit(EXIT_FAILURE);
> - }
> -
> - cpu_type = object_class_get_name(oc);
> - cc = CPU_CLASS(oc);
> - cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
> - g_strfreev(model_pieces);
> - return cpu_type;
> -}
> -
> -static void cpu_list_entry(gpointer data, gpointer user_data)
> -{
> - CPUClass *cc = CPU_CLASS(OBJECT_CLASS(data));
> - const char *typename = object_class_get_name(OBJECT_CLASS(data));
> - g_autofree char *model = cpu_model_from_type(typename);
> -
> - if (cc->deprecation_note) {
> - qemu_printf(" %s (deprecated)\n", model);
> - } else {
> - qemu_printf(" %s\n", model);
> - }
> -}
> -
> -void list_cpus(void)
> -{
> - CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
> -
> - if (cc->list_cpus) {
> - cc->list_cpus();
> - } else {
> - GSList *list;
> -
> - list = object_class_get_list_sorted(TYPE_CPU, false);
> - qemu_printf("Available CPUs:\n");
> - g_slist_foreach(list, cpu_list_entry, NULL);
> - g_slist_free(list);
> - }
> -}
> -
> /* enable or disable single step mode. EXCP_DEBUG is returned by the
> CPU loop after each instruction */
> void cpu_single_step(CPUState *cpu, int enabled)
> diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
> index 9064dd24f82..6d0788331c7 100644
> --- a/hw/core/cpu-common.c
> +++ b/hw/core/cpu-common.c
> @@ -25,6 +25,9 @@
> #include "qemu/log.h"
> #include "qemu/main-loop.h"
> #include "qemu/lockcnt.h"
> +#include "qemu/error-report.h"
> +#include "qemu/qemu-print.h"
> +#include "qemu/target_info.h"
> #include "exec/log.h"
> #include "exec/gdbstub.h"
> #include "system/tcg.h"
> @@ -152,6 +155,21 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
> return NULL;
> }
>
> +char *cpu_model_from_type(const char *typename)
> +{
> + g_autofree char *suffix = g_strdup_printf("-%s", target_cpu_type());
> +
> + if (!object_class_by_name(typename)) {
> + return NULL;
> + }
> +
> + if (g_str_has_suffix(typename, suffix)) {
> + return g_strndup(typename, strlen(typename) - strlen(suffix));
> + }
> +
> + return g_strdup(typename);
> +}
> +
> static void cpu_common_parse_features(const char *typename, char *features,
> Error **errp)
> {
> @@ -183,6 +201,33 @@ static void cpu_common_parse_features(const char *typename, char *features,
> }
> }
>
> +const char *parse_cpu_option(const char *cpu_option)
> +{
> + ObjectClass *oc;
> + CPUClass *cc;
> + gchar **model_pieces;
> + const char *cpu_type;
> +
> + model_pieces = g_strsplit(cpu_option, ",", 2);
> + if (!model_pieces[0]) {
> + error_report("-cpu option cannot be empty");
> + exit(1);
> + }
> +
> + oc = cpu_class_by_name(target_cpu_type(), model_pieces[0]);
> + if (oc == NULL) {
> + error_report("unable to find CPU model '%s'", model_pieces[0]);
> + g_strfreev(model_pieces);
> + exit(EXIT_FAILURE);
> + }
> +
> + cpu_type = object_class_get_name(oc);
> + cc = CPU_CLASS(oc);
> + cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
> + g_strfreev(model_pieces);
> + return cpu_type;
> +}
> +
> bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
> {
> if (!accel_cpu_common_realize(cpu, errp)) {
> @@ -359,3 +404,32 @@ static void cpu_register_types(void)
> }
>
> type_init(cpu_register_types)
> +
> +static void cpu_list_entry(gpointer data, gpointer user_data)
> +{
> + CPUClass *cc = CPU_CLASS(OBJECT_CLASS(data));
> + const char *typename = object_class_get_name(OBJECT_CLASS(data));
> + g_autofree char *model = cpu_model_from_type(typename);
> +
> + if (cc->deprecation_note) {
> + qemu_printf(" %s (deprecated)\n", model);
> + } else {
> + qemu_printf(" %s\n", model);
> + }
> +}
> +
> +void list_cpus(void)
> +{
> + CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type()));
> +
> + if (cc->list_cpus) {
> + cc->list_cpus();
> + } else {
> + GSList *list;
> +
> + list = object_class_get_list_sorted(TYPE_CPU, false);
> + qemu_printf("Available CPUs:\n");
> + g_slist_foreach(list, cpu_list_entry, NULL);
> + g_slist_free(list);
> + }
> +}
Sounds good,
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 13/19] accel: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 12/19] cpus: Move target-agnostic methods out of cpu-target.c Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:52 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 14/19] accel: Implement accel_init_ops_interfaces() for both system/user mode Philippe Mathieu-Daudé
` (5 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/accel-target.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/accel/accel-target.c b/accel/accel-target.c
index 33a539b4cbb..9e9e70be876 100644
--- a/accel/accel-target.c
+++ b/accel/accel-target.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/accel.h"
+#include "qemu/target_info.h"
#include "cpu.h"
#include "accel/accel-cpu-target.h"
@@ -88,17 +89,18 @@ static void accel_init_cpu_interfaces(AccelClass *ac)
const char *ac_name; /* AccelClass name */
char *acc_name; /* AccelCPUClass name */
ObjectClass *acc; /* AccelCPUClass */
+ const char *cpu_resolving_type = target_cpu_type();
ac_name = object_class_get_name(OBJECT_CLASS(ac));
g_assert(ac_name != NULL);
- acc_name = g_strdup_printf("%s-%s", ac_name, CPU_RESOLVING_TYPE);
+ acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
acc = object_class_by_name(acc_name);
g_free(acc_name);
if (acc) {
object_class_foreach(accel_init_cpu_int_aux,
- CPU_RESOLVING_TYPE, false, acc);
+ cpu_resolving_type, false, acc);
}
}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 13/19] accel: Replace CPU_RESOLVING_TYPE -> target_cpu_type()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 13/19] accel: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-04 16:52 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/accel-target.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/accel/accel-target.c b/accel/accel-target.c
> index 33a539b4cbb..9e9e70be876 100644
> --- a/accel/accel-target.c
> +++ b/accel/accel-target.c
> @@ -25,6 +25,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu/accel.h"
> +#include "qemu/target_info.h"
>
> #include "cpu.h"
> #include "accel/accel-cpu-target.h"
> @@ -88,17 +89,18 @@ static void accel_init_cpu_interfaces(AccelClass *ac)
> const char *ac_name; /* AccelClass name */
> char *acc_name; /* AccelCPUClass name */
> ObjectClass *acc; /* AccelCPUClass */
> + const char *cpu_resolving_type = target_cpu_type();
>
> ac_name = object_class_get_name(OBJECT_CLASS(ac));
> g_assert(ac_name != NULL);
>
> - acc_name = g_strdup_printf("%s-%s", ac_name, CPU_RESOLVING_TYPE);
> + acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
> acc = object_class_by_name(acc_name);
> g_free(acc_name);
>
> if (acc) {
> object_class_foreach(accel_init_cpu_int_aux,
> - CPU_RESOLVING_TYPE, false, acc);
> + cpu_resolving_type, false, acc);
> }
> }
>
Please squash with related commit.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 14/19] accel: Implement accel_init_ops_interfaces() for both system/user mode
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 13/19] accel: Replace CPU_RESOLVING_TYPE -> target_cpu_type() Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:56 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 15/19] accel: Include missing 'qemu/accel.h' header in accel-internal.h Philippe Mathieu-Daudé
` (4 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/{accel-system.h => accel-internal.h} | 8 ++++----
accel/accel-system.c | 4 ++--
accel/accel-target.c | 10 ++--------
accel/accel-user.c | 6 ++++++
4 files changed, 14 insertions(+), 14 deletions(-)
rename accel/{accel-system.h => accel-internal.h} (56%)
diff --git a/accel/accel-system.h b/accel/accel-internal.h
similarity index 56%
rename from accel/accel-system.h
rename to accel/accel-internal.h
index 2d37c73c97b..03426aa21ee 100644
--- a/accel/accel-system.h
+++ b/accel/accel-internal.h
@@ -1,5 +1,5 @@
/*
- * QEMU System Emulation accel internal functions
+ * QEMU accel internal functions
*
* Copyright 2021 SUSE LLC
*
@@ -7,9 +7,9 @@
* See the COPYING file in the top-level directory.
*/
-#ifndef ACCEL_SYSTEM_H
-#define ACCEL_SYSTEM_H
+#ifndef ACCEL_INTERNAL_H
+#define ACCEL_INTERNAL_H
-void accel_system_init_ops_interfaces(AccelClass *ac);
+void accel_init_ops_interfaces(AccelClass *ac);
#endif /* ACCEL_SYSTEM_H */
diff --git a/accel/accel-system.c b/accel/accel-system.c
index 5df49fbe831..a0f562ae9ff 100644
--- a/accel/accel-system.c
+++ b/accel/accel-system.c
@@ -29,7 +29,7 @@
#include "system/accel-ops.h"
#include "system/cpus.h"
#include "qemu/error-report.h"
-#include "accel-system.h"
+#include "accel-internal.h"
int accel_init_machine(AccelState *accel, MachineState *ms)
{
@@ -63,7 +63,7 @@ void accel_setup_post(MachineState *ms)
}
/* initialize the arch-independent accel operation interfaces */
-void accel_system_init_ops_interfaces(AccelClass *ac)
+void accel_init_ops_interfaces(AccelClass *ac)
{
const char *ac_name;
char *ops_name;
diff --git a/accel/accel-target.c b/accel/accel-target.c
index 9e9e70be876..6fa5c3ef04e 100644
--- a/accel/accel-target.c
+++ b/accel/accel-target.c
@@ -29,10 +29,7 @@
#include "cpu.h"
#include "accel/accel-cpu-target.h"
-
-#ifndef CONFIG_USER_ONLY
-#include "accel-system.h"
-#endif /* !CONFIG_USER_ONLY */
+#include "accel-internal.h"
static const TypeInfo accel_type = {
.name = TYPE_ACCEL,
@@ -106,10 +103,7 @@ static void accel_init_cpu_interfaces(AccelClass *ac)
void accel_init_interfaces(AccelClass *ac)
{
-#ifndef CONFIG_USER_ONLY
- accel_system_init_ops_interfaces(ac);
-#endif /* !CONFIG_USER_ONLY */
-
+ accel_init_ops_interfaces(ac);
accel_init_cpu_interfaces(ac);
}
diff --git a/accel/accel-user.c b/accel/accel-user.c
index 22b6a1a1a89..7d192306a65 100644
--- a/accel/accel-user.c
+++ b/accel/accel-user.c
@@ -9,6 +9,12 @@
#include "qemu/osdep.h"
#include "qemu/accel.h"
+#include "accel-internal.h"
+
+void accel_init_ops_interfaces(AccelClass *ac)
+{
+ /* nothing */
+}
AccelState *current_accel(void)
{
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 14/19] accel: Implement accel_init_ops_interfaces() for both system/user mode
2025-04-03 23:49 ` [RFC PATCH-for-10.1 14/19] accel: Implement accel_init_ops_interfaces() for both system/user mode Philippe Mathieu-Daudé
@ 2025-04-04 16:56 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:56 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/{accel-system.h => accel-internal.h} | 8 ++++----
> accel/accel-system.c | 4 ++--
> accel/accel-target.c | 10 ++--------
> accel/accel-user.c | 6 ++++++
> 4 files changed, 14 insertions(+), 14 deletions(-)
> rename accel/{accel-system.h => accel-internal.h} (56%)
>
> diff --git a/accel/accel-system.h b/accel/accel-internal.h
> similarity index 56%
> rename from accel/accel-system.h
> rename to accel/accel-internal.h
> index 2d37c73c97b..03426aa21ee 100644
> --- a/accel/accel-system.h
> +++ b/accel/accel-internal.h
> @@ -1,5 +1,5 @@
> /*
> - * QEMU System Emulation accel internal functions
> + * QEMU accel internal functions
> *
> * Copyright 2021 SUSE LLC
> *
> @@ -7,9 +7,9 @@
> * See the COPYING file in the top-level directory.
> */
>
> -#ifndef ACCEL_SYSTEM_H
> -#define ACCEL_SYSTEM_H
> +#ifndef ACCEL_INTERNAL_H
> +#define ACCEL_INTERNAL_H
>
> -void accel_system_init_ops_interfaces(AccelClass *ac);
> +void accel_init_ops_interfaces(AccelClass *ac);
>
> #endif /* ACCEL_SYSTEM_H */
> diff --git a/accel/accel-system.c b/accel/accel-system.c
> index 5df49fbe831..a0f562ae9ff 100644
> --- a/accel/accel-system.c
> +++ b/accel/accel-system.c
> @@ -29,7 +29,7 @@
> #include "system/accel-ops.h"
> #include "system/cpus.h"
> #include "qemu/error-report.h"
> -#include "accel-system.h"
> +#include "accel-internal.h"
>
> int accel_init_machine(AccelState *accel, MachineState *ms)
> {
> @@ -63,7 +63,7 @@ void accel_setup_post(MachineState *ms)
> }
>
> /* initialize the arch-independent accel operation interfaces */
> -void accel_system_init_ops_interfaces(AccelClass *ac)
> +void accel_init_ops_interfaces(AccelClass *ac)
> {
> const char *ac_name;
> char *ops_name;
> diff --git a/accel/accel-target.c b/accel/accel-target.c
> index 9e9e70be876..6fa5c3ef04e 100644
> --- a/accel/accel-target.c
> +++ b/accel/accel-target.c
> @@ -29,10 +29,7 @@
>
> #include "cpu.h"
> #include "accel/accel-cpu-target.h"
> -
> -#ifndef CONFIG_USER_ONLY
> -#include "accel-system.h"
> -#endif /* !CONFIG_USER_ONLY */
> +#include "accel-internal.h"
>
> static const TypeInfo accel_type = {
> .name = TYPE_ACCEL,
> @@ -106,10 +103,7 @@ static void accel_init_cpu_interfaces(AccelClass *ac)
>
> void accel_init_interfaces(AccelClass *ac)
> {
> -#ifndef CONFIG_USER_ONLY
> - accel_system_init_ops_interfaces(ac);
> -#endif /* !CONFIG_USER_ONLY */
> -
> + accel_init_ops_interfaces(ac);
> accel_init_cpu_interfaces(ac);
> }
>
> diff --git a/accel/accel-user.c b/accel/accel-user.c
> index 22b6a1a1a89..7d192306a65 100644
> --- a/accel/accel-user.c
> +++ b/accel/accel-user.c
> @@ -9,6 +9,12 @@
>
> #include "qemu/osdep.h"
> #include "qemu/accel.h"
> +#include "accel-internal.h"
> +
> +void accel_init_ops_interfaces(AccelClass *ac)
> +{
> + /* nothing */
> +}
>
> AccelState *current_accel(void)
> {
That's good, and it's how we want to get rid of user/system conditionals.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 15/19] accel: Include missing 'qemu/accel.h' header in accel-internal.h
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 14/19] accel: Implement accel_init_ops_interfaces() for both system/user mode Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:56 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 16/19] accel: Make AccelCPUClass structure target-agnostic Philippe Mathieu-Daudé
` (3 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
In file included from ../../accel/accel-target.c:29:
../../accel/accel-internal.h:13:32: error: unknown type name 'AccelClass'
13 | void accel_init_ops_interfaces(AccelClass *ac);
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/accel-internal.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/accel/accel-internal.h b/accel/accel-internal.h
index 03426aa21ee..d3a4422cbf7 100644
--- a/accel/accel-internal.h
+++ b/accel/accel-internal.h
@@ -10,6 +10,8 @@
#ifndef ACCEL_INTERNAL_H
#define ACCEL_INTERNAL_H
+#include "qemu/accel.h"
+
void accel_init_ops_interfaces(AccelClass *ac);
#endif /* ACCEL_SYSTEM_H */
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 15/19] accel: Include missing 'qemu/accel.h' header in accel-internal.h
2025-04-03 23:49 ` [RFC PATCH-for-10.1 15/19] accel: Include missing 'qemu/accel.h' header in accel-internal.h Philippe Mathieu-Daudé
@ 2025-04-04 16:56 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:56 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> In file included from ../../accel/accel-target.c:29:
> ../../accel/accel-internal.h:13:32: error: unknown type name 'AccelClass'
> 13 | void accel_init_ops_interfaces(AccelClass *ac);
> | ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/accel-internal.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/accel/accel-internal.h b/accel/accel-internal.h
> index 03426aa21ee..d3a4422cbf7 100644
> --- a/accel/accel-internal.h
> +++ b/accel/accel-internal.h
> @@ -10,6 +10,8 @@
> #ifndef ACCEL_INTERNAL_H
> #define ACCEL_INTERNAL_H
>
> +#include "qemu/accel.h"
> +
> void accel_init_ops_interfaces(AccelClass *ac);
>
> #endif /* ACCEL_SYSTEM_H */
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 16/19] accel: Make AccelCPUClass structure target-agnostic
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 15/19] accel: Include missing 'qemu/accel.h' header in accel-internal.h Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:57 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c Philippe Mathieu-Daudé
` (2 subsequent siblings)
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Include missing "hw/core/cpu.h" header in "accel/accel-cpu.h" to avoid:
include/accel/accel-cpu-target.h:39:28: error: unknown type name 'CPUClass'
39 | void (*cpu_class_init)(CPUClass *cc);
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/accel/accel-cpu-target.h | 12 +-----------
include/accel/accel-cpu.h | 23 +++++++++++++++++++++++
accel/accel-target.c | 1 -
3 files changed, 24 insertions(+), 12 deletions(-)
create mode 100644 include/accel/accel-cpu.h
diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-target.h
index 37dde7fae3e..6feb344e29b 100644
--- a/include/accel/accel-cpu-target.h
+++ b/include/accel/accel-cpu-target.h
@@ -21,21 +21,11 @@
*/
#include "qom/object.h"
+#include "accel/accel-cpu.h"
#include "cpu.h"
#define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE
#define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU)
-typedef struct AccelCPUClass AccelCPUClass;
DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU)
-typedef struct AccelCPUClass {
- /*< private >*/
- ObjectClass parent_class;
- /*< public >*/
-
- void (*cpu_class_init)(CPUClass *cc);
- void (*cpu_instance_init)(CPUState *cpu);
- bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
-} AccelCPUClass;
-
#endif /* ACCEL_CPU_H */
diff --git a/include/accel/accel-cpu.h b/include/accel/accel-cpu.h
new file mode 100644
index 00000000000..9e7eede7c3c
--- /dev/null
+++ b/include/accel/accel-cpu.h
@@ -0,0 +1,23 @@
+/*
+ * Accelerator interface, specializes CPUClass
+ *
+ * Copyright 2021 SUSE LLC
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef ACCEL_CPU_H
+#define ACCEL_CPU_H
+
+#include "qom/object.h"
+#include "hw/core/cpu.h"
+
+typedef struct AccelCPUClass {
+ ObjectClass parent_class;
+
+ void (*cpu_class_init)(CPUClass *cc);
+ void (*cpu_instance_init)(CPUState *cpu);
+ bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
+} AccelCPUClass;
+
+#endif /* ACCEL_CPU_H */
diff --git a/accel/accel-target.c b/accel/accel-target.c
index 6fa5c3ef04e..769a90230bf 100644
--- a/accel/accel-target.c
+++ b/accel/accel-target.c
@@ -27,7 +27,6 @@
#include "qemu/accel.h"
#include "qemu/target_info.h"
-#include "cpu.h"
#include "accel/accel-cpu-target.h"
#include "accel-internal.h"
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 16/19] accel: Make AccelCPUClass structure target-agnostic
2025-04-03 23:49 ` [RFC PATCH-for-10.1 16/19] accel: Make AccelCPUClass structure target-agnostic Philippe Mathieu-Daudé
@ 2025-04-04 16:57 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:57 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Include missing "hw/core/cpu.h" header in "accel/accel-cpu.h" to avoid:
>
> include/accel/accel-cpu-target.h:39:28: error: unknown type name 'CPUClass'
> 39 | void (*cpu_class_init)(CPUClass *cc);
> | ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/accel/accel-cpu-target.h | 12 +-----------
> include/accel/accel-cpu.h | 23 +++++++++++++++++++++++
> accel/accel-target.c | 1 -
> 3 files changed, 24 insertions(+), 12 deletions(-)
> create mode 100644 include/accel/accel-cpu.h
>
> diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-target.h
> index 37dde7fae3e..6feb344e29b 100644
> --- a/include/accel/accel-cpu-target.h
> +++ b/include/accel/accel-cpu-target.h
> @@ -21,21 +21,11 @@
> */
>
> #include "qom/object.h"
> +#include "accel/accel-cpu.h"
> #include "cpu.h"
>
> #define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE
> #define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU)
> -typedef struct AccelCPUClass AccelCPUClass;
> DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU)
>
> -typedef struct AccelCPUClass {
> - /*< private >*/
> - ObjectClass parent_class;
> - /*< public >*/
> -
> - void (*cpu_class_init)(CPUClass *cc);
> - void (*cpu_instance_init)(CPUState *cpu);
> - bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
> -} AccelCPUClass;
> -
> #endif /* ACCEL_CPU_H */
> diff --git a/include/accel/accel-cpu.h b/include/accel/accel-cpu.h
> new file mode 100644
> index 00000000000..9e7eede7c3c
> --- /dev/null
> +++ b/include/accel/accel-cpu.h
> @@ -0,0 +1,23 @@
> +/*
> + * Accelerator interface, specializes CPUClass
> + *
> + * Copyright 2021 SUSE LLC
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef ACCEL_CPU_H
> +#define ACCEL_CPU_H
> +
> +#include "qom/object.h"
> +#include "hw/core/cpu.h"
> +
> +typedef struct AccelCPUClass {
> + ObjectClass parent_class;
> +
> + void (*cpu_class_init)(CPUClass *cc);
> + void (*cpu_instance_init)(CPUState *cpu);
> + bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
> +} AccelCPUClass;
> +
> +#endif /* ACCEL_CPU_H */
> diff --git a/accel/accel-target.c b/accel/accel-target.c
> index 6fa5c3ef04e..769a90230bf 100644
> --- a/accel/accel-target.c
> +++ b/accel/accel-target.c
> @@ -27,7 +27,6 @@
> #include "qemu/accel.h"
> #include "qemu/target_info.h"
>
> -#include "cpu.h"
> #include "accel/accel-cpu-target.h"
> #include "accel-internal.h"
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 16/19] accel: Make AccelCPUClass structure target-agnostic Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 16:59 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 18/19] qemu: Prepare per-binary QOM filter via TYPE_BINARY_PREFIX Philippe Mathieu-Daudé
2025-04-03 23:49 ` [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter() Philippe Mathieu-Daudé
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/accel-common.c | 142 +++++++++++++++++++++++++++++++++++++++++++
accel/accel-target.c | 129 ---------------------------------------
accel/meson.build | 1 +
3 files changed, 143 insertions(+), 129 deletions(-)
create mode 100644 accel/accel-common.c
diff --git a/accel/accel-common.c b/accel/accel-common.c
new file mode 100644
index 00000000000..f505461fc88
--- /dev/null
+++ b/accel/accel-common.c
@@ -0,0 +1,142 @@
+/*
+ * QEMU accel class, components common to system emulation and user mode
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2014 Red Hat Inc.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/accel.h"
+#include "qemu/target_info.h"
+#include "accel/accel-cpu.h"
+#include "accel-internal.h"
+
+/* Lookup AccelClass from opt_name. Returns NULL if not found */
+AccelClass *accel_find(const char *opt_name)
+{
+ char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
+ AccelClass *ac = ACCEL_CLASS(module_object_class_by_name(class_name));
+ g_free(class_name);
+ return ac;
+}
+
+/* Return the name of the current accelerator */
+const char *current_accel_name(void)
+{
+ AccelClass *ac = ACCEL_GET_CLASS(current_accel());
+
+ return ac->name;
+}
+
+static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
+{
+ CPUClass *cc = CPU_CLASS(klass);
+ AccelCPUClass *accel_cpu = opaque;
+
+ /*
+ * The first callback allows accel-cpu to run initializations
+ * for the CPU, customizing CPU behavior according to the accelerator.
+ *
+ * The second one allows the CPU to customize the accel-cpu
+ * behavior according to the CPU.
+ *
+ * The second is currently only used by TCG, to specialize the
+ * TCGCPUOps depending on the CPU type.
+ */
+ cc->accel_cpu = accel_cpu;
+ if (accel_cpu->cpu_class_init) {
+ accel_cpu->cpu_class_init(cc);
+ }
+ if (cc->init_accel_cpu) {
+ cc->init_accel_cpu(accel_cpu, cc);
+ }
+}
+
+/* initialize the arch-specific accel CpuClass interfaces */
+static void accel_init_cpu_interfaces(AccelClass *ac)
+{
+ const char *ac_name; /* AccelClass name */
+ char *acc_name; /* AccelCPUClass name */
+ ObjectClass *acc; /* AccelCPUClass */
+ const char *cpu_resolving_type = target_cpu_type();
+
+ ac_name = object_class_get_name(OBJECT_CLASS(ac));
+ g_assert(ac_name != NULL);
+
+ acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
+ acc = object_class_by_name(acc_name);
+ g_free(acc_name);
+
+ if (acc) {
+ object_class_foreach(accel_init_cpu_int_aux,
+ cpu_resolving_type, false, acc);
+ }
+}
+
+void accel_init_interfaces(AccelClass *ac)
+{
+ accel_init_ops_interfaces(ac);
+ accel_init_cpu_interfaces(ac);
+}
+
+void accel_cpu_instance_init(CPUState *cpu)
+{
+ if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
+ cpu->cc->accel_cpu->cpu_instance_init(cpu);
+ }
+}
+
+bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
+{
+ AccelState *accel = current_accel();
+ AccelClass *acc = ACCEL_GET_CLASS(accel);
+
+ /* target specific realization */
+ if (cpu->cc->accel_cpu
+ && cpu->cc->accel_cpu->cpu_target_realize
+ && !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
+ return false;
+ }
+
+ /* generic realization */
+ if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
+ return false;
+ }
+
+ return true;
+}
+
+void accel_cpu_common_unrealize(CPUState *cpu)
+{
+ AccelState *accel = current_accel();
+ AccelClass *acc = ACCEL_GET_CLASS(accel);
+
+ /* generic unrealization */
+ if (acc->cpu_common_unrealize) {
+ acc->cpu_common_unrealize(cpu);
+ }
+}
+
+int accel_supported_gdbstub_sstep_flags(void)
+{
+ AccelState *accel = current_accel();
+ AccelClass *acc = ACCEL_GET_CLASS(accel);
+ if (acc->gdbstub_supported_sstep_flags) {
+ return acc->gdbstub_supported_sstep_flags();
+ }
+ return 0;
+}
+
+static const TypeInfo accel_types[] = {
+ {
+ .name = TYPE_ACCEL,
+ .parent = TYPE_OBJECT,
+ .class_size = sizeof(AccelClass),
+ .instance_size = sizeof(AccelState),
+ .abstract = true,
+ },
+};
+
+DEFINE_TYPES(accel_types)
diff --git a/accel/accel-target.c b/accel/accel-target.c
index 769a90230bf..7fd392fbc4a 100644
--- a/accel/accel-target.c
+++ b/accel/accel-target.c
@@ -24,135 +24,7 @@
*/
#include "qemu/osdep.h"
-#include "qemu/accel.h"
-#include "qemu/target_info.h"
-
#include "accel/accel-cpu-target.h"
-#include "accel-internal.h"
-
-static const TypeInfo accel_type = {
- .name = TYPE_ACCEL,
- .parent = TYPE_OBJECT,
- .class_size = sizeof(AccelClass),
- .instance_size = sizeof(AccelState),
- .abstract = true,
-};
-
-/* Lookup AccelClass from opt_name. Returns NULL if not found */
-AccelClass *accel_find(const char *opt_name)
-{
- char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
- AccelClass *ac = ACCEL_CLASS(module_object_class_by_name(class_name));
- g_free(class_name);
- return ac;
-}
-
-/* Return the name of the current accelerator */
-const char *current_accel_name(void)
-{
- AccelClass *ac = ACCEL_GET_CLASS(current_accel());
-
- return ac->name;
-}
-
-static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
-{
- CPUClass *cc = CPU_CLASS(klass);
- AccelCPUClass *accel_cpu = opaque;
-
- /*
- * The first callback allows accel-cpu to run initializations
- * for the CPU, customizing CPU behavior according to the accelerator.
- *
- * The second one allows the CPU to customize the accel-cpu
- * behavior according to the CPU.
- *
- * The second is currently only used by TCG, to specialize the
- * TCGCPUOps depending on the CPU type.
- */
- cc->accel_cpu = accel_cpu;
- if (accel_cpu->cpu_class_init) {
- accel_cpu->cpu_class_init(cc);
- }
- if (cc->init_accel_cpu) {
- cc->init_accel_cpu(accel_cpu, cc);
- }
-}
-
-/* initialize the arch-specific accel CpuClass interfaces */
-static void accel_init_cpu_interfaces(AccelClass *ac)
-{
- const char *ac_name; /* AccelClass name */
- char *acc_name; /* AccelCPUClass name */
- ObjectClass *acc; /* AccelCPUClass */
- const char *cpu_resolving_type = target_cpu_type();
-
- ac_name = object_class_get_name(OBJECT_CLASS(ac));
- g_assert(ac_name != NULL);
-
- acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
- acc = object_class_by_name(acc_name);
- g_free(acc_name);
-
- if (acc) {
- object_class_foreach(accel_init_cpu_int_aux,
- cpu_resolving_type, false, acc);
- }
-}
-
-void accel_init_interfaces(AccelClass *ac)
-{
- accel_init_ops_interfaces(ac);
- accel_init_cpu_interfaces(ac);
-}
-
-void accel_cpu_instance_init(CPUState *cpu)
-{
- if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
- cpu->cc->accel_cpu->cpu_instance_init(cpu);
- }
-}
-
-bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
-{
- AccelState *accel = current_accel();
- AccelClass *acc = ACCEL_GET_CLASS(accel);
-
- /* target specific realization */
- if (cpu->cc->accel_cpu
- && cpu->cc->accel_cpu->cpu_target_realize
- && !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
- return false;
- }
-
- /* generic realization */
- if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
- return false;
- }
-
- return true;
-}
-
-void accel_cpu_common_unrealize(CPUState *cpu)
-{
- AccelState *accel = current_accel();
- AccelClass *acc = ACCEL_GET_CLASS(accel);
-
- /* generic unrealization */
- if (acc->cpu_common_unrealize) {
- acc->cpu_common_unrealize(cpu);
- }
-}
-
-int accel_supported_gdbstub_sstep_flags(void)
-{
- AccelState *accel = current_accel();
- AccelClass *acc = ACCEL_GET_CLASS(accel);
- if (acc->gdbstub_supported_sstep_flags) {
- return acc->gdbstub_supported_sstep_flags();
- }
- return 0;
-}
static const TypeInfo accel_cpu_type = {
.name = TYPE_ACCEL_CPU,
@@ -163,7 +35,6 @@ static const TypeInfo accel_cpu_type = {
static void register_accel_types(void)
{
- type_register_static(&accel_type);
type_register_static(&accel_cpu_type);
}
diff --git a/accel/meson.build b/accel/meson.build
index 5eaeb683385..52909314bfa 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -1,3 +1,4 @@
+common_ss.add(files('accel-common.c'))
specific_ss.add(files('accel-target.c'))
system_ss.add(files('accel-system.c', 'accel-blocker.c'))
user_ss.add(files('accel-user.c'))
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c
2025-04-03 23:49 ` [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c Philippe Mathieu-Daudé
@ 2025-04-04 16:59 ` Pierrick Bouvier
2025-04-17 16:42 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 16:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/accel-common.c | 142 +++++++++++++++++++++++++++++++++++++++++++
> accel/accel-target.c | 129 ---------------------------------------
> accel/meson.build | 1 +
> 3 files changed, 143 insertions(+), 129 deletions(-)
> create mode 100644 accel/accel-common.c
>
> diff --git a/accel/accel-common.c b/accel/accel-common.c
> new file mode 100644
> index 00000000000..f505461fc88
> --- /dev/null
> +++ b/accel/accel-common.c
> @@ -0,0 +1,142 @@
> +/*
> + * QEMU accel class, components common to system emulation and user mode
> + *
> + * Copyright (c) 2003-2008 Fabrice Bellard
> + * Copyright (c) 2014 Red Hat Inc.
> + *
> + * SPDX-License-Identifier: MIT
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/accel.h"
> +#include "qemu/target_info.h"
> +#include "accel/accel-cpu.h"
> +#include "accel-internal.h"
> +
> +/* Lookup AccelClass from opt_name. Returns NULL if not found */
> +AccelClass *accel_find(const char *opt_name)
> +{
> + char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
> + AccelClass *ac = ACCEL_CLASS(module_object_class_by_name(class_name));
> + g_free(class_name);
> + return ac;
> +}
> +
> +/* Return the name of the current accelerator */
> +const char *current_accel_name(void)
> +{
> + AccelClass *ac = ACCEL_GET_CLASS(current_accel());
> +
> + return ac->name;
> +}
> +
> +static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
> +{
> + CPUClass *cc = CPU_CLASS(klass);
> + AccelCPUClass *accel_cpu = opaque;
> +
> + /*
> + * The first callback allows accel-cpu to run initializations
> + * for the CPU, customizing CPU behavior according to the accelerator.
> + *
> + * The second one allows the CPU to customize the accel-cpu
> + * behavior according to the CPU.
> + *
> + * The second is currently only used by TCG, to specialize the
> + * TCGCPUOps depending on the CPU type.
> + */
> + cc->accel_cpu = accel_cpu;
> + if (accel_cpu->cpu_class_init) {
> + accel_cpu->cpu_class_init(cc);
> + }
> + if (cc->init_accel_cpu) {
> + cc->init_accel_cpu(accel_cpu, cc);
> + }
> +}
> +
> +/* initialize the arch-specific accel CpuClass interfaces */
> +static void accel_init_cpu_interfaces(AccelClass *ac)
> +{
> + const char *ac_name; /* AccelClass name */
> + char *acc_name; /* AccelCPUClass name */
> + ObjectClass *acc; /* AccelCPUClass */
> + const char *cpu_resolving_type = target_cpu_type();
> +
> + ac_name = object_class_get_name(OBJECT_CLASS(ac));
> + g_assert(ac_name != NULL);
> +
> + acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
> + acc = object_class_by_name(acc_name);
> + g_free(acc_name);
> +
> + if (acc) {
> + object_class_foreach(accel_init_cpu_int_aux,
> + cpu_resolving_type, false, acc);
> + }
> +}
> +
> +void accel_init_interfaces(AccelClass *ac)
> +{
> + accel_init_ops_interfaces(ac);
> + accel_init_cpu_interfaces(ac);
> +}
> +
> +void accel_cpu_instance_init(CPUState *cpu)
> +{
> + if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
> + cpu->cc->accel_cpu->cpu_instance_init(cpu);
> + }
> +}
> +
> +bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
> +{
> + AccelState *accel = current_accel();
> + AccelClass *acc = ACCEL_GET_CLASS(accel);
> +
> + /* target specific realization */
> + if (cpu->cc->accel_cpu
> + && cpu->cc->accel_cpu->cpu_target_realize
> + && !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
> + return false;
> + }
> +
> + /* generic realization */
> + if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
> + return false;
> + }
> +
> + return true;
> +}
> +
> +void accel_cpu_common_unrealize(CPUState *cpu)
> +{
> + AccelState *accel = current_accel();
> + AccelClass *acc = ACCEL_GET_CLASS(accel);
> +
> + /* generic unrealization */
> + if (acc->cpu_common_unrealize) {
> + acc->cpu_common_unrealize(cpu);
> + }
> +}
> +
> +int accel_supported_gdbstub_sstep_flags(void)
> +{
> + AccelState *accel = current_accel();
> + AccelClass *acc = ACCEL_GET_CLASS(accel);
> + if (acc->gdbstub_supported_sstep_flags) {
> + return acc->gdbstub_supported_sstep_flags();
> + }
> + return 0;
> +}
> +
> +static const TypeInfo accel_types[] = {
> + {
> + .name = TYPE_ACCEL,
> + .parent = TYPE_OBJECT,
> + .class_size = sizeof(AccelClass),
> + .instance_size = sizeof(AccelState),
> + .abstract = true,
> + },
> +};
> +
> +DEFINE_TYPES(accel_types)
> diff --git a/accel/accel-target.c b/accel/accel-target.c
> index 769a90230bf..7fd392fbc4a 100644
> --- a/accel/accel-target.c
> +++ b/accel/accel-target.c
> @@ -24,135 +24,7 @@
> */
>
> #include "qemu/osdep.h"
> -#include "qemu/accel.h"
> -#include "qemu/target_info.h"
> -
> #include "accel/accel-cpu-target.h"
> -#include "accel-internal.h"
> -
> -static const TypeInfo accel_type = {
> - .name = TYPE_ACCEL,
> - .parent = TYPE_OBJECT,
> - .class_size = sizeof(AccelClass),
> - .instance_size = sizeof(AccelState),
> - .abstract = true,
> -};
> -
> -/* Lookup AccelClass from opt_name. Returns NULL if not found */
> -AccelClass *accel_find(const char *opt_name)
> -{
> - char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
> - AccelClass *ac = ACCEL_CLASS(module_object_class_by_name(class_name));
> - g_free(class_name);
> - return ac;
> -}
> -
> -/* Return the name of the current accelerator */
> -const char *current_accel_name(void)
> -{
> - AccelClass *ac = ACCEL_GET_CLASS(current_accel());
> -
> - return ac->name;
> -}
> -
> -static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
> -{
> - CPUClass *cc = CPU_CLASS(klass);
> - AccelCPUClass *accel_cpu = opaque;
> -
> - /*
> - * The first callback allows accel-cpu to run initializations
> - * for the CPU, customizing CPU behavior according to the accelerator.
> - *
> - * The second one allows the CPU to customize the accel-cpu
> - * behavior according to the CPU.
> - *
> - * The second is currently only used by TCG, to specialize the
> - * TCGCPUOps depending on the CPU type.
> - */
> - cc->accel_cpu = accel_cpu;
> - if (accel_cpu->cpu_class_init) {
> - accel_cpu->cpu_class_init(cc);
> - }
> - if (cc->init_accel_cpu) {
> - cc->init_accel_cpu(accel_cpu, cc);
> - }
> -}
> -
> -/* initialize the arch-specific accel CpuClass interfaces */
> -static void accel_init_cpu_interfaces(AccelClass *ac)
> -{
> - const char *ac_name; /* AccelClass name */
> - char *acc_name; /* AccelCPUClass name */
> - ObjectClass *acc; /* AccelCPUClass */
> - const char *cpu_resolving_type = target_cpu_type();
> -
> - ac_name = object_class_get_name(OBJECT_CLASS(ac));
> - g_assert(ac_name != NULL);
> -
> - acc_name = g_strdup_printf("%s-%s", ac_name, cpu_resolving_type);
> - acc = object_class_by_name(acc_name);
> - g_free(acc_name);
> -
> - if (acc) {
> - object_class_foreach(accel_init_cpu_int_aux,
> - cpu_resolving_type, false, acc);
> - }
> -}
> -
> -void accel_init_interfaces(AccelClass *ac)
> -{
> - accel_init_ops_interfaces(ac);
> - accel_init_cpu_interfaces(ac);
> -}
> -
> -void accel_cpu_instance_init(CPUState *cpu)
> -{
> - if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
> - cpu->cc->accel_cpu->cpu_instance_init(cpu);
> - }
> -}
> -
> -bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
> -{
> - AccelState *accel = current_accel();
> - AccelClass *acc = ACCEL_GET_CLASS(accel);
> -
> - /* target specific realization */
> - if (cpu->cc->accel_cpu
> - && cpu->cc->accel_cpu->cpu_target_realize
> - && !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
> - return false;
> - }
> -
> - /* generic realization */
> - if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) {
> - return false;
> - }
> -
> - return true;
> -}
> -
> -void accel_cpu_common_unrealize(CPUState *cpu)
> -{
> - AccelState *accel = current_accel();
> - AccelClass *acc = ACCEL_GET_CLASS(accel);
> -
> - /* generic unrealization */
> - if (acc->cpu_common_unrealize) {
> - acc->cpu_common_unrealize(cpu);
> - }
> -}
> -
> -int accel_supported_gdbstub_sstep_flags(void)
> -{
> - AccelState *accel = current_accel();
> - AccelClass *acc = ACCEL_GET_CLASS(accel);
> - if (acc->gdbstub_supported_sstep_flags) {
> - return acc->gdbstub_supported_sstep_flags();
> - }
> - return 0;
> -}
>
> static const TypeInfo accel_cpu_type = {
> .name = TYPE_ACCEL_CPU,
> @@ -163,7 +35,6 @@ static const TypeInfo accel_cpu_type = {
>
> static void register_accel_types(void)
> {
> - type_register_static(&accel_type);
> type_register_static(&accel_cpu_type);
> }
>
> diff --git a/accel/meson.build b/accel/meson.build
> index 5eaeb683385..52909314bfa 100644
> --- a/accel/meson.build
> +++ b/accel/meson.build
> @@ -1,3 +1,4 @@
> +common_ss.add(files('accel-common.c'))
> specific_ss.add(files('accel-target.c'))
> system_ss.add(files('accel-system.c', 'accel-blocker.c'))
> user_ss.add(files('accel-user.c'))
It seems that only accel_cpu_type is left in accel-target.c after that.
Couldn't we move that to TargetInfo, so the whole accel-target.c file
can become common instead?
If there is something I missed, I'm ok with the current change.
I just feel the last 3 commits, and this one, are a bit disconnected
from the series.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c
2025-04-04 16:59 ` Pierrick Bouvier
@ 2025-04-17 16:42 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-17 16:42 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 18:59, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> accel/accel-common.c | 142 +++++++++++++++++++++++++++++++++++++++++++
>> accel/accel-target.c | 129 ---------------------------------------
>> accel/meson.build | 1 +
>> 3 files changed, 143 insertions(+), 129 deletions(-)
>> create mode 100644 accel/accel-common.c
> It seems that only accel_cpu_type is left in accel-target.c after that.
> Couldn't we move that to TargetInfo, so the whole accel-target.c file
> can become common instead?
IIUC "accel/accel-cpu-target.h" defines the AccelCPUClass QOM
CLASS_CHECKERS macros based on CPU_RESOLVING_TYPE.
> If there is something I missed, I'm ok with the current change.
Thanks.
> I just feel the last 3 commits, and this one, are a bit disconnected
> from the series.
OK, will do.
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 18/19] qemu: Prepare per-binary QOM filter via TYPE_BINARY_PREFIX
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 17/19] accel: Move target-agnostic code from accel-target.c -> accel-common.c Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 17:04 ` Pierrick Bouvier
2025-04-03 23:49 ` [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter() Philippe Mathieu-Daudé
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
meson.build | 1 +
include/hw/boards.h | 1 +
include/qemu/target_info-qom.h | 14 ++++++++++++++
target_info-qom.c | 15 +++++++++++++++
4 files changed, 31 insertions(+)
create mode 100644 include/qemu/target_info-qom.h
create mode 100644 target_info-qom.c
diff --git a/meson.build b/meson.build
index de9c9dacd35..b93253166c8 100644
--- a/meson.build
+++ b/meson.build
@@ -3815,6 +3815,7 @@ specific_ss.add(files('page-target.c', 'page-vary-target.c'))
specific_ss.add(files('target_info-stub.c'))
common_ss.add(files('target_info.c'))
+system_ss.add(files('target_info-qom.c'))
subdir('backends')
subdir('disas')
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 02f43ac5d4d..b1bbf3c34d4 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -7,6 +7,7 @@
#include "system/hostmem.h"
#include "system/blockdev.h"
#include "qapi/qapi-types-machine.h"
+#include "qemu/target_info-qom.h"
#include "qemu/module.h"
#include "qom/object.h"
#include "hw/core/cpu.h"
diff --git a/include/qemu/target_info-qom.h b/include/qemu/target_info-qom.h
new file mode 100644
index 00000000000..c87d47acf66
--- /dev/null
+++ b/include/qemu/target_info-qom.h
@@ -0,0 +1,14 @@
+/*
+ * QEMU binary helpers
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_TARGET_INFO_QOM_H
+#define QEMU_TARGET_INFO_QOM_H
+
+#define TYPE_LEGACY_BINARY_PREFIX "legacy-binary-"
+
+#endif
diff --git a/target_info-qom.c b/target_info-qom.c
new file mode 100644
index 00000000000..6970b95ee0b
--- /dev/null
+++ b/target_info-qom.c
@@ -0,0 +1,15 @@
+/*
+ * QEMU legacy binary helpers
+ *
+ * Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/target_info-qom.h"
+
+static const TypeInfo target_info_types[] = {
+};
+
+DEFINE_TYPES(target_info_types)
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 18/19] qemu: Prepare per-binary QOM filter via TYPE_BINARY_PREFIX
2025-04-03 23:49 ` [RFC PATCH-for-10.1 18/19] qemu: Prepare per-binary QOM filter via TYPE_BINARY_PREFIX Philippe Mathieu-Daudé
@ 2025-04-04 17:04 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 17:04 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> meson.build | 1 +
> include/hw/boards.h | 1 +
> include/qemu/target_info-qom.h | 14 ++++++++++++++
> target_info-qom.c | 15 +++++++++++++++
> 4 files changed, 31 insertions(+)
> create mode 100644 include/qemu/target_info-qom.h
> create mode 100644 target_info-qom.c
>
> diff --git a/meson.build b/meson.build
> index de9c9dacd35..b93253166c8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3815,6 +3815,7 @@ specific_ss.add(files('page-target.c', 'page-vary-target.c'))
>
> specific_ss.add(files('target_info-stub.c'))
> common_ss.add(files('target_info.c'))
> +system_ss.add(files('target_info-qom.c'))
>
> subdir('backends')
> subdir('disas')
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 02f43ac5d4d..b1bbf3c34d4 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -7,6 +7,7 @@
> #include "system/hostmem.h"
> #include "system/blockdev.h"
> #include "qapi/qapi-types-machine.h"
> +#include "qemu/target_info-qom.h"
> #include "qemu/module.h"
> #include "qom/object.h"
> #include "hw/core/cpu.h"
> diff --git a/include/qemu/target_info-qom.h b/include/qemu/target_info-qom.h
> new file mode 100644
> index 00000000000..c87d47acf66
> --- /dev/null
> +++ b/include/qemu/target_info-qom.h
> @@ -0,0 +1,14 @@
> +/*
> + * QEMU binary helpers
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef QEMU_TARGET_INFO_QOM_H
> +#define QEMU_TARGET_INFO_QOM_H
> +
> +#define TYPE_LEGACY_BINARY_PREFIX "legacy-binary-"
> +
How about TYPE_TARGET_PREFIX instead?
It's not related to any legacy stuff, as the new API will be used in the
future (and will stay). As well, I don't think we should mention
"binary" in any name, because what we really talk about are targets
{user|system, architecture}, in the meaning of our build system
(configure --target-list).
So please replace [legacy, binary] with target simply, so we keep a sane
vocabulary in the future.
> +#endif
> diff --git a/target_info-qom.c b/target_info-qom.c
> new file mode 100644
> index 00000000000..6970b95ee0b
> --- /dev/null
> +++ b/target_info-qom.c
> @@ -0,0 +1,15 @@
> +/*
> + * QEMU legacy binary helpers
> + *
> + * Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/target_info-qom.h"
> +
> +static const TypeInfo target_info_types[] = {
> +};
> +
> +DEFINE_TYPES(target_info_types)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter()
2025-04-03 23:48 [RFC PATCH-for-10.1 00/19] qemu: Introduce TargetInfo API (for single binary) Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2025-04-03 23:49 ` [RFC PATCH-for-10.1 18/19] qemu: Prepare per-binary QOM filter via TYPE_BINARY_PREFIX Philippe Mathieu-Daudé
@ 2025-04-03 23:49 ` Philippe Mathieu-Daudé
2025-04-04 17:10 ` Pierrick Bouvier
18 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-03 23:49 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson,
Pierrick Bouvier
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
system/vl.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/system/vl.c b/system/vl.c
index d8a0fe713c9..554f5f2a467 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -27,6 +27,8 @@
#include "qemu/datadir.h"
#include "qemu/units.h"
#include "qemu/module.h"
+#include "qemu/target_info.h"
+#include "qemu/target_info-qom.h"
#include "exec/cpu-common.h"
#include "exec/page-vary.h"
#include "hw/qdev-properties.h"
@@ -833,14 +835,29 @@ static bool usb_parse(const char *cmdline, Error **errp)
/***********************************************************/
/* machine registration */
+static char *machine_binary_filter(void)
+{
+ if (target_info_is_stub()) {
+ return NULL;
+ }
+ return g_strconcat(TYPE_LEGACY_BINARY_PREFIX,
+ "qemu-system-", target_name(), NULL);
+}
+
static MachineClass *find_machine(const char *name, GSList *machines)
{
GSList *el;
+ g_autofree char *binary_filter = machine_binary_filter();
for (el = machines; el; el = el->next) {
MachineClass *mc = el->data;
if (!strcmp(mc->name, name) || !g_strcmp0(mc->alias, name)) {
+ if (binary_filter && !object_class_dynamic_cast(el->data,
+ binary_filter)) {
+ /* Machine is not for this binary: fail */
+ return NULL;
+ }
return mc;
}
}
@@ -1563,6 +1580,7 @@ static void machine_help_func(const QDict *qdict)
g_autoptr(GSList) machines = NULL;
GSList *el;
const char *type = qdict_get_try_str(qdict, "type");
+ g_autofree char *binary_filter = machine_binary_filter();
machines = object_class_get_list(TYPE_MACHINE, false);
if (type) {
@@ -1577,6 +1595,12 @@ static void machine_help_func(const QDict *qdict)
machines = g_slist_sort(machines, machine_class_cmp);
for (el = machines; el; el = el->next) {
MachineClass *mc = el->data;
+
+ if (binary_filter && !object_class_dynamic_cast(el->data,
+ binary_filter)) {
+ /* Machine is not for this binary: skip */
+ continue;
+ }
if (mc->alias) {
printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc, mc->name);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter()
2025-04-03 23:49 ` [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter() Philippe Mathieu-Daudé
@ 2025-04-04 17:10 ` Pierrick Bouvier
2025-04-04 18:01 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 17:10 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> system/vl.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/system/vl.c b/system/vl.c
> index d8a0fe713c9..554f5f2a467 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -27,6 +27,8 @@
> #include "qemu/datadir.h"
> #include "qemu/units.h"
> #include "qemu/module.h"
> +#include "qemu/target_info.h"
> +#include "qemu/target_info-qom.h"
> #include "exec/cpu-common.h"
> #include "exec/page-vary.h"
> #include "hw/qdev-properties.h"
> @@ -833,14 +835,29 @@ static bool usb_parse(const char *cmdline, Error **errp)
> /***********************************************************/
> /* machine registration */
>
> +static char *machine_binary_filter(void)
> +{
> + if (target_info_is_stub()) {
> + return NULL;
> + }
> + return g_strconcat(TYPE_LEGACY_BINARY_PREFIX,
> + "qemu-system-", target_name(), NULL);
No, we should not have such things.
We can make it work with proper QOM types, defined by target, instead of
relying on string construction/compare like this.
> +}
> +
> static MachineClass *find_machine(const char *name, GSList *machines)
> {
> GSList *el;
> + g_autofree char *binary_filter = machine_binary_filter();
>
> for (el = machines; el; el = el->next) {
> MachineClass *mc = el->data;
>
> if (!strcmp(mc->name, name) || !g_strcmp0(mc->alias, name)) {
> + if (binary_filter && !object_class_dynamic_cast(el->data,
> + binary_filter)) {
> + /* Machine is not for this binary: fail */
> + return NULL;
> + }
> return mc;
> }
> }
> @@ -1563,6 +1580,7 @@ static void machine_help_func(const QDict *qdict)
> g_autoptr(GSList) machines = NULL;
> GSList *el;
> const char *type = qdict_get_try_str(qdict, "type");
> + g_autofree char *binary_filter = machine_binary_filter();
>
> machines = object_class_get_list(TYPE_MACHINE, false);
If we define a proper TYPE_TARGET_MACHINE per target, and we add this to
TargetInfo, this can become:
machines = object_class_get_list(target_machine_type(), false);
And we don't need any other string hack to detect what is the correct type.
> if (type) {
> @@ -1577,6 +1595,12 @@ static void machine_help_func(const QDict *qdict)
> machines = g_slist_sort(machines, machine_class_cmp);
> for (el = machines; el; el = el->next) {
> MachineClass *mc = el->data;
> +
> + if (binary_filter && !object_class_dynamic_cast(el->data,
> + binary_filter)) {
> + /* Machine is not for this binary: skip */
> + continue;
> + }
With the approach above, this is not needed anymore.
> if (mc->alias) {
> printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc, mc->name);
> }
I think we are missing a commit here, defining a proper
TYPE_TARGET_MACHINE_PREFIX, that is target dependent, instead of the
TYPE_LEGACY_BINARY_PREFIX.
And we should include in this type in TargetInfo, the same way it was
done for cpus.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter()
2025-04-04 17:10 ` Pierrick Bouvier
@ 2025-04-04 18:01 ` Philippe Mathieu-Daudé
2025-04-04 18:08 ` Pierrick Bouvier
0 siblings, 1 reply; 51+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-04-04 18:01 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
Hi Pierrick,
On 4/4/25 19:10, Pierrick Bouvier wrote:
> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> system/vl.c | 24 ++++++++++++++++++++++++
>> 1 file changed, 24 insertions(+)
>>
>> diff --git a/system/vl.c b/system/vl.c
>> index d8a0fe713c9..554f5f2a467 100644
>> --- a/system/vl.c
>> +++ b/system/vl.c
>> @@ -27,6 +27,8 @@
>> #include "qemu/datadir.h"
>> #include "qemu/units.h"
>> #include "qemu/module.h"
>> +#include "qemu/target_info.h"
>> +#include "qemu/target_info-qom.h"
>> #include "exec/cpu-common.h"
>> #include "exec/page-vary.h"
>> #include "hw/qdev-properties.h"
>> @@ -833,14 +835,29 @@ static bool usb_parse(const char *cmdline, Error
>> **errp)
>> /***********************************************************/
>> /* machine registration */
>> +static char *machine_binary_filter(void)
>> +{
>> + if (target_info_is_stub()) {
>> + return NULL;
>> + }
>> + return g_strconcat(TYPE_LEGACY_BINARY_PREFIX,
>> + "qemu-system-", target_name(), NULL);
>
> No, we should not have such things.
> We can make it work with proper QOM types, defined by target, instead of
> relying on string construction/compare like this.
I am not understanding you, do you mind sharing code snippets of what
you have in mind?
>
>> +}
>> +
>> static MachineClass *find_machine(const char *name, GSList *machines)
>> {
>> GSList *el;
>> + g_autofree char *binary_filter = machine_binary_filter();
>> for (el = machines; el; el = el->next) {
>> MachineClass *mc = el->data;
>> if (!strcmp(mc->name, name) || !g_strcmp0(mc->alias, name)) {
>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>> +
>> binary_filter)) {
>> + /* Machine is not for this binary: fail */
>> + return NULL;
>> + }
>> return mc;
>> }
>> }
>> @@ -1563,6 +1580,7 @@ static void machine_help_func(const QDict *qdict)
>> g_autoptr(GSList) machines = NULL;
>> GSList *el;
>> const char *type = qdict_get_try_str(qdict, "type");
>> + g_autofree char *binary_filter = machine_binary_filter();
>> machines = object_class_get_list(TYPE_MACHINE, false);
>
> If we define a proper TYPE_TARGET_MACHINE per target, and we add this to
> TargetInfo, this can become:
>
> machines = object_class_get_list(target_machine_type(), false);
>
> And we don't need any other string hack to detect what is the correct type.
>
>> if (type) {
>> @@ -1577,6 +1595,12 @@ static void machine_help_func(const QDict *qdict)
>> machines = g_slist_sort(machines, machine_class_cmp);
>> for (el = machines; el; el = el->next) {
>> MachineClass *mc = el->data;
>> +
>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>> +
>> binary_filter)) {
>> + /* Machine is not for this binary: skip */
>> + continue;
>> + }
>
> With the approach above, this is not needed anymore.
>
>> if (mc->alias) {
>> printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc,
>> mc->name);
>> }
>
> I think we are missing a commit here, defining a proper
> TYPE_TARGET_MACHINE_PREFIX, that is target dependent, instead of the
> TYPE_LEGACY_BINARY_PREFIX.
>
> And we should include in this type in TargetInfo, the same way it was
> done for cpus.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter()
2025-04-04 18:01 ` Philippe Mathieu-Daudé
@ 2025-04-04 18:08 ` Pierrick Bouvier
2025-04-04 18:11 ` Pierrick Bouvier
0 siblings, 1 reply; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 18:08 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 11:01, Philippe Mathieu-Daudé wrote:
> Hi Pierrick,
>
> On 4/4/25 19:10, Pierrick Bouvier wrote:
>> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>> system/vl.c | 24 ++++++++++++++++++++++++
>>> 1 file changed, 24 insertions(+)
>>>
>>> diff --git a/system/vl.c b/system/vl.c
>>> index d8a0fe713c9..554f5f2a467 100644
>>> --- a/system/vl.c
>>> +++ b/system/vl.c
>>> @@ -27,6 +27,8 @@
>>> #include "qemu/datadir.h"
>>> #include "qemu/units.h"
>>> #include "qemu/module.h"
>>> +#include "qemu/target_info.h"
>>> +#include "qemu/target_info-qom.h"
>>> #include "exec/cpu-common.h"
>>> #include "exec/page-vary.h"
>>> #include "hw/qdev-properties.h"
>>> @@ -833,14 +835,29 @@ static bool usb_parse(const char *cmdline, Error
>>> **errp)
>>> /***********************************************************/
>>> /* machine registration */
>>> +static char *machine_binary_filter(void)
>>> +{
>>> + if (target_info_is_stub()) {
>>> + return NULL;
>>> + }
>>> + return g_strconcat(TYPE_LEGACY_BINARY_PREFIX,
>>> + "qemu-system-", target_name(), NULL);
>>
>> No, we should not have such things.
>> We can make it work with proper QOM types, defined by target, instead of
>> relying on string construction/compare like this.
>
> I am not understanding you, do you mind sharing code snippets of what
> you have in mind?
>
Instead of the current and previous patch,
we define TYPE_TARGET_MACHINE_PREFIX.
For each target, we define a specific TYPE_TARGET_MACHINE variant, like:
- TYPE_TARGET_MACHINE_ARM
- TYPE_TARGET_MACHINE_AARCH64
...
In TargetInfo, we add a new function target_machine_type(), that returns
this type, specialized for each architecture.
As a first step, the stub implementation can return TYPE_MACHINE, and we
can enable this architecture per architecture later.
For the first architecture implementation, arm, we will define
TYPE_TARGET_MACHINE_ARM, and TYPE_TARGET_MACHINE_AARCH64, which will
allow concerned files to be common, while still maintaining a specific
set of machines per target.
Is that more clear?
>>
>>> +}
>>> +
>>> static MachineClass *find_machine(const char *name, GSList *machines)
>>> {
>>> GSList *el;
>>> + g_autofree char *binary_filter = machine_binary_filter();
>>> for (el = machines; el; el = el->next) {
>>> MachineClass *mc = el->data;
>>> if (!strcmp(mc->name, name) || !g_strcmp0(mc->alias, name)) {
>>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>>> +
>>> binary_filter)) {
>>> + /* Machine is not for this binary: fail */
>>> + return NULL;
>>> + }
>>> return mc;
>>> }
>>> }
>>> @@ -1563,6 +1580,7 @@ static void machine_help_func(const QDict *qdict)
>>> g_autoptr(GSList) machines = NULL;
>>> GSList *el;
>>> const char *type = qdict_get_try_str(qdict, "type");
>>> + g_autofree char *binary_filter = machine_binary_filter();
>>> machines = object_class_get_list(TYPE_MACHINE, false);
>>
>> If we define a proper TYPE_TARGET_MACHINE per target, and we add this to
>> TargetInfo, this can become:
>>
>> machines = object_class_get_list(target_machine_type(), false);
>>
>> And we don't need any other string hack to detect what is the correct type.
>>
>>> if (type) {
>>> @@ -1577,6 +1595,12 @@ static void machine_help_func(const QDict *qdict)
>>> machines = g_slist_sort(machines, machine_class_cmp);
>>> for (el = machines; el; el = el->next) {
>>> MachineClass *mc = el->data;
>>> +
>>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>>> +
>>> binary_filter)) {
>>> + /* Machine is not for this binary: skip */
>>> + continue;
>>> + }
>>
>> With the approach above, this is not needed anymore.
>>
>>> if (mc->alias) {
>>> printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc,
>>> mc->name);
>>> }
>>
>> I think we are missing a commit here, defining a proper
>> TYPE_TARGET_MACHINE_PREFIX, that is target dependent, instead of the
>> TYPE_LEGACY_BINARY_PREFIX.
>>
>> And we should include in this type in TargetInfo, the same way it was
>> done for cpus.
>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [RFC PATCH-for-10.1 19/19] system/vl: Filter machine list for binary using machine_binary_filter()
2025-04-04 18:08 ` Pierrick Bouvier
@ 2025-04-04 18:11 ` Pierrick Bouvier
0 siblings, 0 replies; 51+ messages in thread
From: Pierrick Bouvier @ 2025-04-04 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Markus Armbruster, Richard Henderson
On 4/4/25 11:08, Pierrick Bouvier wrote:
> On 4/4/25 11:01, Philippe Mathieu-Daudé wrote:
>> Hi Pierrick,
>>
>> On 4/4/25 19:10, Pierrick Bouvier wrote:
>>> On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>> ---
>>>> system/vl.c | 24 ++++++++++++++++++++++++
>>>> 1 file changed, 24 insertions(+)
>>>>
>>>> diff --git a/system/vl.c b/system/vl.c
>>>> index d8a0fe713c9..554f5f2a467 100644
>>>> --- a/system/vl.c
>>>> +++ b/system/vl.c
>>>> @@ -27,6 +27,8 @@
>>>> #include "qemu/datadir.h"
>>>> #include "qemu/units.h"
>>>> #include "qemu/module.h"
>>>> +#include "qemu/target_info.h"
>>>> +#include "qemu/target_info-qom.h"
>>>> #include "exec/cpu-common.h"
>>>> #include "exec/page-vary.h"
>>>> #include "hw/qdev-properties.h"
>>>> @@ -833,14 +835,29 @@ static bool usb_parse(const char *cmdline, Error
>>>> **errp)
>>>> /***********************************************************/
>>>> /* machine registration */
>>>> +static char *machine_binary_filter(void)
>>>> +{
>>>> + if (target_info_is_stub()) {
>>>> + return NULL;
>>>> + }
>>>> + return g_strconcat(TYPE_LEGACY_BINARY_PREFIX,
>>>> + "qemu-system-", target_name(), NULL);
>>>
>>> No, we should not have such things.
>>> We can make it work with proper QOM types, defined by target, instead of
>>> relying on string construction/compare like this.
>>
>> I am not understanding you, do you mind sharing code snippets of what
>> you have in mind?
>>
>
> Instead of the current and previous patch,
>
> we define TYPE_TARGET_MACHINE_PREFIX.
>
> For each target, we define a specific TYPE_TARGET_MACHINE variant, like:
> - TYPE_TARGET_MACHINE_ARM
> - TYPE_TARGET_MACHINE_AARCH64
> ...
>
> In TargetInfo, we add a new function target_machine_type(), that returns
> this type, specialized for each architecture.
> As a first step, the stub implementation can return TYPE_MACHINE, and we
> can enable this architecture per architecture later.
>
> For the first architecture implementation, arm, we will define
> TYPE_TARGET_MACHINE_ARM, and TYPE_TARGET_MACHINE_AARCH64, which will
> allow concerned files to be common, while still maintaining a specific
> set of machines per target.
>
Note: Those TYPE_TARGET_MACHINE_* types are QOM interfaces, that every
concerned machine implements.
Once things are done this way, the only required change is:
- machines = object_class_get_list(TYPE_MACHINE, false);
+ machines = object_class_get_list(target_machine_type(), false);
As a further step, it will be very easy to support having multiple
targets enabled at the same time (build a list of machine types instead
of a single one), but we can do this *later* when tackling heterogeneous
emulation.
> Is that more clear?
>
>>>
>>>> +}
>>>> +
>>>> static MachineClass *find_machine(const char *name, GSList *machines)
>>>> {
>>>> GSList *el;
>>>> + g_autofree char *binary_filter = machine_binary_filter();
>>>> for (el = machines; el; el = el->next) {
>>>> MachineClass *mc = el->data;
>>>> if (!strcmp(mc->name, name) || !g_strcmp0(mc->alias, name)) {
>>>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>>>> +
>>>> binary_filter)) {
>>>> + /* Machine is not for this binary: fail */
>>>> + return NULL;
>>>> + }
>>>> return mc;
>>>> }
>>>> }
>>>> @@ -1563,6 +1580,7 @@ static void machine_help_func(const QDict *qdict)
>>>> g_autoptr(GSList) machines = NULL;
>>>> GSList *el;
>>>> const char *type = qdict_get_try_str(qdict, "type");
>>>> + g_autofree char *binary_filter = machine_binary_filter();
>>>> machines = object_class_get_list(TYPE_MACHINE, false);
>>>
>>> If we define a proper TYPE_TARGET_MACHINE per target, and we add this to
>>> TargetInfo, this can become:
>>>
>>> machines = object_class_get_list(target_machine_type(), false);
>>>
>>> And we don't need any other string hack to detect what is the correct type.
>>>
>>>> if (type) {
>>>> @@ -1577,6 +1595,12 @@ static void machine_help_func(const QDict *qdict)
>>>> machines = g_slist_sort(machines, machine_class_cmp);
>>>> for (el = machines; el; el = el->next) {
>>>> MachineClass *mc = el->data;
>>>> +
>>>> + if (binary_filter && !object_class_dynamic_cast(el->data,
>>>> +
>>>> binary_filter)) {
>>>> + /* Machine is not for this binary: skip */
>>>> + continue;
>>>> + }
>>>
>>> With the approach above, this is not needed anymore.
>>>
>>>> if (mc->alias) {
>>>> printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc,
>>>> mc->name);
>>>> }
>>>
>>> I think we are missing a commit here, defining a proper
>>> TYPE_TARGET_MACHINE_PREFIX, that is target dependent, instead of the
>>> TYPE_LEGACY_BINARY_PREFIX.
>>>
>>> And we should include in this type in TargetInfo, the same way it was
>>> done for cpus.
>>
>
^ permalink raw reply [flat|nested] 51+ messages in thread