KVM: arm64: Flush the instruction cache if not unmapping the VM on reboot
authorMarc Zyngier <maz@kernel.org>
Sat, 30 May 2020 16:22:19 +0000 (17:22 +0100)
committerMarc Zyngier <maz@kernel.org>
Sun, 31 May 2020 10:31:54 +0000 (11:31 +0100)
commit7ae2f3db6167aa7184529fdacd1de72619baf93b
tree60809545dc6793f9e5b6addd158af191469bcc05
parent8f7f4fe756bd5cfef73cf8234445081385bdbf7d
KVM: arm64: Flush the instruction cache if not unmapping the VM on reboot

On a system with FWB, we don't need to unmap Stage-2 on reboot,
as even if userspace takes this opportunity to repaint the whole
of memory, FWB ensures that the data side stays consistent even
if the guest uses non-cacheable mappings.

However, the I-side is not necessarily coherent with the D-side
if CTR_EL0.DIC is 0. In this case, invalidate the i-cache to
preserve coherency.

Reported-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Fixes: 892713e97ca1 ("KVM: arm64: Sidestep stage2_unmap_vm() on vcpu reset when S2FWB is supported")
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/arm.c