[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 01/51] target/arm: Implement TPIDR2_EL0
From: |
Richard Henderson |
Subject: |
[PATCH v3 01/51] target/arm: Implement TPIDR2_EL0 |
Date: |
Mon, 20 Jun 2022 10:51:45 -0700 |
This register is part of SME, but isn't closely related to the
rest of the extension.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu.h | 1 +
target/arm/helper.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index df677b2d5d..05d1e2e8dd 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -474,6 +474,7 @@ typedef struct CPUArchState {
};
uint64_t tpidr_el[4];
};
+ uint64_t tpidr2_el0;
/* The secure banks of these registers don't map anywhere */
uint64_t tpidrurw_s;
uint64_t tpidrprw_s;
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 6457e6301c..d21ba7ab83 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6279,6 +6279,35 @@ static const ARMCPRegInfo zcr_reginfo[] = {
.writefn = zcr_write, .raw_writefn = raw_write },
};
+#ifdef TARGET_AARCH64
+static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri,
+ bool isread)
+{
+ int el = arm_current_el(env);
+
+ if (el == 0) {
+ uint64_t sctlr = arm_sctlr(env, el);
+ if (!(sctlr & SCTLR_EnTP2)) {
+ return CP_ACCESS_TRAP;
+ }
+ }
+ /* TODO: FEAT_FGT */
+ if (el < 3
+ && arm_feature(env, ARM_FEATURE_EL3)
+ && !(env->cp15.scr_el3 & SCR_ENTP2)) {
+ return CP_ACCESS_TRAP_EL3;
+ }
+ return CP_ACCESS_OK;
+}
+
+static const ARMCPRegInfo sme_reginfo[] = {
+ { .name = "TPIDR2_EL0", .state = ARM_CP_STATE_AA64,
+ .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 5,
+ .access = PL0_RW, .accessfn = access_tpidr2,
+ .fieldoffset = offsetof(CPUARMState, cp15.tpidr2_el0) },
+};
+#endif /* TARGET_AARCH64 */
+
void hw_watchpoint_update(ARMCPU *cpu, int n)
{
CPUARMState *env = &cpu->env;
@@ -8440,6 +8469,9 @@ void register_cp_regs_for_features(ARMCPU *cpu)
}
#ifdef TARGET_AARCH64
+ if (cpu_isar_feature(aa64_sme, cpu)) {
+ define_arm_cp_regs(cpu, sme_reginfo);
+ }
if (cpu_isar_feature(aa64_pauth, cpu)) {
define_arm_cp_regs(cpu, pauth_reginfo);
}
--
2.34.1
- [PATCH v3 00/51] target/arm: Scalable Matrix Extension, Richard Henderson, 2022/06/20
- [PATCH v3 01/51] target/arm: Implement TPIDR2_EL0,
Richard Henderson <=
- [PATCH v3 03/51] target/arm: Add syn_smetrap, Richard Henderson, 2022/06/20
- [PATCH v3 05/51] target/arm: Add SVCR, Richard Henderson, 2022/06/20
- [PATCH v3 02/51] target/arm: Add SMEEXC_EL to TB flags, Richard Henderson, 2022/06/20
- [PATCH v3 07/51] target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2, Richard Henderson, 2022/06/20
- [PATCH v3 04/51] target/arm: Add ARM_CP_SME, Richard Henderson, 2022/06/20
- [PATCH v3 06/51] target/arm: Add SMCR_ELx, Richard Henderson, 2022/06/20
- [PATCH v3 10/51] target/arm: Implement SMSTART, SMSTOP, Richard Henderson, 2022/06/20
- [PATCH v3 08/51] target/arm: Add PSTATE.{SM,ZA} to TB flags, Richard Henderson, 2022/06/20
- [PATCH v3 09/51] target/arm: Add the SME ZA storage to CPUARMState, Richard Henderson, 2022/06/20