Skip to contentSkip to conversation

arm: Steps towards EL2 support round 6

PATCH Applied Edgar E. Iglesias 2 participants 3 messages May 5, 2016 – May 16, 2016

lore
Share & tools
lore
#0 lore raw

v4 cover arm: Steps towards EL2 support round 6

From: "Edgar E. Iglesias" <[email protected]>

Hi,

Another round of patches towards EL2 support. This one adds partial Instruction Syndrome generation for Data Aborts while running in AArch64.

I don't feel very confident with the way I collect the regsize info used to fill out the SF field. Feedback on that would be great.

Once we sort out the details on how this should be implemented we can fill out the parts needed for AArch32. Possibly in a future version of this same series.

Comments welcome!

Best regards,
Edgar

ChangeLog v3 -> v4
* Assert that we only set the syndrome template once per insn
* Mask out upper six bits from syndrome template
* Remove the _with_isv versions of do_gpr_ld/st
* Mention that we only handle AArch64 in the commit message

ChangeLog:
v2 -> v3:
* Commented on inst start extra words
* Add macro for word2 shift
* Move ISS field collection closer to tcg_gen_qemu_ld/st
* Changed logic to compute regsize for disas_ld_lit
* Introduce syn_data_abort_with_iss/no_iss
* Rename some isv naming to iss
* Drop the patch: "Use isyn.swstep.ex to hold the is_ldex state"

v1 -> v2:
* Reworked the syndrome generation code to reuse syn_data_abort for the encoding.
* Reworded a bunch of comments.
* Fixed thumb vs 16bit IL field issue.

Edgar E. Iglesias (1):
target-arm: A64: Create Instruction Syndromes for Data Aborts

 target-arm/cpu.h           |  14 ++++-
 target-arm/op_helper.c     |  49 ++++++++++++++--
 target-arm/translate-a64.c | 140 ++++++++++++++++++++++++++++++++++++++-------
 target-arm/translate.c     |   5 +-
 target-arm/translate.h     |   2 +
 5 files changed, 180 insertions(+), 30 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH v4 1/1 target-arm: A64: Create Instruction Syndromes for Data Aborts

From: "Edgar E. Iglesias" <[email protected]>

Add support for generating the ISS (Instruction Specific Syndrome) for Data Abort exceptions taken from AArch64.
These syndromes are used by hypervisors for example to trap and emulate memory accesses.

We save the decoded data out-of-band with the TBs at translation time. When exceptions hit, the extra data attached to the TB is used to recreate the state needed to encode instruction syndromes. This avoids the need to emit moves with every load/store.

Based on a suggestion from Peter Maydell.

---
 target-arm/cpu.h           |  14 ++++-
 target-arm/op_helper.c     |  49 ++++++++++++++--
 target-arm/translate-a64.c | 140 ++++++++++++++++++++++++++++++++++++++-------
 target-arm/translate.c     |   5 +-
 target-arm/translate.h     |   2 +
 5 files changed, 180 insertions(+), 30 deletions(-)
target-arm/cpu.h +13 -1
index 066ff67..dea9bab 100644
@@ -94,7 +94,19 @@
 struct arm_boot_info;
 
 #define NB_MMU_MODES 7
-#define TARGET_INSN_START_EXTRA_WORDS 1
+/* ARM-specific extra insn start words:
+ * 1: Conditional execution bits
+ * 2: Partial exception syndrome for data aborts
+ */
+#define TARGET_INSN_START_EXTRA_WORDS 2
+
+/* The 2nd extra word holding syndrome info for data aborts does not use
+ * the upper 6 bits nor the lower 14 bits. We mask and shift it down to
+ * help the sleb128 encoder do a better job.
+ * When restoring the CPU state, we shift it back up.
+ */
+#define ARM_INSN_START_WORD2_MASK ((1 << 26) - 1)
+#define ARM_INSN_START_WORD2_SHIFT 14
 
 /* We currently assume float and double are IEEE single and double
    precision respectively.
target-arm/op_helper.c +43 -6

73 lines not on this page · raw message

target-arm/translate-a64.c +118 -22

246 lines not on this page · raw message

target-arm/translate.c +4 -1
index 940ec8d..594cbfc 100644
@@ -11724,7 +11724,8 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb)
       }
     do {
         tcg_gen_insn_start(dc->pc,
-                           (dc->condexec_cond << 4) | (dc->condexec_mask >> 1));
+                           (dc->condexec_cond << 4) | (dc->condexec_mask >> 1),
+                           0);
         num_insns++;
 
 #ifdef CONFIG_USER_ONLY
@@ -12041,8 +12042,10 @@ void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb,
     if (is_a64(env)) {
         env->pc = data[0];
         env->condexec_bits = 0;
+        env->exception.syndrome = data[2] << ARM_INSN_START_WORD2_SHIFT;
     } else {
         env->regs[15] = data[0];
         env->condexec_bits = data[1];
+        env->exception.syndrome = data[2] << ARM_INSN_START_WORD2_SHIFT;
     }
 }
target-arm/translate.h +2 -0
index 6a18d7b..dbd7ac8 100644
@@ -59,6 +59,8 @@ typedef struct DisasContext {
     bool ss_same_el;
     /* Bottom two bits of XScale c15_cpar coprocessor access control reg */
     int c15_cpar;
+    /* TCG op index of the current insn_start.  */
+    int insn_start_idx;
 #define TMP_A64_MAX 16
     int tmp_a64_count;
     TCGv_i64 tmp_a64[TMP_A64_MAX];
Signature · 1 line
2.5.0
#2 lore raw
In reply to Edgar E. Iglesias
Quoted 7 lines · Edgar E. Iglesias

From: "Edgar E. Iglesias" <[email protected]>

Hi,

Another round of patches towards EL2 support. This one adds partial Instruction Syndrome generation for Data Aborts while running in AArch64.

Quoted 6 lines

I don't feel very confident with the way I collect the regsize info used to fill out the SF field. Feedback on that would be great.

Once we sort out the details on how this should be implemented we can fill out the parts needed for AArch32. Possibly in a future version of this same series.

Applied to target-arm.next, thanks.

-- PMM