]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Do SLB load/unload with guest LPCR value loaded
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 11 Jan 2018 03:51:02 +0000 (14:51 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Wed, 17 Jan 2018 00:19:02 +0000 (11:19 +1100)
commit43ae2825124c1435056f7b2422e47f8dd9262608
treeef3bc964763578daf12287ad67f52b6a6a79e984
parent820195ea8e355dcb6fd811636c36fc19da926d77
KVM: PPC: Book3S HV: Do SLB load/unload with guest LPCR value loaded

This moves the code that loads and unloads the guest SLB values so that
it is done while the guest LPCR value is loaded in the LPCR register.
The reason for doing this is that on POWER9, the behaviour of the
slbmte instruction depends on the LPCR[UPRT] bit.  If UPRT is 1, as
it is for a radix host (or guest), the SLB index is truncated to
2 bits.  This means that for a HPT guest on a radix host, the SLB
was not being loaded correctly, causing the guest to crash.

The SLB is now loaded much later in the guest entry path, after the
LPCR is loaded, which for a secondary thread is after it sees that
the primary thread has switched the MMU to the guest.  The loop that
waits for the primary thread has a branch out to the exit code that
is taken if it sees that other threads have commenced exiting the
guest.  Since we have now not loaded the SLB at this point, we make
this path branch to a new label 'guest_bypass' and we move the SLB
unload code to before this label.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv_rmhandlers.S