arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu
authorJulien Thierry <julien.thierry@arm.com>
Wed, 6 Dec 2017 17:09:49 +0000 (17:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Dec 2017 16:53:48 +0000 (17:53 +0100)
commit8a74c8e87e46fa85fbd0c73273c831559c25d576
tree1da223ff49b3d687633bdfac9b755980edfa5ee2
parentefc9b7ae524dfbd4cb9122d2f1d4e9c33d0f11dd
arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu

commit bfe766cf65fb65e68c4764f76158718560bdcee5 upstream.

When VHE is not present, KVM needs to save and restores PMSCR_EL1 when
possible. If SPE is used by the host, value of PMSCR_EL1 cannot be saved
for the guest.
If the host starts using SPE between two save+restore on the same vcpu,
restore will write the value of PMSCR_EL1 read during the first save.

Make sure __debug_save_spe_nvhe clears the value of the saved PMSCR_EL1
when the guest cannot use SPE.

Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kvm/hyp/debug-sr.c