KVM: PPC: Book3S HV: Context-switch HFSCR between host and guest on POWER9
authorPaul Mackerras <paulus@ozlabs.org>
Wed, 15 Feb 2017 03:30:17 +0000 (14:30 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Mon, 19 Jun 2017 04:08:02 +0000 (14:08 +1000)
commit769377f77ca2087baeaf97ce0b7026abeba3b581
treed5929c25560ffccb100947b9d27e5d7e84338963
parent1da4e2f4fbd99f3fbf4275fc89617ffd671af95d
KVM: PPC: Book3S HV: Context-switch HFSCR between host and guest on POWER9

This adds code to allow us to use a different value for the HFSCR
(Hypervisor Facilities Status and Control Register) when running the
guest from that which applies in the host.  The reason for doing this
is to allow us to trap the msgsndp instruction and related operations
in future so that they can be virtualized.  We also save the value of
HFSCR when a hypervisor facility unavailable interrupt occurs, because
the high byte of HFSCR indicates which facility the guest attempted to
access.

We save and restore the host value on guest entry/exit because some
bits of it affect host userspace execution.

We only do all this on POWER9, not on POWER8, because we are not
intending to virtualize any of the facilities controlled by HFSCR on
POWER8.  In particular, the HFSCR bit that controls execution of
msgsndp and related operations does not exist on POWER8.  The HFSCR
doesn't exist at all on POWER7.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S