diff mbox

[RFC,v3,15/21] target-arm: Store VFP FPSID register in ARMCPUClass

Message ID 1328237992-14953-16-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 3, 2012, 2:59 a.m. UTC
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu-core.h |    3 +++
 target-arm/cpu.c      |   11 +++++++++++
 target-arm/cpu.h      |    1 -
 target-arm/helper.c   |   12 ------------
 4 files changed, 14 insertions(+), 13 deletions(-)

Comments

Peter Maydell Feb. 7, 2012, 5:44 p.m. UTC | #1
On 3 February 2012 02:59, Andreas Färber <afaerber@suse.de> wrote:
> @@ -375,6 +383,7 @@ static const ARMCPUInfo arm_cpus[] = {
>             0x00111142, 0, 0, 0
>         },
>         .cp15_c1_sys = 0x00c50078,
> +        .vfp_fpsid = 0x41034000, /* Guess */
>         .features = ARM_FEATURE(V7) |
>                     ARM_FEATURE(VFP3) |
>                     ARM_FEATURE(VFP_FP16) |

> @@ -55,7 +45,6 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
>         env->cp15.c0_ccsid[2] = 0xf0000000; /* No L2 icache. */
>         break;
>     case ARM_CPUID_CORTEXA9:
> -        env->vfp.xregs[ARM_VFP_FPSID] = 0x41034000; /* Guess */
>         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11110222;
>         env->vfp.xregs[ARM_VFP_MVFR1] = 0x01111111;
>         env->cp15.c0_clid = (1 << 27) | (1 << 24) | 3;

Incidentally, this guess for FPSID is wrong -- it should be 0x41033090 for
the r0p0 we're claiming to model (later revs the bottom nibble is bumped).
I'll send a patch...

-- PMM
diff mbox

Patch

diff --git a/target-arm/cpu-core.h b/target-arm/cpu-core.h
index eac1a03..0b2eb0a 100644
--- a/target-arm/cpu-core.h
+++ b/target-arm/cpu-core.h
@@ -48,6 +48,9 @@  typedef struct ARMCPUClass {
         uint32_t c0_c2[8];
         uint32_t c1_sys;
     } cp15;
+    struct {
+        uint32_t fpsid;
+    } vfp;
     uint64_t jtag_id;
 
     /* Internal CPU feature flags. */
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index bf4b272..7893fa8 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -52,6 +52,7 @@  static void arm_cpu_reset(CPU *c)
 
     /* Genuine reset */
     env->cp15.c1_sys = cpu_class->cp15.c1_sys;
+    env->vfp.xregs[ARM_VFP_FPSID] = cpu_class->vfp.fpsid;
 
 #if defined(CONFIG_USER_ONLY)
     env->uncached_cpsr = ARM_CPU_MODE_USR;
@@ -172,6 +173,7 @@  typedef struct ARMCPUInfo {
     uint32_t cp15_c0_c1[8];
     uint32_t cp15_c0_c2[8];
     uint32_t cp15_c1_sys;
+    uint32_t vfp_fpsid;
     uint32_t features;
     void (*class_init)(ARMCPUClass *klass, const struct ARMCPUInfo *info);
 } ARMCPUInfo;
@@ -260,6 +262,7 @@  static const ARMCPUInfo arm_cpus[] = {
         .id = 0x41069265,
         .cp15_c0_cachetype = 0x1dd20d2,
         .cp15_c1_sys = 0x00090078,
+        .vfp_fpsid = 0x41011090,
         .features = ARM_FEATURE(V5) |
                     ARM_FEATURE(VFP),
     },
@@ -276,6 +279,7 @@  static const ARMCPUInfo arm_cpus[] = {
         .id = 0x4106a262,
         .cp15_c0_cachetype = 0x1dd20d2,
         .cp15_c1_sys = 0x00090078,
+        .vfp_fpsid = 0x410110a0,
         .features = ARM_FEATURE(V5) |
                     ARM_FEATURE(VFP) |
                     ARM_FEATURE(AUXCR),
@@ -302,6 +306,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x141, 0, 0, 0
         },
         .cp15_c1_sys = 0x00050078,
+        .vfp_fpsid = 0x410120b4,
         .features = ARM_FEATURE(V6) |
                     ARM_FEATURE(VFP),
     },
