Skip to content

Commit 0a4cfe2

Browse files
ouptonjannau
authored andcommitted
KVM: arm64: Provide 1 event counter on IMPDEF hardware
PMUv3 requires that all programmable event counters are capable of counting any event. The Apple M* PMU is quite a bit different, and events have affinities for particular PMCs. Expose 1 event counter on IMPDEF hardware, allowing the guest to do something useful with its PMU while also upholding the requirements of the architecture. Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 7687710 commit 0a4cfe2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

arch/arm64/kvm/pmu-emul.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,12 @@ u8 kvm_arm_pmu_get_max_counters(struct kvm *kvm)
10271027
{
10281028
struct arm_pmu *arm_pmu = kvm->arch.arm_pmu;
10291029

1030+
/*
1031+
* PMUv3 requires that all event counters are capable of counting any
1032+
* event, though the same may not be true of non-PMUv3 hardware.
1033+
*/
10301034
if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS))
1031-
return 0;
1035+
return 1;
10321036

10331037
/*
10341038
* The arm_pmu->cntr_mask considers the fixed counter(s) as well.

0 commit comments

Comments
 (0)