arm64: KVM: Save/restore the host SPE state when entering/leaving a VM
authorWill Deacon <will.deacon@arm.com>
Thu, 22 Sep 2016 10:35:43 +0000 (11:35 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 2 Feb 2017 18:33:01 +0000 (18:33 +0000)
commitf85279b4bd481a1a0697c1d2a8a5f15de216b120
tree85ae5ff3b6cfae4ea9ef703d31cfd0a2e46e9983
parent3d29a9a0f88300b7ccb642ebee61b331ef0a8c27
arm64: KVM: Save/restore the host SPE state when entering/leaving a VM

The SPE buffer is virtually addressed, using the page tables of the CPU
MMU. Unusually, this means that the EL0/1 page table may be live whilst
we're executing at EL2 on non-VHE configurations. When VHE is in use,
we can use the same property to profile the guest behind its back.

This patch adds the relevant disabling and flushing code to KVM so that
the host can make use of SPE without corrupting guest memory, and any
attempts by a guest to use SPE will result in a trap.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Alex Bennée <alex.bennee@linaro.org>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/kvm_arm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/debug.c
arch/arm64/kvm/hyp/debug-sr.c
arch/arm64/kvm/hyp/switch.c