KVM: PPC: Book3S: Fix CONFIG_TRANSACTIONAL_MEM=n crash
authorNicholas Piggin <npiggin@gmail.com>
Fri, 16 Jul 2021 02:43:09 +0000 (12:43 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jul 2021 12:37:29 +0000 (14:37 +0200)
commitcdf4a0589eafbf9bc94af61b9ecf72220f00523f
tree8640c68075c471bafaf9dbb2f23fd1f7a31b5b54
parent69f253c44401b7bd2ca42a943b43c0f784f4bafb
KVM: PPC: Book3S: Fix CONFIG_TRANSACTIONAL_MEM=n crash

[ Upstream commit bd31ecf44b8e18ccb1e5f6b50f85de6922a60de3 ]

When running CPU_FTR_P9_TM_HV_ASSIST, HFSCR[TM] is set for the guest
even if the host has CONFIG_TRANSACTIONAL_MEM=n, which causes it to be
unprepared to handle guest exits while transactional.

Normal guests don't have a problem because the HTM capability will not
be advertised, but a rogue or buggy one could crash the host.

Fixes: 4bb3c7a0208f ("KVM: PPC: Book3S HV: Work around transactional memory bugs in POWER9")
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210716024310.164448-1-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kvm/book3s_hv.c