Skip to content

Commit c20e571

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 2824861 commit c20e571

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
@@ -1158,7 +1158,17 @@ u8 kvm_arm_pmu_get_pmuver_limit(void)
11581158
pmuver = SYS_FIELD_GET(ID_AA64DFR0_EL1, PMUVer,
11591159
read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1));
11601160

1161-
/* Treat IMPLEMENTATION DEFINED functionality as unimplemented */
1161+
/*
1162+
* Spoof a barebones PMUv3 implementation if the system supports IMPDEF
1163+
* traps of the PMUv3 sysregs
1164+
*/
1165+
if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS))
1166+
return ID_AA64DFR0_EL1_PMUVer_IMP;
1167+
1168+
/*
1169+
* Otherwise, treat IMPLEMENTATION DEFINED functionality as
1170+
* unimplemented
1171+
*/
11621172
if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
11631173
return 0;
11641174

0 commit comments

Comments
 (0)