@@ -318,6 +323,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x01141, 0, 0, 0
         },
         .cp15_c1_sys = 0x00050078,
+        .vfp_fpsid = 0x410120b5,
         .features = ARM_FEATURE(V6K) |
                     ARM_FEATURE(VFP) |
                     ARM_FEATURE(VAPA),
@@ -334,6 +340,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x00100011, 0x12002111, 0x11221011, 0x01102131,
             0x141, 0, 0, 0
         },
+        .vfp_fpsid = 0x410120b4,
         .features = ARM_FEATURE(V6K) |
                     ARM_FEATURE(VFP) |
                     ARM_FEATURE(VAPA),
@@ -357,6 +364,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x00111142, 0, 0, 0
         },
         .cp15_c1_sys = 0x00c50078,
+        .vfp_fpsid = 0x410330c0,
         .features = ARM_FEATURE(V7) |
                     ARM_FEATURE(VFP3) |
                     ARM_FEATURE(NEON) |
@@ -375,6 +383,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x00111142, 0, 0, 0
         },
         .cp15_c1_sys = 0x00c50078,
+        .vfp_fpsid = 0x41034000, /* Guess */
         .features = ARM_FEATURE(V7) |
                     ARM_FEATURE(VFP3) |
                     ARM_FEATURE(VFP_FP16) |
@@ -399,6 +408,7 @@  static const ARMCPUInfo arm_cpus[] = {
             0x10011142, 0, 0, 0
         },
         .cp15_c1_sys = 0x00c50078,
+        .vfp_fpsid = 0x410430f0,
         .features = ARM_FEATURE(V7) |
                     ARM_FEATURE(VFP4) |
                     ARM_FEATURE(VFP_FP16) |
@@ -522,6 +532,7 @@  static void arm_cpu_class_init(ObjectClass *klass, void *data)
     memcpy(k->cp15.c0_c1, info->cp15_c0_c1, 8 * sizeof(uint32_t));
     memcpy(k->cp15.c0_c2, info->cp15_c0_c2, 8 * sizeof(uint32_t));
     k->cp15.c1_sys = info->cp15_c1_sys;
+    k->vfp.fpsid = info->vfp_fpsid;
     k->features = info->features;
 
     if (info->class_init != NULL) {
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 32aaa4e..a1630b0 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -403,7 +403,6 @@  void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID(env) (env->cp15.c0_cpuid)
 
 #define ARM_CPUID_ARM1026     0x4106a262
-#define ARM_CPUID_ARM926      0x41069265
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
 #define ARM_CPUID_ARM1136     0x4117b363
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 4a531b8..466519a 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -13,12 +13,6 @@ 
 static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
 {
     switch (id) {
-    case ARM_CPUID_ARM926:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x41011090;
-        break;
-    case ARM_CPUID_ARM1026:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410110a0;
-        break;
     case ARM_CPUID_ARM1136:
         /* This is the 1136 r1, which is a v6K core */
         /* Fall through */
@@ -31,22 +25,18 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
          * for 1136_r2 (in particular r0p2 does not actually implement most
          * of the ID registers).
          */
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410120b4;
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11111111;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x00000000;
         break;
     case ARM_CPUID_ARM1176:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410120b5;
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11111111;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x00000000;
         break;
     case ARM_CPUID_ARM11MPCORE:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410120b4;
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11111111;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x00000000;
         break;
     case ARM_CPUID_CORTEXA8:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410330c0;
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11110222;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x00011100;
         env->cp15.c0_clid = (1 << 27) | (2 << 24) | 3;
@@ -55,7 +45,6 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_ccsid[2] = 0xf0000000; /* No L2 icache. */
         break;
     case ARM_CPUID_CORTEXA9:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x41034000; /* Guess */
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x11110222;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x01111111;
         env->cp15.c0_clid = (1 << 27) | (1 << 24) | 3;
@@ -63,7 +52,6 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_ccsid[1] = 0x200fe015; /* 16k L1 icache. */
         break;
     case ARM_CPUID_CORTEXA15:
-        env->vfp.xregs[ARM_VFP_FPSID] = 0x410430f0;
         env->vfp.xregs[ARM_VFP_MVFR0] = 0x10110222;
         env->vfp.xregs[ARM_VFP_MVFR1] = 0x11111111;
         env->cp15.c0_clid = 0x0a200023;