support 1176, 1136r1's v6k features
cover support 1176, 1136r1's v6k features
This patchset is Jamie's 1176 patch plus one which sits on top of it and adds support for the v6k features in the 1136r1. (I've included Jamie's patch (a) as a convenience to clean the commit comment up and (b) because of this dependency.)
Specifically the 1136r1 is a v6K core and supports TLS registers, CLREX and half and byte wide exclusives. TLS in particular is needed for recent Linux kernels to boot.
(This patch is rowing back a bit from the position I took in earlier discussion of ARM11 feature flags, following some further investigation I did into what cores have what. I haven't bothered to make the WFI instruction actually NOP for 1136r1/1176 as we don't seem to do anything to make it NOP on any core, but we could always add that later if it really seems necessary.)
The other point of note about the 1136r1 is that it doesn't have the VA-to-PA registers, so I've added a new feature flag which splits that out of v6K.
Ideally I'd like to sneak these patches into 0.15, given the "kernel doesn't boot any more" effect of not supporting the 1136r1 TLS registers...
Jamie Iles (1):
target-arm: support for ARM1176JZF-s cores
Peter Maydell (1):
target-arm: Mark 1136r1 as a v6K core
target-arm/cpu.h | 2 ++ target-arm/helper.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/2 target-arm: support for ARM1176JZF-s cores
From: Jamie Iles <[email protected]>
Add support for v6K ARM1176JZF-S. This core includes the VA<->PA translation capability and security extensions.
--- target-arm/cpu.h | 1 + target-arm/helper.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-)
target-arm/cpu.h +1 -0
@@ -414,6 +414,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define ARM_CPUID_PXA270_C5 0x69054117#define ARM_CPUID_ARM1136 0x4117b363#define ARM_CPUID_ARM1136_R2 0x4107b362 +#define ARM_CPUID_ARM1176 0x410fb767#define ARM_CPUID_ARM11MPCORE 0x410fb022#define ARM_CPUID_CORTEXA8 0x410fc080#define ARM_CPUID_CORTEXA9 0x410fc090
target-arm/helper.c +23 -0
@@ -35,6 +35,12 @@ static uint32_t arm1136_cp15_c0_c1[8] =static uint32_t arm1136_cp15_c0_c2[8 ] = {0x00140011 ,0x12002111 ,0x11231111 ,0x01102131 ,0x141 ,0 ,0 ,0 }; +static uint32_t arm1176_cp15_c0_c1[8 ] = +{0x111 ,0x11 ,0x33 ,0 ,0x01130003 ,0x10030302 ,0x01222100 ,0 }; + +static uint32_t arm1176_cp15_c0_c2[8 ] = +{0x0140011 ,0x12002111 ,0x11231121 ,0x01102131 ,0x01141 ,0 ,0 ,0 }; +static uint32_t cpu_arm_find_by_name (const char *name);static inline void set_feature (CPUARMState *env,int feature)
@@ -85,6 +91,21 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id) env->cp15.c0_cachetype =0x1dd20d2 ; env->cp15.c1_sys =0x00050078 ;break ; +case ARM_CPUID_ARM1176 : +set_feature (env,ARM_FEATURE_V4T ); +set_feature (env,ARM_FEATURE_V5 ); +set_feature (env,ARM_FEATURE_V6 ); +set_feature (env,ARM_FEATURE_V6K ); +set_feature (env,ARM_FEATURE_VFP ); +set_feature (env,ARM_FEATURE_AUXCR ); + env->vfp.xregs[ARM_VFP_FPSID ] =0x410120b5 ; + env->vfp.xregs[ARM_VFP_MVFR0 ] =0x11111111 ; + env->vfp.xregs[ARM_VFP_MVFR1 ] =0x00000000 ; +memcpy (env->cp15.c0_c1, arm1176_cp15_c0_c1,8 *sizeof (uint32_t )); +memcpy (env->cp15.c0_c2, arm1176_cp15_c0_c2,8 *sizeof (uint32_t )); + env->cp15.c0_cachetype =0x1dd20d2 ; + env->cp15.c1_sys =0x00050078 ; +break ;case ARM_CPUID_ARM11MPCORE :set_feature (env,ARM_FEATURE_V4T );set_feature (env,ARM_FEATURE_V5 );
@@ -376,6 +397,7 @@ static const struct arm_cpu_t arm_cpu_names[] = { { ARM_CPUID_ARM1026, "arm1026"}, { ARM_CPUID_ARM1136, "arm1136"}, { ARM_CPUID_ARM1136_R2, "arm1136-r2"}, + { ARM_CPUID_ARM1176, "arm1176"}, { ARM_CPUID_ARM11MPCORE, "arm11mpcore"}, { ARM_CPUID_CORTEXM3, "cortex-m3"}, { ARM_CPUID_CORTEXA8, "cortex-a8"},
@@ -1769,6 +1791,7 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)return 1 ;case ARM_CPUID_ARM1136 :case ARM_CPUID_ARM1136_R2 : +case ARM_CPUID_ARM1176 :return 7 ;case ARM_CPUID_ARM11MPCORE :return 1 ;
Signature · 1 line
1.7.4.1
PATCH 2/2 target-arm: Mark 1136r1 as a v6K core
In reply to Peter MaydellThe 1136r1 is actually a v6K core (unlike the 1136r0); mark it as such, thus enabling the TLS registers, NOP hints, CLREX, half and byte wide exclusive load/stores, etc.
The VA-to-PA translation registers are not present on 1136r1, so introduce a new feature flag for them, which is enabled on 1176, 11MPCore and all v7 cores.
--- target-arm/cpu.h | 1 + target-arm/helper.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
target-arm/cpu.h +1 -0
@@ -368,6 +368,7 @@ enum arm_features {ARM_FEATURE_V4T ,ARM_FEATURE_V5 ,ARM_FEATURE_STRONGARM , + ARM_FEATURE_VAPA, /* cp15 VA to PA lookups */ };static inline int arm_feature (CPUARMState *env,int feature)
target-arm/helper.c +20 -2
@@ -76,13 +76,24 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id) env->cp15.c0_cachetype =0x1dd20d2 ; env->cp15.c1_sys =0x00090078 ;break ; -case ARM_CPUID_ARM1136_R2 :case ARM_CPUID_ARM1136 : +/* This is the 1136 r1, which is a v6K core */ +set_feature (env,ARM_FEATURE_V6K ); +/* Fall through */ +case ARM_CPUID_ARM1136_R2 : +/* What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an +* older core than plain "arm1136". In particular this does not +* have the v6K features. +*/ set_feature (env,ARM_FEATURE_V4T );set_feature (env,ARM_FEATURE_V5 );set_feature (env,ARM_FEATURE_V6 );set_feature (env,ARM_FEATURE_VFP );set_feature (env,ARM_FEATURE_AUXCR ); +/* These ID register values are correct for 1136 but may be wrong +* 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 ;
@@ -98,6 +109,7 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)set_feature (env,ARM_FEATURE_V6K );set_feature (env,ARM_FEATURE_VFP );set_feature (env,ARM_FEATURE_AUXCR ); +set_feature (env,ARM_FEATURE_VAPA ); env->vfp.xregs[ARM_VFP_FPSID ] =0x410120b5 ; env->vfp.xregs[ARM_VFP_MVFR0 ] =0x11111111 ; env->vfp.xregs[ARM_VFP_MVFR1 ] =0x00000000 ;
@@ -113,6 +125,7 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)set_feature (env,ARM_FEATURE_V6K );set_feature (env,ARM_FEATURE_VFP );set_feature (env,ARM_FEATURE_AUXCR ); +set_feature (env,ARM_FEATURE_VAPA ); env->vfp.xregs[ARM_VFP_FPSID ] =0x410120b4 ; env->vfp.xregs[ARM_VFP_MVFR0 ] =0x11111111 ; env->vfp.xregs[ARM_VFP_MVFR1 ] =0x00000000 ;
@@ -243,6 +256,11 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)cpu_abort (env,"Bad CPU ID: %x\n" , id);break ; } + +/* Some features automatically imply others: */ +if (arm_feature (env,ARM_FEATURE_V7 )) { +set_feature (env,ARM_FEATURE_VAPA ); + } }void cpu_reset (CPUARMState *env)
@@ -1520,7 +1538,7 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) goto bad_reg; }/* No cache, so nothing to do except VA->PA translations. */ -if (arm_feature (env,ARM_FEATURE_V6K )) { +if (arm_feature (env,ARM_FEATURE_VAPA )) {switch (crm) {case 4 :if (arm_feature (env,ARM_FEATURE_V7 )) {
Signature · 1 line
1.7.4.1