Skip to content

Commit b71e2b2

Browse files
committed
target/arm: Implement ID_AA64PFR2_EL1
Currently we define the ID_AA64PFR2_EL1 encoding as reserved (with the required RAZ behaviour for unassigned system registers in the ID register encoding space). Newer architecture versions start to define fields in this ID register, so define the appropriate constants and implement it as an ID register backed by a field in cpu->isar. Since none of our CPUs set that isar field to non-zero, there is no behavioural change here (other than the name exposed to the user via the gdbstub), but this paves the way for implementing the new features that use fields in this register. The fields here are the ones documented in rev L.b of the Arm ARM. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
1 parent ff197ae commit b71e2b2

File tree

6 files changed

+13
-2
lines changed

6 files changed

+13
-2
lines changed

target/arm/cpu-features.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ FIELD(ID_AA64PFR1, MTEX, 52, 4)
277277
FIELD(ID_AA64PFR1, DF2, 56, 4)
278278
FIELD(ID_AA64PFR1, PFAR, 60, 4)
279279

280+
FIELD(ID_AA64PFR2, MTEPERM, 0, 4)
281+
FIELD(ID_AA64PFR2, MTESTOREONLY, 4, 4)
282+
FIELD(ID_AA64PFR2, MTEFAR, 8, 4)
283+
FIELD(ID_AA64PFR2, FPMR, 32, 4)
284+
280285
FIELD(ID_AA64MMFR0, PARANGE, 0, 4)
281286
FIELD(ID_AA64MMFR0, ASIDBITS, 4, 4)
282287
FIELD(ID_AA64MMFR0, BIGEND, 8, 4)

target/arm/cpu-sysregs.h.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0-or-later */
22
DEF(ID_AA64PFR0_EL1, 3, 0, 0, 4, 0)
33
DEF(ID_AA64PFR1_EL1, 3, 0, 0, 4, 1)
4+
DEF(ID_AA64PFR2_EL1, 3, 0, 0, 4, 2)
45
DEF(ID_AA64SMFR0_EL1, 3, 0, 0, 4, 5)
56
DEF(ID_AA64DFR0_EL1, 3, 0, 0, 5, 0)
67
DEF(ID_AA64DFR1_EL1, 3, 0, 0, 5, 1)

target/arm/helper.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6109,11 +6109,11 @@ void register_cp_regs_for_features(ARMCPU *cpu)
61096109
.access = PL1_R, .type = ARM_CP_CONST,
61106110
.accessfn = access_aa64_tid3,
61116111
.resetvalue = GET_IDREG(isar, ID_AA64PFR1)},
6112-
{ .name = "ID_AA64PFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
6112+
{ .name = "ID_AA64PFR2_EL1", .state = ARM_CP_STATE_AA64,
61136113
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 2,
61146114
.access = PL1_R, .type = ARM_CP_CONST,
61156115
.accessfn = access_aa64_tid3,
6116-
.resetvalue = 0 },
6116+
.resetvalue = GET_IDREG(isar, ID_AA64PFR2)},
61176117
{ .name = "ID_AA64PFR3_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
61186118
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 4, .opc2 = 3,
61196119
.access = PL1_R, .type = ARM_CP_CONST,
@@ -6341,6 +6341,8 @@ void register_cp_regs_for_features(ARMCPU *cpu)
63416341
R_ID_AA64PFR1_SSBS_MASK |
63426342
R_ID_AA64PFR1_MTE_MASK |
63436343
R_ID_AA64PFR1_SME_MASK },
6344+
{ .name = "ID_AA64PFR2_EL1",
6345+
.exported_bits = 0 },
63446346
{ .name = "ID_AA64PFR*_EL1_RESERVED",
63456347
.is_glob = true },
63466348
{ .name = "ID_AA64ZFR0_EL1",

target/arm/hvf/hvf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
744744
} regs[] = {
745745
{ HV_SYS_REG_ID_AA64PFR0_EL1, &host_isar.idregs[ID_AA64PFR0_EL1_IDX] },
746746
{ HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.idregs[ID_AA64PFR1_EL1_IDX] },
747+
/* Add ID_AA64PFR2_EL1 here when HVF supports it */
747748
{ HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.idregs[ID_AA64DFR0_EL1_IDX] },
748749
{ HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.idregs[ID_AA64DFR1_EL1_IDX] },
749750
{ HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_IDX] },

target/arm/hvf/sysreg.c.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ DEF_SYSREG(HV_SYS_REG_ID_AA64PFR0_EL1, 3, 0, 0, 4, 0)
9292
#endif
9393

9494
DEF_SYSREG(HV_SYS_REG_ID_AA64PFR1_EL1, 3, 0, 0, 4, 1)
95+
/* Add ID_AA64PFR2_EL1 here when HVF supports it */
9596
DEF_SYSREG(HV_SYS_REG_ID_AA64DFR0_EL1, 3, 0, 0, 5, 0)
9697
DEF_SYSREG(HV_SYS_REG_ID_AA64DFR1_EL1, 3, 0, 0, 5, 1)
9798
DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0)

target/arm/kvm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
324324
err = 0;
325325
} else {
326326
err |= get_host_cpu_reg(fd, ahcf, ID_AA64PFR1_EL1_IDX);
327+
err |= get_host_cpu_reg(fd, ahcf, ID_AA64PFR2_EL1_IDX);
327328
err |= get_host_cpu_reg(fd, ahcf, ID_AA64SMFR0_EL1_IDX);
328329
err |= get_host_cpu_reg(fd, ahcf, ID_AA64DFR0_EL1_IDX);
329330
err |= get_host_cpu_reg(fd, ahcf, ID_AA64DFR1_EL1_IDX);

0 commit comments

Comments
 (0)