• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision2d7137c10fafefe40a0a049ff8a7bd78b66e661f (tree)
l'heure2018-12-13 23:41:24
AuteurRichard Henderson <richard.henderson@lina...>
CommiterPeter Maydell

Message de Log

target/arm: Implement the ARMv8.1-LOR extension

Provide a trivial implementation with zero limited ordering regions,
which causes the LDLAR and STLLR instructions to devolve into the
LDAR and STLR instructions from the base ARMv8.0 instruction set.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181210150501.7990-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Change Summary

Modification

--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -3340,6 +3340,11 @@ static inline bool isar_feature_aa64_sve(const ARMISARegisters *id)
33403340 return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0;
33413341 }
33423342
3343+static inline bool isar_feature_aa64_lor(const ARMISARegisters *id)
3344+{
3345+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0;
3346+}
3347+
33433348 /*
33443349 * Forward to the above feature tests given an ARMCPU pointer.
33453350 */
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -326,6 +326,7 @@ static void aarch64_max_initfn(Object *obj)
326326
327327 t = cpu->isar.id_aa64mmfr1;
328328 t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
329+ t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
329330 cpu->isar.id_aa64mmfr1 = t;
330331
331332 /* Replicate the same data to the 32-bit id registers. */
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1281,6 +1281,7 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
12811281 {
12821282 /* Begin with base v8.0 state. */
12831283 uint32_t valid_mask = 0x3fff;
1284+ ARMCPU *cpu = arm_env_get_cpu(env);
12841285
12851286 if (arm_el_is_aa64(env, 3)) {
12861287 value |= SCR_FW | SCR_AW; /* these two bits are RES1. */
@@ -1303,6 +1304,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
13031304 valid_mask &= ~SCR_SMD;
13041305 }
13051306 }
1307+ if (cpu_isar_feature(aa64_lor, cpu)) {
1308+ valid_mask |= SCR_TLOR;
1309+ }
13061310
13071311 /* Clear all-context RES0 bits. */
13081312 value &= valid_mask;
@@ -3963,6 +3967,9 @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
39633967 */
39643968 valid_mask &= ~HCR_TSC;
39653969 }
3970+ if (cpu_isar_feature(aa64_lor, cpu)) {
3971+ valid_mask |= HCR_TLOR;
3972+ }
39663973
39673974 /* Clear RES0 bits. */
39683975 value &= valid_mask;
@@ -5018,6 +5025,42 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
50185025 return pfr0;
50195026 }
50205027
5028+/* Shared logic between LORID and the rest of the LOR* registers.
5029+ * Secure state has already been delt with.
5030+ */
5031+static CPAccessResult access_lor_ns(CPUARMState *env)
5032+{
5033+ int el = arm_current_el(env);
5034+
5035+ if (el < 2 && (arm_hcr_el2_eff(env) & HCR_TLOR)) {
5036+ return CP_ACCESS_TRAP_EL2;
5037+ }
5038+ if (el < 3 && (env->cp15.scr_el3 & SCR_TLOR)) {
5039+ return CP_ACCESS_TRAP_EL3;
5040+ }
5041+ return CP_ACCESS_OK;
5042+}
5043+
5044+static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri,
5045+ bool isread)
5046+{
5047+ if (arm_is_secure_below_el3(env)) {
5048+ /* Access ok in secure mode. */
5049+ return CP_ACCESS_OK;
5050+ }
5051+ return access_lor_ns(env);
5052+}
5053+
5054+static CPAccessResult access_lor_other(CPUARMState *env,
5055+ const ARMCPRegInfo *ri, bool isread)
5056+{
5057+ if (arm_is_secure_below_el3(env)) {
5058+ /* Access denied in secure mode. */
5059+ return CP_ACCESS_TRAP;
5060+ }
5061+ return access_lor_ns(env);
5062+}
5063+
50215064 void register_cp_regs_for_features(ARMCPU *cpu)
50225065 {
50235066 /* Register all the coprocessor registers based on feature bits */
@@ -5759,6 +5802,38 @@ void register_cp_regs_for_features(ARMCPU *cpu)
57595802 define_one_arm_cp_reg(cpu, &sctlr);
57605803 }
57615804
5805+ if (cpu_isar_feature(aa64_lor, cpu)) {
5806+ /*
5807+ * A trivial implementation of ARMv8.1-LOR leaves all of these
5808+ * registers fixed at 0, which indicates that there are zero
5809+ * supported Limited Ordering regions.
5810+ */
5811+ static const ARMCPRegInfo lor_reginfo[] = {
5812+ { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64,
5813+ .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0,
5814+ .access = PL1_RW, .accessfn = access_lor_other,
5815+ .type = ARM_CP_CONST, .resetvalue = 0 },
5816+ { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64,
5817+ .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1,
5818+ .access = PL1_RW, .accessfn = access_lor_other,
5819+ .type = ARM_CP_CONST, .resetvalue = 0 },
5820+ { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64,
5821+ .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2,
5822+ .access = PL1_RW, .accessfn = access_lor_other,
5823+ .type = ARM_CP_CONST, .resetvalue = 0 },
5824+ { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64,
5825+ .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3,
5826+ .access = PL1_RW, .accessfn = access_lor_other,
5827+ .type = ARM_CP_CONST, .resetvalue = 0 },
5828+ { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64,
5829+ .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7,
5830+ .access = PL1_R, .accessfn = access_lorid,
5831+ .type = ARM_CP_CONST, .resetvalue = 0 },
5832+ REGINFO_SENTINEL
5833+ };
5834+ define_arm_cp_regs(cpu, lor_reginfo);
5835+ }
5836+
57625837 if (cpu_isar_feature(aa64_sve, cpu)) {
57635838 define_one_arm_cp_reg(cpu, &zcr_el1_reginfo);
57645839 if (arm_feature(env, ARM_FEATURE_EL2)) {
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -2290,6 +2290,12 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn)
22902290 }
22912291 return;
22922292
2293+ case 0x8: /* STLLR */
2294+ if (!dc_isar_feature(aa64_lor, s)) {
2295+ break;
2296+ }
2297+ /* StoreLORelease is the same as Store-Release for QEMU. */
2298+ /* fall through */
22932299 case 0x9: /* STLR */
22942300 /* Generate ISS for non-exclusive accesses including LASR. */
22952301 if (rn == 31) {
@@ -2301,6 +2307,12 @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn)
23012307 disas_ldst_compute_iss_sf(size, false, 0), is_lasr);
23022308 return;
23032309
2310+ case 0xc: /* LDLAR */
2311+ if (!dc_isar_feature(aa64_lor, s)) {
2312+ break;
2313+ }
2314+ /* LoadLOAcquire is the same as Load-Acquire for QEMU. */
2315+ /* fall through */
23042316 case 0xd: /* LDAR */
23052317 /* Generate ISS for non-exclusive accesses including LASR. */
23062318 if (rn == 31) {