Skip to content

Commit

Permalink
KVM: arm64: Advertise PMUv3 if IMPDEF traps are present
Browse files Browse the repository at this point in the history
Advertise a baseline PMUv3 implementation when running on hardware with
IMPDEF traps of the PMUv3 sysregs.

Tested-by: Janne Grunau <j@jannau.net>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250305202641.428114-11-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
  • Loading branch information
Oliver Upton committed Mar 11, 2025
1 parent 2c433f7 commit bed9b8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/arm64/kvm/pmu-emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,17 @@ u8 kvm_arm_pmu_get_pmuver_limit(void)
pmuver = SYS_FIELD_GET(ID_AA64DFR0_EL1, PMUVer,
read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1));

/* Treat IMPLEMENTATION DEFINED functionality as unimplemented */
/*
* Spoof a barebones PMUv3 implementation if the system supports IMPDEF
* traps of the PMUv3 sysregs
*/
if (cpus_have_final_cap(ARM64_WORKAROUND_PMUV3_IMPDEF_TRAPS))
return ID_AA64DFR0_EL1_PMUVer_IMP;

/*
* Otherwise, treat IMPLEMENTATION DEFINED functionality as
* unimplemented
*/
if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
return 0;

Expand Down

0 comments on commit bed9b8e

Please sign in to comment.