diff mbox

ARM v4t/arm920t support

Message ID 201007011635.55444.rob@landley.net
State New
Headers show

Commit Message

Rob Landley July 1, 2010, 9:35 p.m. UTC
I just confirmed that Vincent Sanders' patch (which he posted on May 29, 2009,
and again on November 27, 2009) still applies to (and works with )current
qemu-git.

It adds a -cpu arm920t option to qemu-system-arm which boots a Linux kernel
configured with CONFIG_CPU_ARM920T=y, which isn't possible without this patch.

Here is the patch again.  There may be more work to be done on top of this,
but this patch staying out of tree hasn't noticeably accelerated that work in
the past year and change.  Could it please be merged?

Thanks,

Rob

>From 5a242e7cdc76c654d599b482cc85ec5bd85e36a3 Mon Sep 17 00:00:00 2001
From: Vincent Sanders <vince@kyllikki.org>
Date: Fri, 29 May 2009 13:41:16 +0100
Subject: [PATCH] Update ARM emulation to include version 4t.

Update ARM emulation to be version 4t by default and add v5 as a
feature. Implementation is very similar to the way the v6 features are
presented.

The affected instructions and program counter load behaviour are made
CPU version dependant and the ARM920T cpu id is introduced.

Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
---
 target-arm/cpu.h       |    2 ++
 target-arm/helper.c    |   16 ++++++++++++++++
 target-arm/translate.c |   22 +++++++++++++++-------
 3 files changed, 33 insertions(+), 7 deletions(-)

                     tcg_gen_movi_i32(addr, s->pc & ~3);

Comments

Paul Brook July 1, 2010, 9:50 p.m. UTC | #1
> Here is the patch again.  There may be more work to be done on top of this,
> but this patch staying out of tree hasn't noticeably accelerated that work
> in the past year and change.  Could it please be merged?

As mentioned previously, "V5" should be split into its component parts.

Paul
Vincent Sanders July 2, 2010, 9:59 a.m. UTC | #2
On Thu, Jul 01, 2010 at 04:35:53PM -0500, Rob Landley wrote:
> I just confirmed that Vincent Sanders' patch (which he posted on May 29, 2009,
> and again on November 27, 2009) still applies to (and works with )current
> qemu-git.
> 
> It adds a -cpu arm920t option to qemu-system-arm which boots a Linux kernel
> configured with CONFIG_CPU_ARM920T=y, which isn't possible without this patch.
> 
> Here is the patch again.  There may be more work to be done on top of this,
> but this patch staying out of tree hasn't noticeably accelerated that work in
> the past year and change.  Could it please be merged?
> 

Rob, while I apreciate you digging this back up and having another go,
you do not need to explicitly copy me in ;-)

Please feel free to take and run with these changes any way you see
fit (you may interpret that as me giving you copyright, whatever),
just do not include me in the madness!

I have previously stated I have given up trying to do anything
whatsoever for QEMU because Paul seems to think that adding v4t
support means I should clean up and differentiate V5 support etc.

Not to mention that it took two *years* of pain and agro to get Paul
to actually say thats what he wanted in which time I have moved on and
the nine Samsumng platforms I wanted to submit support for are now
yestardays news and the emulations have bitrotted to death.
Rob Landley July 2, 2010, 7:28 p.m. UTC | #3
On Thursday 01 July 2010 16:50:29 Paul Brook wrote:
> > Here is the patch again.  There may be more work to be done on top of
> > this, but this patch staying out of tree hasn't noticeably accelerated
> > that work in the past year and change.  Could it please be merged?
>
> As mentioned previously, "V5" should be split into its component parts.

If this patch needs to be split up/tweaked/polished a bit to be acceptable, 
I'm interested in at least trying to do this work myself, but unfortunately 
the robots.txt file of lists.nongnu.org still prevents Google from indexing the 
mailing list web archive.  Could you give me a hint where "mentioned 
previously" might be found?

Rob
diff mbox

Patch

