Skip to contentSkip to conversation

target-arm queue

GIT PULL New Peter Maydell 2 participants 6 messages Apr 19, 2013 – Apr 20, 2013

lore
Share & tools
lore
#0 lore raw

target-arm pullreq, containing a fix for a dumb SRS bug I introduced, and the update to migration to use vmstate (both of which have been on the list since before freeze). Please pull.

thanks
-- PMM

The following changes since commit 09dada400328d75daf79e3eca1e48e024fec148d:

configure: remove duplicate test (2013-04-18 14:12:31 +0200)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git target-arm.next

for you to fetch changes up to e91f229a253f489f6d12b946ad7bdcdc158c5b67:

target-arm: Correctly restore FPSCR (2013-04-19 12:24:19 +0100)

----------------------------------------------------------------
Juan Quintela (1):
target-arm: port ARM CPU save/load to use VMState

Peter Chubb (1):
target-arm: Reinsert missing return statement in ARM mode SRS decode

Peter Maydell (2):
target-arm: Add some missing CPU state fields to VMState
target-arm: Correctly restore FPSCR

 target-arm/cpu-qom.h   |    4 +
 target-arm/cpu.c       |    1 +
 target-arm/cpu.h       |    2 -
 target-arm/machine.c   |  430 ++++++++++++++++++++++++------------------------
 target-arm/translate.c |    1 +
 5 files changed, 222 insertions(+), 216 deletions(-)
#1 lore raw

PATCH 1/4 target-arm: Reinsert missing return statement in ARM mode SRS decode

From: Peter Chubb <[email protected]>

Since patch
81465888c5306cd94abb9847e560796fd13d3c2f
target-arm: factor out handling of SRS instruction
the ARM mode SRS instruction has not worked in QEMU.

The problem is a missing return directive that was removed in the refactoring, so after decoding the instruction, qemu would fall through to generate an UNDEF exception for an illegal instruction.

---
 target-arm/translate.c |    1 +
 1 file changed, 1 insertion(+)
target-arm/translate.c +1 -0
index 35a21be..a1b7b8c 100644
@@ -6762,6 +6762,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
             }
             ARCH(6);
             gen_srs(s, (insn & 0x1f), (insn >> 23) & 3, insn & (1 << 21));
