Skip to content

Commit bba7541

Browse files
ouptonjannau
authored andcommitted
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. Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent b96c200 commit bba7541

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

arch/arm64/kvm/pmu-emul.c

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

1246-
/* Treat IMPLEMENTATION DEFINED functionality as unimplemented */
1246+
/*
1247+
* Spoof a barebones PMUv3 implementation if the system supports IMPDEF
1248+
* traps of the PMUv3 sysregs
1249+
*/
1250+
if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS))
1251+
return ID_AA64DFR0_EL1_PMUVer_IMP;
1252+
1253+
/*
1254+
* Otherwise, treat IMPLEMENTATION DEFINED functionality as
1255+
* unimplemented
1256+
*/
12471257
if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
12481258
return 0;
12491259

0 commit comments

Comments
 (0)