Add a compat variable "no_cpu_topology" used to determine if a machine type has enabled support of generating cpu topology description for the guest. Also, for compatibility we disable this support on older machine types.
On existing older machine types, without cpu topology description in ACPI or DT, the guest will populate a cpu topology by default. With the topology description exposed to the guest, it will read the information and set up its topology as instructed, but that may not be the same as what was getting used by default without the topology description. It's possible that a user application has a dependency on the default topology and if the default one gets changed under its feat it will behave differently. So in summary, we only enable support of this feature on the latest machine type and disable it on the older ones (< 6.1) to avoid possible problems. Co-developed-by: Andrew Jones <drjo...@redhat.com> Signed-off-by: Andrew Jones <drjo...@redhat.com> Signed-off-by: Yanan Wang <wangyana...@huawei.com> --- hw/arm/virt.c | 5 +++++ include/hw/arm/virt.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0a78532018..c07841e3a4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2761,6 +2761,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 1) static void virt_machine_6_0_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + + virt_machine_6_1_options(mc); + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); + vmc->no_cpu_topology = true; } DEFINE_VIRT_MACHINE(6, 0) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 921416f918..f546dd2023 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -129,6 +129,8 @@ struct VirtMachineClass { bool no_kvm_steal_time; bool acpi_expose_flash; bool no_secure_gpio; + /* Machines < 6.1 has no support of cpu topology description for guest */ + bool no_cpu_topology; }; struct VirtMachineState { -- 2.19.1