]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Context switch AMR on Power9
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 20 Feb 2019 08:55:00 +0000 (19:55 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Feb 2019 02:19:52 +0000 (13:19 +1100)
commit2d26c1e6bf0c74eb3f603d84c8fc174482932167
tree860545b539ccbd2990c46f8e84fb847c6c022a93
parent8b5c1a1b081cff38bca27a6abe1da0f1accff3a0
KVM: PPC: Book3S HV: Context switch AMR on Power9

kvmhv_p9_guest_entry() implements a fast-path guest entry for Power9
when guest and host are both running with the Radix MMU.

Currently in that path we don't save the host AMR (Authority Mask
Register) value, and we always restore 0 on return to the host. That
is OK at the moment because the AMR is not used for storage keys with
the Radix MMU.

However we plan to start using the AMR on Radix to prevent the kernel
from reading/writing to userspace outside of copy_to/from_user(). In
order to make that work we need to save/restore the AMR value.

We only restore the value if it is different from the guest value,
which is already in the register when we exit to the host. This should
mean we rarely need to actually restore the value when running a
modern Linux as a guest, because it will be using the same value as
us.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Russell Currey <ruscur@russell.cc>
arch/powerpc/kvm/book3s_hv.c