On 4/22/25 07:54, Philippe Mathieu-Daudé wrote:
Binaries can register a QOM type to filter their machines
by filling their TargetInfo::machine_typename field.

This can be used by example by main() -> machine_help_func()
to filter the machines list.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
---
  meson.build                     |  1 +
  include/qemu/target-info-impl.h |  3 +++
  include/qemu/target-info.h      |  8 ++++++++
  system/vl.c                     |  3 ++-
  target-info-qom.c               | 15 +++++++++++++++
  target-info-stub.c              |  2 ++
  target-info.c                   |  5 +++++
  7 files changed, 36 insertions(+), 1 deletion(-)
  create mode 100644 target-info-qom.c

diff --git a/meson.build b/meson.build
index 09b16e2f7ae..a1109b6db3f 100644
--- a/meson.build
+++ b/meson.build
@@ -3808,6 +3808,7 @@ common_ss.add(pagevary)
  specific_ss.add(files('page-target.c', 'page-vary-target.c'))
common_ss.add(files('target-info.c'))
+system_ss.add(files('target-info-qom.c'))
  specific_ss.add(files('target-info-stub.c'))
subdir('backends')
diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-impl.h
index c276b84ceca..4ef54c5136a 100644
--- a/include/qemu/target-info-impl.h
+++ b/include/qemu/target-info-impl.h
@@ -16,6 +16,9 @@ typedef struct TargetInfo {
      /* runtime equivalent of TARGET_NAME definition */
      const char *const target_name;
+ /* QOM typename machines for this binary must implement */
+    const char *const machine_typename;
+
  } TargetInfo;

You don't really want the second 'const' in either of these.

diff --git a/target-info-qom.c b/target-info-qom.c
new file mode 100644
index 00000000000..a6fd8f1d5a3
--- /dev/null
+++ b/target-info-qom.c
@@ -0,0 +1,15 @@
+/*
+ * QEMU binary/target API (QOM types)
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qom/object.h"
+
+static const TypeInfo target_info_types[] = {
+};
+
+DEFINE_TYPES(target_info_types)

Delay this until it's actually used.

Otherwise,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>

r~

Reply via email to