+            return;
         } else if ((insn & 0x0e50ffe0) == 0x08100a00) {
             /* rfe */
             int32_t offset;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 target-arm: port ARM CPU save/load to use VMState

In reply to Peter Maydell

From: Juan Quintela <[email protected]>

Port the ARM CPU save/load code to use VMState. Some state is saved in a slightly different order to simplify things -- for example arrays are saved one after the other rather than 'striped', and we always save all 32 VFP registers even if the CPU happens to only have 16.

Use one subsection for each feature. This means that we don't need to bump the version field each time that a new feature gets introduced.

[PMM: fixed conflicts, updated to use cpu_class_set_vmsd(), updated
with new/removed fields since original patch, changed to use custom VMStateInfo for cpsr rather than presave/postload hooks, corrected subsection names so vmload doesn't fail]

---
 target-arm/cpu-qom.h |    4 +
 target-arm/cpu.c     |    1 +
 target-arm/cpu.h     |    2 -
 target-arm/machine.c |  387 +++++++++++++++++++++++---------------------------
 4 files changed, 179 insertions(+), 215 deletions(-)
target-arm/cpu-qom.h +4 -0
index 2589550..12fcefe 100644
@@ -111,6 +111,10 @@ static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
 
 #define ENV_OFFSET offsetof(ARMCPU, env)
 
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_arm_cpu;
+#endif
+
 void register_cp_regs_for_features(ARMCPU *cpu);
 
 void arm_cpu_do_interrupt(CPUState *cpu);
target-arm/cpu.c +1 -0
index a1e9093..496a59f 100644
@@ -814,6 +814,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
 
     cc->class_by_name = arm_cpu_class_by_name;
     cc->do_interrupt = arm_cpu_do_interrupt;
+    cpu_class_set_vmsd(cc, &vmstate_arm_cpu);
 }
 
 static void cpu_register(const ARMCPUInfo *info)
target-arm/cpu.h +0 -2
index 2b97221..5438444 100644
@@ -640,8 +640,6 @@ static inline CPUARMState *cpu_init(const char *cpu_model)
 #define cpu_signal_handler cpu_arm_signal_handler
 #define cpu_list arm_cpu_list
 
-#define CPU_SAVE_VERSION 9
-
 /* MMU modes definitions */
 #define MMU_MODE0_SUFFIX _kernel
 #define MMU_MODE1_SUFFIX _user
target-arm/machine.c +174 -213

411 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 target-arm: Add some missing CPU state fields to VMState

In reply to Peter Maydell

A number of CPU state fields were accidentally omitted from our migration state: some OMAP specific cp15 registers, and some related to state for load/store exclusive insns. Add them.

---
 target-arm/machine.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
target-arm/machine.c +10 -3
index 3c41f06..2dd48d7 100644
@@ -116,9 +116,9 @@ static const VMStateInfo vmstate_cpsr = {
 
 const VMStateDescription vmstate_arm_cpu = {
     .name = "cpu",
-    .version_id = 10,
-    .minimum_version_id = 10,
-    .minimum_version_id_old = 10,
+    .version_id = 11,
+    .minimum_version_id = 11,
+    .minimum_version_id_old = 11,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(env.regs, ARMCPU, 16),
         {
@@ -172,9 +172,16 @@ const VMStateDescription vmstate_arm_cpu = {
         VMSTATE_UINT32(env.cp15.c13_tls2, ARMCPU),
         VMSTATE_UINT32(env.cp15.c13_tls3, ARMCPU),
         VMSTATE_UINT32(env.cp15.c15_cpar, ARMCPU),
+        VMSTATE_UINT32(env.cp15.c15_ticonfig, ARMCPU),
+        VMSTATE_UINT32(env.cp15.c15_i_max, ARMCPU),
+        VMSTATE_UINT32(env.cp15.c15_i_min, ARMCPU),
+        VMSTATE_UINT32(env.cp15.c15_threadid, ARMCPU),
         VMSTATE_UINT32(env.cp15.c15_power_control, ARMCPU),
         VMSTATE_UINT32(env.cp15.c15_diagnostic, ARMCPU),
         VMSTATE_UINT32(env.cp15.c15_power_diagnostic, ARMCPU),
+        VMSTATE_UINT32(env.exclusive_addr, ARMCPU),
+        VMSTATE_UINT32(env.exclusive_val, ARMCPU),
+        VMSTATE_UINT32(env.exclusive_high, ARMCPU),
         VMSTATE_UINT64(env.features, ARMCPU),
         VMSTATE_END_OF_LIST()
     },
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 target-arm: Correctly restore FPSCR

In reply to Peter Maydell

Use the helper functions to save and restore the FPSCR, so that we correctly propagate rounding mode and flushing behaviour into the float_status fields. This also allows us to stop saving the vector length/stride fields separately.

---
 target-arm/machine.c |   48 +++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 41 insertions(+), 7 deletions(-)
target-arm/machine.c +41 -7
index 2dd48d7..4dd057c 100644
@@ -9,17 +9,51 @@ static bool vfp_needed(void *opaque)
     return arm_feature(env, ARM_FEATURE_VFP);
 }
 
+static int get_fpscr(QEMUFile *f, void *opaque, size_t size)
+{
+    ARMCPU *cpu = opaque;
+    CPUARMState *env = &cpu->env;
+    uint32_t val = qemu_get_be32(f);
+
+    vfp_set_fpscr(env, val);
+    return 0;
+}
+
+static void put_fpscr(QEMUFile *f, void *opaque, size_t size)
+{
+    ARMCPU *cpu = opaque;
+    CPUARMState *env = &cpu->env;
+
+    qemu_put_be32(f, vfp_get_fpscr(env));
+}
+
+static const VMStateInfo vmstate_fpscr = {
+    .name = "fpscr",
+    .get = get_fpscr,
+    .put = put_fpscr,
+};
+
 static const VMStateDescription vmstate_vfp = {
     .name = "cpu/vfp",
-    .version_id = 1,
-    .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
+    .version_id = 2,
+    .minimum_version_id = 2,
+    .minimum_version_id_old = 2,
     .fields = (VMStateField[]) {
         VMSTATE_FLOAT64_ARRAY(env.vfp.regs, ARMCPU, 32),
-        VMSTATE_UINT32_ARRAY(env.vfp.xregs, ARMCPU, 16),
-        /* TODO: Should use proper FPSCR access functions.  */
-        VMSTATE_INT32(env.vfp.vec_len, ARMCPU),
-        VMSTATE_INT32(env.vfp.vec_stride, ARMCPU),
+        /* The xregs array is a little awkward because element 1 (FPSCR)
+         * requires a specific accessor, so we have to split it up in
+         * the vmstate:
+         */
+        VMSTATE_UINT32(env.vfp.xregs[0], ARMCPU),
+        VMSTATE_UINT32_SUB_ARRAY(env.vfp.xregs, ARMCPU, 2, 14),
+        {
+            .name = "fpscr",
+            .version_id = 0,
+            .size = sizeof(uint32_t),
+            .info = &vmstate_fpscr,
+            .flags = VMS_SINGLE,
+            .offset = 0,
+        },
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to Peter Maydell

Thanks, pulled.

Quoted 37 lines · Peter Maydell

target-arm pullreq, containing a fix for a dumb SRS bug I introduced, and the update to migration to use vmstate (both of which have been on the list since before freeze). Please pull.

thanks
-- PMM

The following changes since commit 09dada400328d75daf79e3eca1e48e024fec148d:

configure: remove duplicate test (2013-04-18 14:12:31 +0200)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git target-arm.next

for you to fetch changes up to e91f229a253f489f6d12b946ad7bdcdc158c5b67:

target-arm: Correctly restore FPSCR (2013-04-19 12:24:19 +0100)

----------------------------------------------------------------
Juan Quintela (1):
target-arm: port ARM CPU save/load to use VMState

Peter Chubb (1):
target-arm: Reinsert missing return statement in ARM mode SRS decode

Peter Maydell (2):
target-arm: Add some missing CPU state fields to VMState
target-arm: Correctly restore FPSCR

 target-arm/cpu-qom.h   |    4 +
 target-arm/cpu.c       |    1 +
 target-arm/cpu.h       |    2 -
 target-arm/machine.c   |  430 ++++++++++++++++++++++++------------------------
 target-arm/translate.c |    1 +
 5 files changed, 222 insertions(+), 216 deletions(-)