Skip to content

Commit 1682408

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/cpufeature: Introduce ID_PFR2 CPU register
This adds basic building blocks required for ID_PFR2 CPU register which provides information about the AArch32 programmers model which must be interpreted along with ID_PFR0 and ID_PFR1 CPU registers. This is added per ARM DDI 0487F.a specification. Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Mark Rutland <[email protected]> Cc: James Morse <[email protected]> Cc: Suzuki K Poulose <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Suggested-by: Mark Rutland <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e965bcb commit 1682408

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

arch/arm64/include/asm/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ struct cpuinfo_arm64 {
4646
u32 reg_id_mmfr3;
4747
u32 reg_id_pfr0;
4848
u32 reg_id_pfr1;
49+
u32 reg_id_pfr2;
4950

5051
u32 reg_mvfr0;
5152
u32 reg_mvfr1;

arch/arm64/include/asm/sysreg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138

139139
#define SYS_ID_PFR0_EL1 sys_reg(3, 0, 0, 1, 0)
140140
#define SYS_ID_PFR1_EL1 sys_reg(3, 0, 0, 1, 1)
141+
#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)
141142
#define SYS_ID_DFR0_EL1 sys_reg(3, 0, 0, 1, 2)
142143
#define SYS_ID_AFR0_EL1 sys_reg(3, 0, 0, 1, 3)
143144
#define SYS_ID_MMFR0_EL1 sys_reg(3, 0, 0, 1, 4)
@@ -789,6 +790,9 @@
789790
#define ID_ISAR6_DP_SHIFT 4
790791
#define ID_ISAR6_JSCVT_SHIFT 0
791792

793+
#define ID_PFR2_SSBS_SHIFT 4
794+
#define ID_PFR2_CSV3_SHIFT 0
795+
792796
#define MVFR0_FPROUND_SHIFT 28
793797
#define MVFR0_FPSHVEC_SHIFT 24
794798
#define MVFR0_FPSQRT_SHIFT 20

arch/arm64/kernel/cpufeature.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,12 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = {
439439
ARM64_FTR_END,
440440
};
441441

442+
static const struct arm64_ftr_bits ftr_id_pfr2[] = {
443+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_PFR2_SSBS_SHIFT, 4, 0),
444+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_PFR2_CSV3_SHIFT, 4, 0),
445+
ARM64_FTR_END,
446+
};
447+
442448
static const struct arm64_ftr_bits ftr_id_dfr0[] = {
443449
/* [31:28] TraceFilt */
444450
S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 24, 4, 0xf), /* PerfMon */
@@ -520,6 +526,7 @@ static const struct __ftr_reg_entry {
520526
ARM64_FTR_REG(SYS_MVFR0_EL1, ftr_generic_32bits),
521527
ARM64_FTR_REG(SYS_MVFR1_EL1, ftr_generic_32bits),
522528
ARM64_FTR_REG(SYS_MVFR2_EL1, ftr_mvfr2),
529+
ARM64_FTR_REG(SYS_ID_PFR2_EL1, ftr_id_pfr2),
523530

524531
/* Op1 = 0, CRn = 0, CRm = 4 */
525532
ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),
@@ -726,6 +733,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
726733
init_cpu_ftr_reg(SYS_ID_MMFR3_EL1, info->reg_id_mmfr3);
727734
init_cpu_ftr_reg(SYS_ID_PFR0_EL1, info->reg_id_pfr0);
728735
init_cpu_ftr_reg(SYS_ID_PFR1_EL1, info->reg_id_pfr1);
736+
init_cpu_ftr_reg(SYS_ID_PFR2_EL1, info->reg_id_pfr2);
729737
init_cpu_ftr_reg(SYS_MVFR0_EL1, info->reg_mvfr0);
730738
init_cpu_ftr_reg(SYS_MVFR1_EL1, info->reg_mvfr1);
731739
init_cpu_ftr_reg(SYS_MVFR2_EL1, info->reg_mvfr2);
@@ -859,6 +867,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info,
859867
info->reg_id_pfr0, boot->reg_id_pfr0);
860868
taint |= check_update_ftr_reg(SYS_ID_PFR1_EL1, cpu,
861869
info->reg_id_pfr1, boot->reg_id_pfr1);
870+
taint |= check_update_ftr_reg(SYS_ID_PFR2_EL1, cpu,
871+
info->reg_id_pfr2, boot->reg_id_pfr2);
862872
taint |= check_update_ftr_reg(SYS_MVFR0_EL1, cpu,
863873
info->reg_mvfr0, boot->reg_mvfr0);
864874
taint |= check_update_ftr_reg(SYS_MVFR1_EL1, cpu,
@@ -986,6 +996,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)
986996
switch (sys_id) {
987997
read_sysreg_case(SYS_ID_PFR0_EL1);
988998
read_sysreg_case(SYS_ID_PFR1_EL1);
999+
read_sysreg_case(SYS_ID_PFR2_EL1);
9891000
read_sysreg_case(SYS_ID_DFR0_EL1);
9901001
read_sysreg_case(SYS_ID_MMFR0_EL1);
9911002
read_sysreg_case(SYS_ID_MMFR1_EL1);

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
375375
info->reg_id_mmfr3 = read_cpuid(ID_MMFR3_EL1);
376376
info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1);
377377
info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1);
378+
info->reg_id_pfr2 = read_cpuid(ID_PFR2_EL1);
378379

379380
info->reg_mvfr0 = read_cpuid(MVFR0_EL1);
380381
info->reg_mvfr1 = read_cpuid(MVFR1_EL1);

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
14561456
ID_SANITISED(MVFR1_EL1),
14571457
ID_SANITISED(MVFR2_EL1),
14581458
ID_UNALLOCATED(3,3),
1459-
ID_UNALLOCATED(3,4),
1459+
ID_SANITISED(ID_PFR2_EL1),
14601460
ID_UNALLOCATED(3,5),
14611461
ID_UNALLOCATED(3,6),
14621462
ID_UNALLOCATED(3,7),

0 commit comments

Comments
 (0)