On 11/12/2026 5:30 AM, Daniel P. Berrangé wrote:
> This can be used to declare a type as being target specific.
>
> Implementing the interface just records the target metadata,
> applying the enforcement requires the object creation path to
> call 'target_specific_class_check()' to validate the system
> state.
>
> This approach is intended to allow classes to be unconditionally
> registered, which allows introspection at any time. The target
> specific enforcement is applied at runtime in the object
> creation codepaths that need to apply restrictions. This implies
> that QOM class names must be globally unique across all targets
> known to QEMU.
>
> Signed-off-by: Daniel P. Berrangé <[email protected]>
...
> +/**
> + * TargetSpecificClass:
> + * @parent_class: the base class
> + *
> + * Interface for classes that want to declare they have target
> + * specific restrictions. This is intended to allow classes to
> + * be registered and introspected unconditionally, while
> + * preventing creation of instances unless a compatible target
> + * is selected.
> + */
> +struct TargetSpecificClass {
> + InterfaceClass parent_class;
> +
> + /*
> + * Leave as 0 to indicate no target specific creation restrictions,
> + * or set to a bitmask of QEMU_ARCH_nnn constants to limit what
> + * targets it can be created under.
> + */
> + int targets;
Should be uint64_t, as it was recently increased in
include/qemu/base-arch-defs.h. We don't yet have any value hitting the
upper 32 bits, but we should be consistent.
...
Regards,
Pierrick