KVM: arm64: PMU: Restore the host's PMUSERENR_EL0
authorReiji Watanabe <reijiw@google.com>
Sat, 3 Jun 2023 02:50:34 +0000 (19:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jun 2023 09:12:28 +0000 (11:12 +0200)
commitb36ba84f09a142b2564932b42735e04bb0907395
treea3571ed290528ab4c543c4fecfd89a88cb13e192
parentc803e91600bef2626744734f7ba7d617e1dc19f7
KVM: arm64: PMU: Restore the host's PMUSERENR_EL0

[ Upstream commit 8681f71759010503892f9e3ddb05f65c0f21b690 ]

Restore the host's PMUSERENR_EL0 value instead of clearing it,
before returning back to userspace, as the host's EL0 might have
a direct access to PMU registers (some bits of PMUSERENR_EL0 for
might not be zero for the host EL0).

Fixes: 83a7a4d643d3 ("arm64: perf: Enable PMU counter userspace access for perf event")
Signed-off-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230603025035.3781797-2-reijiw@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/kvm/hyp/include/hyp/switch.h