On 11/6/2026 11:04 AM, Yonggang Luo wrote:
> On Sat, Nov 7, 2026 at 1:54 AM Pierrick Bouvier
> <[email protected]> wrote:
>>
>> On windows x64 host:
>> $ ./build/tests/unit/test-multi-target
>> Type 'whpx-accel-x86_64-cpu' is missing its parent 'accel-x86_64-cpu'
>> (same for windows-arm64 hosts and whpx-accel-aarch64-cpu)
>>
>> Parent type is conditionally registered from current target:
>> register_accel_target_type uses '"accel-" + target_cpu_type()' as type
>> name. Since whpx-common.c is shared between arm and x86_64 targets,
>> only register whpx accelerator cpu type when current target cpu type
>> matches the one it was compiled for.
>>
>> Reviewed-by: Mohamed Mediouni <[email protected]>
>> Signed-off-by: Pierrick Bouvier <[email protected]>
>> ---
>>  accel/whpx/whpx-common.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c
>> index 78d2827809b..20c684638b0 100644
>> --- a/accel/whpx/whpx-common.c
>> +++ b/accel/whpx/whpx-common.c
>> @@ -20,6 +20,7 @@
>>  #include "hw/core/boards.h"
>>  #include "hw/intc/ioapic.h"
>>  #include "qemu/error-report.h"
>> +#include "qemu/target-info.h"
>>  #include "qapi/error.h"
>>  #include "qapi/qapi-types-common.h"
>>  #include "qapi/qapi-type-infos-common.h"
>> @@ -492,11 +493,18 @@ static void whpx_cpu_accel_class_init(ObjectClass *oc, 
>> const void *data)
>>      acc->cpu_instance_init = whpx_cpu_instance_init;
>>  }
>>
>> +/* TYPE_ACCEL_CPU is only registered for current target cpu type */
>> +static bool whpx_cpu_accel_is_available(void)
>> +{
>> +    return !strcmp(target_cpu_type(), CPU_RESOLVING_TYPE);
>> +}
>> +
>>  static const TypeInfo whpx_cpu_accel_type = {
>>      .name = ACCEL_CPU_NAME("whpx"),
>>
>>      .parent = TYPE_ACCEL_CPU,
>>      .class_init = whpx_cpu_accel_class_init,
>> +    .is_available = whpx_cpu_accel_is_available,
>>      .abstract = true,
>>  };
>>
>> --
>> 2.43.0
>>
>>
> 
> Hi, I think
> 
> [PATCH v5 0/3] Register accel-$cpu_type for all targets
> https://lore.kernel.org/qemu-devel/[email protected]/
> 
> should also handled this. so this is_available do not need anymore.
> 

I would prefer to send the accel series later, giving time for
additional reviews, if anyone has an objection.

the whpx fix is needed now as the test fails on windows at the moment.
the patch can be removed after, no problem.

Regards,
Pierrick

Reply via email to