]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-6.1/kvm-arm64-fix-host-programmed-guest-events-in-nvhe.patch
6.1-stable patches
[thirdparty/kernel/stable-queue.git] / queue-6.1 / kvm-arm64-fix-host-programmed-guest-events-in-nvhe.patch
CommitLineData
2c86f966
GKH
1From e89c928bedd77d181edc2df01cb6672184775140 Mon Sep 17 00:00:00 2001
2From: Oliver Upton <oliver.upton@linux.dev>
3Date: Tue, 5 Mar 2024 18:48:39 +0000
4Subject: KVM: arm64: Fix host-programmed guest events in nVHE
5
6From: Oliver Upton <oliver.upton@linux.dev>
7
8commit e89c928bedd77d181edc2df01cb6672184775140 upstream.
9
10Programming PMU events in the host that count during guest execution is
11a feature supported by perf, e.g.
12
13 perf stat -e cpu_cycles:G ./lkvm run
14
15While this works for VHE, the guest/host event bitmaps are not carried
16through to the hypervisor in the nVHE configuration. Make
17kvm_pmu_update_vcpu_events() conditional on whether or not _hardware_
18supports PMUv3 rather than if the vCPU as vPMU enabled.
19
20Cc: stable@vger.kernel.org
21Fixes: 84d751a019a9 ("KVM: arm64: Pass pmu events to hyp via vcpu")
22Reviewed-by: Marc Zyngier <maz@kernel.org>
23Link: https://lore.kernel.org/r/20240305184840.636212-3-oliver.upton@linux.dev
24Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
25Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26---
27 include/kvm/arm_pmu.h | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30--- a/include/kvm/arm_pmu.h
31+++ b/include/kvm/arm_pmu.h
32@@ -85,7 +85,7 @@ void kvm_vcpu_pmu_restore_host(struct kv
33 */
34 #define kvm_pmu_update_vcpu_events(vcpu) \
35 do { \
36- if (!has_vhe() && kvm_vcpu_has_pmu(vcpu)) \
37+ if (!has_vhe() && kvm_arm_support_pmu_v3()) \
38 vcpu->arch.pmu.events = *kvm_get_pmu_events(); \
39 } while (0)
40