From vince@kyllikki.org Fri Nov 27 05:17:32 2009
Return-Path: <qemu-devel-bounces+rob=landley.net@nongnu.org>
X-Original-To: rob@landley.net
Delivered-To: landley@grelber.thyrsus.com
Received: from lists.gnu.org (lists.gnu.org [199.232.76.165])
	by grelber.thyrsus.com (Postfix) with ESMTP id 6B20E9F035A
	for <rob@landley.net>; Fri, 27 Nov 2009 06:30:22 -0500 (EST)
Received: from localhost ([127.0.0.1]:42798 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1NDyro-00044k-Bs
	for rob@landley.net; Fri, 27 Nov 2009 06:20:00 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NDypY-00042C-PS
	for qemu-devel@nongnu.org; Fri, 27 Nov 2009 06:17:40 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1NDypW-0003xO-9N
	for qemu-devel@nongnu.org; Fri, 27 Nov 2009 06:17:39 -0500
Received: from [199.232.76.173] (port=37443 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NDypW-0003x6-2y
	for qemu-devel@nongnu.org; Fri, 27 Nov 2009 06:17:38 -0500
Received: from flounder.pepperfish.net ([87.237.62.181]:37700)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <vince@kyllikki.org>) id 1NDypV-0008HQ-CT
	for qemu-devel@nongnu.org; Fri, 27 Nov 2009 06:17:37 -0500
Received: from [10.112.102.2] (helo=jennifer.kyllikki.org)
	by flounder.pepperfish.net with esmtps (Exim 4.69 #1 (Debian))
	id 1NDyp7-0006dE-T6; Fri, 27 Nov 2009 11:17:14 +0000
Received: from derik.kyllikki.org ([192.168.7.20] helo=derik)
	by jennifer.kylikki.org with esmtp (Exim 4.69)
	(envelope-from <vince@kyllikki.org>)
	id 1NDypQ-0008QS-BW; Fri, 27 Nov 2009 11:17:32 +0000
Received: from vince by derik with local (Exim 4.69)
	(envelope-from <vince@kyllikki.org>)
	id 1NDypQ-0003Qu-7Y; Fri, 27 Nov 2009 11:17:32 +0000
Date: Fri, 27 Nov 2009 11:17:32 +0000
From: Vincent Sanders <vince@kyllikki.org>
To: Paul Brook <paul@codesourcery.com>
Message-ID: <20091127111731.GA11982@kyllikki.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.18 (2008-05-17)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] ARM v4t support
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: qemu-devel.nongnu.org
List-Unsubscribe: <http://lists.nongnu.org/mailman/listinfo/qemu-devel>,
	<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <http://lists.nongnu.org/mailman/listinfo/qemu-devel>,
	<mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Sender: qemu-devel-bounces+rob=landley.net@nongnu.org
Errors-To: qemu-devel-bounces+rob=landley.net@nongnu.org
Status: R
X-Status: N
X-KMail-EncryptionState:  
X-KMail-SignatureState:  
X-KMail-MDN-Sent:  

I appear to be unable to take a hint, your silence on this patch in
the past probably ought to have been a clue. however this will be the
last time I bother to try and get anything merged so you wont have to
be disturbed again.

The attached patch adds V4t support to the ARM emulation, its pretty
much the same as the last time it was posted. It is correct in
everything it does to the best of my knowledge however you will as
usual no doubt find a corner case it does not cover and reject it.

---

>From 5a242e7cdc76c654d599b482cc85ec5bd85e36a3 Mon Sep 17 00:00:00 2001
From: Vincent Sanders <vince@kyllikki.org>
Date: Fri, 29 May 2009 13:41:16 +0100
Subject: [PATCH] Update ARM emulation to include version 4t.

Update ARM emulation to be version 4t by default and add v5 as a
feature. Implementation is very similar to the way the v6 features are
presented.

The affected instructions and program counter load behaviour are made
CPU version dependant and the ARM920T cpu id is introduced.

Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
---
 target-arm/cpu.h       |    2 ++
 target-arm/helper.c    |   16 ++++++++++++++++
 target-arm/translate.c |   22 +++++++++++++++-------
 3 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 4a1c53f..6b9a64f 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -334,6 +334,7 @@  enum arm_features {
     ARM_FEATURE_AUXCR,  /* ARM1026 Auxiliary control register.  */
     ARM_FEATURE_XSCALE, /* Intel XScale extensions.  */
     ARM_FEATURE_IWMMXT, /* Intel iwMMXt extension.  */
+    ARM_FEATURE_V5,
     ARM_FEATURE_V6,
     ARM_FEATURE_V6K,
     ARM_FEATURE_V7,
@@ -374,6 +375,7 @@  void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID_ARM1026     0x4106a262
 #define ARM_CPUID_ARM926      0x41069265
 #define ARM_CPUID_ARM946      0x41059461
+#define ARM_CPUID_ARM920T     0x41129200
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
 #define ARM_CPUID_PXA250      0x69052100
diff --git a/target-arm/helper.c b/target-arm/helper.c
index b3aec99..426c544 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -44,18 +44,25 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
 {
     env->cp15.c0_cpuid = id;
     switch (id) {
+    case ARM_CPUID_ARM920T:
+        env->cp15.c0_cachetype = 0x0d172172;
+        env->cp15.c1_sys = 0x00000078;
+        break;
     case ARM_CPUID_ARM926:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_VFP);
         env->vfp.xregs[ARM_VFP_FPSID] = 0x41011090;
         env->cp15.c0_cachetype = 0x1dd20d2;
         env->cp15.c1_sys = 0x00090078;
         break;
     case ARM_CPUID_ARM946:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_MPU);
         env->cp15.c0_cachetype = 0x0f004006;
         env->cp15.c1_sys = 0x00000078;
         break;
     case ARM_CPUID_ARM1026:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_VFP);
         set_feature(env, ARM_FEATURE_AUXCR);
         env->vfp.xregs[ARM_VFP_FPSID] = 0x410110a0;
@@ -64,6 +71,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         break;
     case ARM_CPUID_ARM1136_R2:
     case ARM_CPUID_ARM1136:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_V6);
         set_feature(env, ARM_FEATURE_VFP);
         set_feature(env, ARM_FEATURE_AUXCR);
