KVM: arm: Don't write junk to CP15 registers on reset
authorMarc Zyngier <maz@kernel.org>
Mon, 5 Aug 2019 09:34:51 +0000 (10:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:28:48 +0000 (08:28 +0200)
commitef61b79017ff626f1ab75afcc37bf1a629449ed1
treed8b53b9061e90b40bdfa5fb1c21fcc5ca0a2172e
parentd5cb5b493030a7856906e4efd6b9d695ec8eeea5
KVM: arm: Don't write junk to CP15 registers on reset

[ Upstream commit c69509c70aa45a8c4954c88c629a64acf4ee4a36 ]

At the moment, the way we reset CP15 registers is mildly insane:
We write junk to them, call the reset functions, and then check that
we have something else in them.

The "fun" thing is that this can happen while the guest is running
(PSCI, for example). If anything in KVM has to evaluate the state
of a CP15 register while junk is in there, bad thing may happen.

Let's stop doing that. Instead, we track that we have called a
reset function for that register, and assume that the reset
function has done something.

In the end, the very need of this reset check is pretty dubious,
as it doesn't check everything (a lot of the CP15 reg leave outside
of the cp15_regs[] array). It may well be axed in the near future.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/kvm/coproc.c