Message ID | 20210524114132.572659-1-clg@kaod.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | spapr: propagate LPCR to hot-plugged CPUs | expand |
On Mon, 24 May 2021 13:41:32 +0200 Cédric Le Goater <clg@kaod.org> wrote: > Distros have started using the 'scv' instructions (glibc 2.33) which > relies on the LPCR AIL bits. Unfortunately, the LPCR of hot-plugged > CPUs is not synchronized with the rest of machine and it breaks the > guest OS. > > Fix that by using the first CPU to set the LPCR value of all hot-plugged > CPUs. > > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- LGTM Reviewed-by: Greg Kurz <groug@kaod.org> > hw/ppc/spapr.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index c23bcc449071..e463c2570c7a 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -3890,6 +3890,8 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev) > for (i = 0; i < cc->nr_threads; i++) { > ppc_set_compat(core->threads[i], POWERPC_CPU(first_cpu)->compat_pvr, > &error_abort); > + ppc_store_lpcr(core->threads[i], > + POWERPC_CPU(first_cpu)->env.spr[SPR_LPCR]); > } > } >
On Mon, May 24, 2021 at 01:41:32PM +0200, Cédric Le Goater wrote: > Distros have started using the 'scv' instructions (glibc 2.33) which > relies on the LPCR AIL bits. Unfortunately, the LPCR of hot-plugged > CPUs is not synchronized with the rest of machine and it breaks the > guest OS. > > Fix that by using the first CPU to set the LPCR value of all hot-plugged > CPUs. > > Signed-off-by: Cédric Le Goater <clg@kaod.org> I'm assuming this is obsoleted by Nick Piggin's rework of LPCR initialization. This patch does fix a real bug, but it leaves LPCR initialization a bit of a mess. > --- > hw/ppc/spapr.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index c23bcc449071..e463c2570c7a 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -3890,6 +3890,8 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev) > for (i = 0; i < cc->nr_threads; i++) { > ppc_set_compat(core->threads[i], POWERPC_CPU(first_cpu)->compat_pvr, > &error_abort); > + ppc_store_lpcr(core->threads[i], > + POWERPC_CPU(first_cpu)->env.spr[SPR_LPCR]); > } > } >
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c23bcc449071..e463c2570c7a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3890,6 +3890,8 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev) for (i = 0; i < cc->nr_threads; i++) { ppc_set_compat(core->threads[i], POWERPC_CPU(first_cpu)->compat_pvr, &error_abort); + ppc_store_lpcr(core->threads[i], + POWERPC_CPU(first_cpu)->env.spr[SPR_LPCR]); } }
Distros have started using the 'scv' instructions (glibc 2.33) which relies on the LPCR AIL bits. Unfortunately, the LPCR of hot-plugged CPUs is not synchronized with the rest of machine and it breaks the guest OS. Fix that by using the first CPU to set the LPCR value of all hot-plugged CPUs. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/ppc/spapr.c | 2 ++ 1 file changed, 2 insertions(+)