Skip to content

Commit 121a8fc

Browse files
brooniectmarinas
authored andcommitted
arm64/sysreg: Use feature numbering for PMU and SPE revisions
Currently the kernel refers to the versions of the PMU and SPE features by the version of the architecture where those features were updated but the ARM refers to them using the FEAT_ names for the features. To improve consistency and help with updating for newer features and since v9 will make our current naming scheme a bit more confusing update the macros identfying features to use the FEAT_ based scheme. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent fcf37b3 commit 121a8fc

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,15 @@
711711
#define ID_AA64DFR0_EL1_TraceVer_SHIFT 4
712712
#define ID_AA64DFR0_EL1_DebugVer_SHIFT 0
713713

714-
#define ID_AA64DFR0_EL1_PMUVer_8_0 0x1
715-
#define ID_AA64DFR0_EL1_PMUVer_8_1 0x4
716-
#define ID_AA64DFR0_EL1_PMUVer_8_4 0x5
717-
#define ID_AA64DFR0_EL1_PMUVer_8_5 0x6
718-
#define ID_AA64DFR0_EL1_PMUVer_8_7 0x7
714+
#define ID_AA64DFR0_EL1_PMUVer_IMP 0x1
715+
#define ID_AA64DFR0_EL1_PMUVer_V3P1 0x4
716+
#define ID_AA64DFR0_EL1_PMUVer_V3P4 0x5
717+
#define ID_AA64DFR0_EL1_PMUVer_V3P5 0x6
718+
#define ID_AA64DFR0_EL1_PMUVer_V3P7 0x7
719719
#define ID_AA64DFR0_EL1_PMUVer_IMP_DEF 0xf
720720

721-
#define ID_AA64DFR0_EL1_PMSVer_8_2 0x1
722-
#define ID_AA64DFR0_EL1_PMSVer_8_3 0x2
721+
#define ID_AA64DFR0_EL1_PMSVer_IMP 0x1
722+
#define ID_AA64DFR0_EL1_PMSVer_V1P1 0x2
723723

724724
#define ID_DFR0_PERFMON_SHIFT 24
725725

arch/arm64/kernel/perf_event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static const struct attribute_group armv8_pmuv3_caps_attr_group = {
390390
*/
391391
static bool armv8pmu_has_long_event(struct arm_pmu *cpu_pmu)
392392
{
393-
return (cpu_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_8_5);
393+
return (cpu_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P5);
394394
}
395395

396396
static inline bool armv8pmu_event_has_user_read(struct perf_event *event)
@@ -1172,7 +1172,7 @@ static void __armv8pmu_probe_pmu(void *info)
11721172
pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS);
11731173

11741174
/* store PMMIR_EL1 register for sysfs */
1175-
if (pmuver >= ID_AA64DFR0_EL1_PMUVer_8_4 && (pmceid_raw[1] & BIT(31)))
1175+
if (pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4 && (pmceid_raw[1] & BIT(31)))
11761176
cpu_pmu->reg_pmmir = read_cpuid(PMMIR_EL1);
11771177
else
11781178
cpu_pmu->reg_pmmir = 0;

arch/arm64/kvm/pmu-emul.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ static u32 kvm_pmu_event_mask(struct kvm *kvm)
3333
pmuver = kvm->arch.arm_pmu->pmuver;
3434

3535
switch (pmuver) {
36-
case ID_AA64DFR0_EL1_PMUVer_8_0:
36+
case ID_AA64DFR0_EL1_PMUVer_IMP:
3737
return GENMASK(9, 0);
38-
case ID_AA64DFR0_EL1_PMUVer_8_1:
39-
case ID_AA64DFR0_EL1_PMUVer_8_4:
40-
case ID_AA64DFR0_EL1_PMUVer_8_5:
41-
case ID_AA64DFR0_EL1_PMUVer_8_7:
38+
case ID_AA64DFR0_EL1_PMUVer_V3P1:
39+
case ID_AA64DFR0_EL1_PMUVer_V3P4:
40+
case ID_AA64DFR0_EL1_PMUVer_V3P5:
41+
case ID_AA64DFR0_EL1_PMUVer_V3P7:
4242
return GENMASK(15, 0);
4343
default: /* Shouldn't be here, just for sanity */
4444
WARN_ONCE(1, "Unknown PMU version %d\n", pmuver);
@@ -856,7 +856,7 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1)
856856
* Don't advertise STALL_SLOT, as PMMIR_EL0 is handled
857857
* as RAZ
858858
*/
859-
if (vcpu->kvm->arch.arm_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_8_4)
859+
if (vcpu->kvm->arch.arm_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4)
860860
val &= ~BIT_ULL(ARMV8_PMUV3_PERFCTR_STALL_SLOT - 32);
861861
base = 32;
862862
}

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,
11151115
/* Limit guests to PMUv3 for ARMv8.4 */
11161116
val = cpuid_feature_cap_perfmon_field(val,
11171117
ID_AA64DFR0_EL1_PMUVer_SHIFT,
1118-
kvm_vcpu_has_pmu(vcpu) ? ID_AA64DFR0_EL1_PMUVer_8_4 : 0);
1118+
kvm_vcpu_has_pmu(vcpu) ? ID_AA64DFR0_EL1_PMUVer_V3P4 : 0);
11191119
/* Hide SPE from guests */
11201120
val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_PMSVer);
11211121
break;

0 commit comments

Comments
 (0)