Skip to content

Commit dd35ec0

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/cpufeature: Introduce ID_DFR1 CPU register
This adds basic building blocks required for ID_DFR1 CPU register which provides top level information about the debug system in AArch32 state. We hide the register from KVM guests, as we don't emulate the 'MTPMU' feature. 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: Will Deacon <[email protected]> Reviewed-by : Suzuki K Poulose <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 1682408 commit dd35ec0

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

arch/arm64/include/asm/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct cpuinfo_arm64 {
3333
u64 reg_id_aa64zfr0;
3434

3535
u32 reg_id_dfr0;
36+
u32 reg_id_dfr1;
3637
u32 reg_id_isar0;
3738
u32 reg_id_isar1;
3839
u32 reg_id_isar2;

arch/arm64/include/asm/sysreg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
#define SYS_ID_PFR1_EL1 sys_reg(3, 0, 0, 1, 1)
141141
#define SYS_ID_PFR2_EL1 sys_reg(3, 0, 0, 3, 4)
142142
#define SYS_ID_DFR0_EL1 sys_reg(3, 0, 0, 1, 2)
143+
#define SYS_ID_DFR1_EL1 sys_reg(3, 0, 0, 3, 5)
143144
#define SYS_ID_AFR0_EL1 sys_reg(3, 0, 0, 1, 3)
144145
#define SYS_ID_MMFR0_EL1 sys_reg(3, 0, 0, 1, 4)
145146
#define SYS_ID_MMFR1_EL1 sys_reg(3, 0, 0, 1, 5)
@@ -767,6 +768,8 @@
767768
#define ID_ISAR4_WITHSHIFTS_SHIFT 4
768769
#define ID_ISAR4_UNPRIV_SHIFT 0
769770

771+
#define ID_DFR1_MTPMU_SHIFT 0
772+
770773
#define ID_ISAR0_DIVIDE_SHIFT 24
771774
#define ID_ISAR0_DEBUG_SHIFT 20
772775
#define ID_ISAR0_COPROC_SHIFT 16

arch/arm64/kernel/cpufeature.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@ static const struct arm64_ftr_bits ftr_id_dfr0[] = {
457457
ARM64_FTR_END,
458458
};
459459

460+
static const struct arm64_ftr_bits ftr_id_dfr1[] = {
461+
S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR1_MTPMU_SHIFT, 4, 0),
462+
ARM64_FTR_END,
463+
};
464+
460465
static const struct arm64_ftr_bits ftr_zcr[] = {
461466
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE,
462467
ZCR_ELx_LEN_SHIFT, ZCR_ELx_LEN_SIZE, 0), /* LEN */
@@ -527,6 +532,7 @@ static const struct __ftr_reg_entry {
527532
ARM64_FTR_REG(SYS_MVFR1_EL1, ftr_generic_32bits),
528533
ARM64_FTR_REG(SYS_MVFR2_EL1, ftr_mvfr2),
529534
ARM64_FTR_REG(SYS_ID_PFR2_EL1, ftr_id_pfr2),
535+
ARM64_FTR_REG(SYS_ID_DFR1_EL1, ftr_id_dfr1),
530536

531537
/* Op1 = 0, CRn = 0, CRm = 4 */
532538
ARM64_FTR_REG(SYS_ID_AA64PFR0_EL1, ftr_id_aa64pfr0),
@@ -720,6 +726,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
720726

721727
if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
722728
init_cpu_ftr_reg(SYS_ID_DFR0_EL1, info->reg_id_dfr0);
729+
init_cpu_ftr_reg(SYS_ID_DFR1_EL1, info->reg_id_dfr1);
723730
init_cpu_ftr_reg(SYS_ID_ISAR0_EL1, info->reg_id_isar0);
724731
init_cpu_ftr_reg(SYS_ID_ISAR1_EL1, info->reg_id_isar1);
725732
init_cpu_ftr_reg(SYS_ID_ISAR2_EL1, info->reg_id_isar2);
@@ -835,6 +842,8 @@ static int update_32bit_cpu_features(int cpu, struct cpuinfo_arm64 *info,
835842

836843
taint |= check_update_ftr_reg(SYS_ID_DFR0_EL1, cpu,
837844
info->reg_id_dfr0, boot->reg_id_dfr0);
845+
taint |= check_update_ftr_reg(SYS_ID_DFR1_EL1, cpu,
846+
info->reg_id_dfr1, boot->reg_id_dfr1);
838847
taint |= check_update_ftr_reg(SYS_ID_ISAR0_EL1, cpu,
839848
info->reg_id_isar0, boot->reg_id_isar0);
840849
taint |= check_update_ftr_reg(SYS_ID_ISAR1_EL1, cpu,
@@ -998,6 +1007,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)
9981007
read_sysreg_case(SYS_ID_PFR1_EL1);
9991008
read_sysreg_case(SYS_ID_PFR2_EL1);
10001009
read_sysreg_case(SYS_ID_DFR0_EL1);
1010+
read_sysreg_case(SYS_ID_DFR1_EL1);
10011011
read_sysreg_case(SYS_ID_MMFR0_EL1);
10021012
read_sysreg_case(SYS_ID_MMFR1_EL1);
10031013
read_sysreg_case(SYS_ID_MMFR2_EL1);

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
362362
/* Update the 32bit ID registers only if AArch32 is implemented */
363363
if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
364364
info->reg_id_dfr0 = read_cpuid(ID_DFR0_EL1);
365+
info->reg_id_dfr1 = read_cpuid(ID_DFR1_EL1);
365366
info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1);
366367
info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1);
367368
info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1);

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
14571457
ID_SANITISED(MVFR2_EL1),
14581458
ID_UNALLOCATED(3,3),
14591459
ID_SANITISED(ID_PFR2_EL1),
1460-
ID_UNALLOCATED(3,5),
1460+
ID_HIDDEN(ID_DFR1_EL1),
14611461
ID_UNALLOCATED(3,6),
14621462
ID_UNALLOCATED(3,7),
14631463

0 commit comments

Comments
 (0)