@@ -75,6 +83,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_cachetype = 0x1dd20d2;
         break;
     case ARM_CPUID_ARM11MPCORE:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_V6);
         set_feature(env, ARM_FEATURE_V6K);
         set_feature(env, ARM_FEATURE_VFP);
@@ -87,6 +96,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_cachetype = 0x1dd20d2;
         break;
     case ARM_CPUID_CORTEXA8:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_V6);
         set_feature(env, ARM_FEATURE_V6K);
         set_feature(env, ARM_FEATURE_V7);
@@ -129,6 +139,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_ccsid[1] = 0x200fe015; /* 16k L1 icache. */
         break;
     case ARM_CPUID_CORTEXM3:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_V6);
         set_feature(env, ARM_FEATURE_THUMB2);
         set_feature(env, ARM_FEATURE_V7);
@@ -136,6 +147,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         set_feature(env, ARM_FEATURE_DIV);
         break;
     case ARM_CPUID_ANY: /* For userspace emulation.  */
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_V6);
         set_feature(env, ARM_FEATURE_V6K);
         set_feature(env, ARM_FEATURE_V7);
@@ -149,6 +161,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         break;
     case ARM_CPUID_TI915T:
     case ARM_CPUID_TI925T:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_OMAPCP);
         env->cp15.c0_cpuid = ARM_CPUID_TI925T; /* Depends on wiring.  */
         env->cp15.c0_cachetype = 0x5109149;
@@ -161,6 +174,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
     case ARM_CPUID_PXA260:
     case ARM_CPUID_PXA261:
     case ARM_CPUID_PXA262:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_XSCALE);
         /* JTAG_ID is ((id << 28) | 0x09265013) */
         env->cp15.c0_cachetype = 0xd172172;
