On 8/21/2026 4:51 PM, Pierrick Bouvier wrote:
> Now that we can link a single-binary with at least two targets (arm, aarch64),
> we want to make sure that we expose the same set of machines (later devices 
> and
> cpus) than target binaries. For that, we implemented a static filtering based 
> on
> target interfaces that each machine will implement to declare which targets 
> have
> this machine.
> 
> However, we discovered that this static filtering is not enough. Indeed, some
> machines and devices do not depend only on target, and their presence can 
> depend
> on Kconfig or host/target combination. Thus, our static approach can't work, 
> and
> we need something more flexible.
> 
> In v1:
> This series adds a new TYPE_TARGET_SPECIFIC, that declare a single function
> bool is_available(void). From there, any machine type (and later devices and
> cpus) can implement it to override their presence for each target.
> We first replace the existing static mechanism with this, and once done, we
> cleanup all the old interface. One nice benefit is that we can get rid of
> config/targets/*.c files, which saves duplication.
> In v2:
> Suggested by Daniel, we share a list of requirement for type to be available,
> for future introspection needs.
> 
> This series was tested by comparing list of machines for all qemu system
> binaries, before and after this change, to make sure we don't introduce a
> regression.
> 
> v2
> --
> 
> Changed the design to use a list of requirements instead of a callback.
> Implement it on one machine to show usage and get feedback before going 
> further.
> 
> Pierrick Bouvier (2):
>   qom/object: add available_if field to TypeInfo
>   remote/machine: add available_if for x-remote machine type
> 
>  hw/remote/machine.c        |  3 ++-
>  include/qemu/target-info.h | 11 +++++++++++
>  include/qom/object.h       |  5 +++++
>  qom/object.c               | 10 ++++++++++
>  rust/qom/src/qom.rs        |  1 +
>  stubs/meson.build          |  1 +
>  stubs/target-info.c        | 11 +++++++++++
>  target-info.c              | 13 +++++++++++++
>  8 files changed, 54 insertions(+), 1 deletion(-)
>  create mode 100644 stubs/target-info.c
> 

Sent v3, using a callback in TypeInfo, as suggested by Richard.

https://lore.kernel.org/qemu-devel/[email protected]/T/#t

Regards,
Pierrick

Reply via email to