]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: PPC: Book3S HV: Add radix checks in real-mode hypercall handlers
authorPaul Mackerras <paulus@ozlabs.org>
Wed, 10 May 2017 06:39:41 +0000 (16:39 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Fri, 12 May 2017 05:08:09 +0000 (15:08 +1000)
commitacde25726bc6034b628febb8a4c6c0838736ccbf
treeaf3b2cd2deb9ceb36046f440e1116ddc6882aa88
parent36c344f3f1ffc0b1b20abd237b7401dc6687ee8f
KVM: PPC: Book3S HV: Add radix checks in real-mode hypercall handlers

POWER9 running a radix guest will take some hypervisor interrupts
without going to real mode (turning off the MMU).  This means that
early hypercall handlers may now be called in virtual mode.  Most of
the handlers work just fine in both modes, but there are some that
can crash the host if called in virtual mode, notably the TCE (IOMMU)
hypercalls H_PUT_TCE, H_STUFF_TCE and H_PUT_TCE_INDIRECT.  These
already have both a real-mode and a virtual-mode version, so we
arrange for the real-mode version to return H_TOO_HARD for radix
guests, which will result in the virtual-mode version being called.

The other hypercall which is sensitive to the MMU mode is H_RANDOM.
It doesn't have a virtual-mode version, so this adds code to enable
it to be called in either mode.

An alternative solution was considered which would refuse to call any
of the early hypercall handlers when doing a virtual-mode exit from a
radix guest.  However, the XICS-on-XIVE code depends on the XICS
hypercalls being handled early even for virtual-mode exits, because
the handlers need to be called before the XIVE vCPU state has been
pulled off the hardware.  Therefore that solution would have become
quite invasive and complicated, and was rejected in favour of the
simpler, though less elegant, solution presented here.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Tested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_64_vio_hv.c
arch/powerpc/kvm/book3s_hv_builtin.c