Skip to content

Commit bed9b8e

Browse files
committed
KVM: arm64: Advertise PMUv3 if IMPDEF traps are present
Advertise a baseline PMUv3 implementation when running on hardware with IMPDEF traps of the PMUv3 sysregs. Tested-by: Janne Grunau <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 2c433f7 commit bed9b8e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/arm64/kvm/pmu-emul.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,17 @@ u8 kvm_arm_pmu_get_pmuver_limit(void)
12311231
pmuver = SYS_FIELD_GET(ID_AA64DFR0_EL1, PMUVer,
12321232
read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1));
12331233

1234-
/* Treat IMPLEMENTATION DEFINED functionality as unimplemented */
1234+
/*
1235+
* Spoof a barebones PMUv3 implementation if the system supports IMPDEF
1236+
* traps of the PMUv3 sysregs
1237+
*/
1238+
if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS))
1239+
return ID_AA64DFR0_EL1_PMUVer_IMP;
1240+
1241+
/*
1242+
* Otherwise, treat IMPLEMENTATION DEFINED functionality as
1243+
* unimplemented
1244+
*/
12351245
if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
12361246
return 0;
12371247

0 commit comments

Comments
 (0)