spapr: Set LPCR to current AIL mode when starting a new CPU
commitac559ecbea2649819e7b3fdd09f4e0243e0128db
authorNicholas Piggin <npiggin@gmail.com>
Wed, 26 May 2021 09:16:25 +0000 (26 19:16 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 3 Jun 2021 03:22:06 +0000 (3 13:22 +1000)
tree1998e6cca0b92e1d47ca924bb09ab468a024ed8d
parent7be3bf6c8429969f97728bb712d9a99997835607
spapr: Set LPCR to current AIL mode when starting a new CPU

TCG does not keep track of AIL mode in a central place, it's based on
the current LPCR[AIL] bits. Synchronize the new CPU's LPCR to the
current LPCR in rtas_start_cpu(), similarly to the way the ILE bit is
synchronized.

Open-code the ILE setting as well now that the caller's LPCR is
available directly, there is no need for the indirection.

Without this, under both TCG and KVM, adding a POWER8/9/10 class CPU
with a new core ID after a modern Linux has booted results in the new
CPU's LPCR missing the LPCR[AIL]=0b11 setting that the other CPUs have.
This can cause crashes and unexpected behaviour.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20210526091626.3388262-3-npiggin@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_rtas.c