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]> Link: https://lore.kernel.org/qemu-devel/[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.47.3