@@ -172,6 +186,7 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
     case ARM_CPUID_PXA270_B1:
     case ARM_CPUID_PXA270_C0:
     case ARM_CPUID_PXA270_C5:
+        set_feature(env, ARM_FEATURE_V5);
         set_feature(env, ARM_FEATURE_XSCALE);
         /* JTAG_ID is ((id << 28) | 0x09265013) */
         set_feature(env, ARM_FEATURE_IWMMXT);
@@ -306,6 +321,7 @@  struct arm_cpu_t {
 };
 
 static const struct arm_cpu_t arm_cpu_names[] = {
+    { ARM_CPUID_ARM920T, "arm920t"},
     { ARM_CPUID_ARM926, "arm926"},
     { ARM_CPUID_ARM946, "arm946"},
     { ARM_CPUID_ARM1026, "arm1026"},
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 45bf772..298cc08 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -34,6 +34,7 @@ 
 #define GEN_HELPER 1
 #include "helpers.h"
 
+#define ENABLE_ARCH_5     arm_feature(env, ARM_FEATURE_V5)
 #define ENABLE_ARCH_5J    0
 #define ENABLE_ARCH_6     arm_feature(env, ARM_FEATURE_V6)
 #define ENABLE_ARCH_6K   arm_feature(env, ARM_FEATURE_V6K)
@@ -6244,7 +6245,7 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
                 tmp = load_reg(s, rm);
                 gen_bx(s, tmp);
             } else if (op1 == 3) {
-                /* clz */
+                ARCH(5); /* clz */
                 rd = (insn >> 12) & 0xf;
                 tmp = load_reg(s, rm);
                 gen_helper_clz(tmp, tmp);
@@ -6267,14 +6268,15 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
             if (op1 != 1)
               goto illegal_op;
 
-            /* branch link/exchange thumb (blx) */
+            ARCH(5); /* branch link/exchange thumb (blx) */
             tmp = load_reg(s, rm);
             tmp2 = new_tmp();
             tcg_gen_movi_i32(tmp2, s->pc);
             store_reg(s, 14, tmp2);
             gen_bx(s, tmp);
             break;
-        case 0x5: /* saturating add/subtract */
+        case 0x5:
+            ARCH(5); /* saturating add/subtract */
             rd = (insn >> 12) & 0xf;
             rn = (insn >> 16) & 0xf;
             tmp = load_reg(s, rm);
@@ -6288,16 +6290,18 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
             dead_tmp(tmp2);
             store_reg(s, rd, tmp);
             break;
-        case 7: /* bkpt */
+        case 7:
+            ARCH(5); /* bkpt */
             gen_set_condexec(s);
             gen_set_pc_im(s->pc - 4);
             gen_exception(EXCP_BKPT);
             s->is_jmp = DISAS_JUMP;
             break;
-        case 0x8: /* signed multiply */
+        case 0x8:
         case 0xa:
         case 0xc:
         case 0xe:
+            ARCH(5); /* signed multiply */
             rs = (insn >> 8) & 0xf;
             rn = (insn >> 12) & 0xf;
             rd = (insn >> 16) & 0xf;
@@ -7076,7 +7080,11 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
                             /* load */
                             tmp = gen_ld32(addr, IS_USER(s));
                             if (i == 15) {
-                                gen_bx(s, tmp);
+                                if (ENABLE_ARCH_5) {
+                                    gen_bx(s, tmp);
+                                } else {
+                                    store_reg(s, i, tmp);
+                                }
                             } else if (user) {
                                 tmp2 = tcg_const_i32(i);
                                 gen_helper_set_user_reg(tmp2, tmp);
@@ -7345,7 +7353,7 @@  static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1)
         if (insn & (1 << 22)) {
             /* Other load/store, table branch.  */
             if (insn & 0x01200000) {
-                /* Load/store doubleword.  */
+                ARCH(5); /* Load/store doubleword.  */
                 if (rn == 15) {
                     addr = new_tmp();
                     tcg_gen_movi_i32(addr, s->pc & ~3);
-- 
1.6.0.4