KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation
authorMichael Neuling <mikey@neuling.org>
Thu, 20 Jun 2019 06:00:40 +0000 (16:00 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Sep 2019 06:22:19 +0000 (08:22 +0200)
commit3a1b79ade460080cc7dd45e08ddac7312b91129d
tree63fe44be522a52b7ec73712b73757a98ed5ac546
parent3ac718069f7c542cbf4b133c1026db93dc2bc09a
KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation

[ Upstream commit 3fefd1cd95df04da67c83c1cb93b663f04b3324f ]

When emulating tsr, treclaim and trechkpt, we incorrectly set CR0. The
code currently sets:
    CR0 <- 00 || MSR[TS]
but according to the ISA it should be:
    CR0 <-  0 || MSR[TS] || 0

This fixes the bit shift to put the bits in the correct location.

This is a data integrity issue as CR0 is corrupted.

Fixes: 4bb3c7a0208f ("KVM: PPC: Book3S HV: Work around transactional memory bugs in POWER9")
Cc: stable@vger.kernel.org # v4.17+
Tested-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kvm/book3s_hv_tm.c