On 7/23/2026 11:21 PM, Philippe Mathieu-Daudé wrote:
> On 24/7/26 02:09, Pierrick Bouvier wrote:
>> In the next commits, We'll replace the logic to filter QOM types per
>> target from a static one (based on INTERFACES) to a runtime one, based
>> on is_available() function, that can be overriden per class.
>>
>> Introduce the new interface we'll use for that.
>>
>> Signed-off-by: Pierrick Bouvier <[email protected]>
>> ---
>>   include/qemu/target-info-qom.h | 15 +++++++++++++++
>>   target-info-qom.c              |  5 +++++
>>   2 files changed, 20 insertions(+)
>>
>> diff --git a/include/qemu/target-info-qom.h b/include/qemu/target-
>> info-qom.h
>> index 91be415ed33..83eb537333b 100644
>> --- a/include/qemu/target-info-qom.h
>> +++ b/include/qemu/target-info-qom.h
>> @@ -14,6 +14,21 @@
>>     #define TYPE_TARGET_INFO "target-info"
>>   +#define TYPE_TARGET_SPECIFIC "target-specific"
>> +
>> +typedef struct TargetSpecific TargetSpecific;
>> +
>> +typedef struct TargetSpecificClass {
>> +    InterfaceClass parent_class;
>> +
>> +    bool (*is_available)(void);
> 
> Hopefully we won't have to call this with heterogeneous machines.
> Otherwise we might have to add another helper:
> 
>        bool (*is_available_ti)(const TargetInfo *ti);
>

It should not be needed, since meson build system filter files for which
CONFIG_X or target is not enabled, so they are excluded from the binary.
The case we deal with here is having two targets with two different
CONFIG_* sets, which makes additional types present at runtime for one
of those target.

>> +} TargetSpecificClass;
>> +
>> +#define TARGET_SPECIFIC(obj) \
>> +    INTERFACE_CHECK(TargetSpecific, (obj), TYPE_TARGET_SPECIFIC)
>> +DECLARE_CLASS_CHECKERS(TargetSpecificClass, TARGET_SPECIFIC,
>> +                       TYPE_TARGET_SPECIFIC)
>> +
>>   typedef struct TargetInfoQom {
>>       Object parent_obj;
>>   } TargetInfoQom;
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
> 


Reply via email to