Message ID | 20220301215958.157011-19-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | target/arm: Implement LVA, LPA, LPA2 features | expand |
On Tue, 1 Mar 2022 at 22:00, Richard Henderson <richard.henderson@linaro.org> wrote: > > There is a Linux kernel bug present until v5.12 that prevents > booting with FEAT_LPA2 enabled. As a workaround for TCG, > disable this feature for machine versions prior to 7.0. > > Cc: Daniel P. Berrangé <berrange@redhat.com> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/hw/arm/virt.h | 1 + > hw/arm/virt.c | 7 +++++++ > 2 files changed, 8 insertions(+) Is it not possible to implement this in the usual "change property for older versioned machines" way of adding to the hw_compat arrays? diff --git a/hw/core/machine.c b/hw/core/machine.c index d856485cb4d..dac82a709ba 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -37,7 +37,9 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-pci.h" -GlobalProperty hw_compat_6_2[] = {}; +GlobalProperty hw_compat_6_2[] = { + { "arm-cpu-max", "lpa2", "false" }, +}; const size_t hw_compat_6_2_len = G_N_ELEMENTS(hw_compat_6_2); GlobalProperty hw_compat_6_1[] = { thanks -- PMM
On 3/4/22 01:52, Peter Maydell wrote: > Is it not possible to implement this in the usual "change > property for older versioned machines" way of adding to > the hw_compat arrays? > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index d856485cb4d..dac82a709ba 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -37,7 +37,9 @@ > #include "hw/virtio/virtio.h" > #include "hw/virtio/virtio-pci.h" > > -GlobalProperty hw_compat_6_2[] = {}; > +GlobalProperty hw_compat_6_2[] = { > + { "arm-cpu-max", "lpa2", "false" }, > +}; > const size_t hw_compat_6_2_len = G_N_ELEMENTS(hw_compat_6_2); Hmm, I didn't try that, just mirrored the other examples within hw/arm/virt.c. I guess the real type name would be TYPE_ARM_MAX_CPU, or "max-arm-cpu". ... Yes, that works. I'll send an update. r~
On Fri, 4 Mar 2022 at 19:52, Richard Henderson <richard.henderson@linaro.org> wrote: > > On 3/4/22 01:52, Peter Maydell wrote: > > Is it not possible to implement this in the usual "change > > property for older versioned machines" way of adding to > > the hw_compat arrays? > > > > diff --git a/hw/core/machine.c b/hw/core/machine.c > > index d856485cb4d..dac82a709ba 100644 > > --- a/hw/core/machine.c > > +++ b/hw/core/machine.c > > @@ -37,7 +37,9 @@ > > #include "hw/virtio/virtio.h" > > #include "hw/virtio/virtio-pci.h" > > > > -GlobalProperty hw_compat_6_2[] = {}; > > +GlobalProperty hw_compat_6_2[] = { > > + { "arm-cpu-max", "lpa2", "false" }, > > +}; > > const size_t hw_compat_6_2_len = G_N_ELEMENTS(hw_compat_6_2); > > Hmm, I didn't try that, just mirrored the other examples within hw/arm/virt.c. > I guess the real type name would be TYPE_ARM_MAX_CPU, or "max-arm-cpu". > > ... > > Yes, that works. I'll send an update. Do check it with KVM as well, to check the "CPU doesn't actually have that property" case... -- PMM
On 3/4/22 12:14, Peter Maydell wrote: >> Yes, that works. I'll send an update. > > Do check it with KVM as well, to check the "CPU doesn't actually > have that property" case... Argh! No, doesn't work. Unexpected error in object_property_find_err() at ../src/qom/object.c:1299: qemu-system-aarch64: can't apply global max-arm-cpu.lpa2=off: Property 'max-arm-cpu.lpa2' not found I think staying with the v4 patch is best. It matches quite a few other examples in hw/arm, and uses the existence of the property as part of the logic already. r~
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index c1ea17d0de..7e76ee2619 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -132,6 +132,7 @@ struct VirtMachineClass { bool no_secure_gpio; /* Machines < 6.2 have no support for describing cpu topology to guest */ bool no_cpu_topology; + bool no_tcg_lpa2; }; struct VirtMachineState { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 46bf7ceddf..46a42502bc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2102,6 +2102,10 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, "pmu", false, NULL); } + if (vmc->no_tcg_lpa2 && object_property_find(cpuobj, "lpa2")) { + object_property_set_bool(cpuobj, "lpa2", false, NULL); + } + if (object_property_find(cpuobj, "reset-cbar")) { object_property_set_int(cpuobj, "reset-cbar", vms->memmap[VIRT_CPUPERIPHS].base, @@ -3020,8 +3024,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 0) static void virt_machine_6_2_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_7_0_options(mc); compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); + vmc->no_tcg_lpa2 = true; } DEFINE_VIRT_MACHINE(6, 2)
There is a Linux kernel bug present until v5.12 that prevents booting with FEAT_LPA2 enabled. As a workaround for TCG, disable this feature for machine versions prior to 7.0. Cc: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 7 +++++++ 2 files changed, 8 insertions(+)