Skip to contentSkip to conversation

target-arm queue

GIT PULL In review Peter Maydell 3 participants 10 messages Jan 25, 2012 – Feb 10, 2012

lore
Share & tools
lore
#0 lore raw

Here's the latest target-arm pullreq. It includes Mark's fix for config_base_register, which is in turn a dependency of the arm-devs pullreq I'm about to send out, and which I'd like to get in before Anthony's QOM patchset lands and invalidates it :-)

Please pull.

-- PMM

The following changes since commit 5b4448d27d7c6ff6e18a1edc8245cb1db783e37c:

Merge remote-tracking branch 'qemu-kvm/uq/master' into staging (2012-01-23 11:00:26 -0600)

are available in the git repository at:

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

Mark Langsdorf (1):
arm: store the config_base_register during cpu_reset

Peter Maydell (4):
target-arm: Fix implementation of TLB invalidate operations target-arm/helper.c: Don't assume softfloat int32 is 32 bits only Add dummy implementation of generic timer cp15 registers Add Cortex-A15 CPU definition

 target-arm/cpu.h    |    2 +
 target-arm/helper.c |   86 ++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 73 insertions(+), 15 deletions(-)
#1 lore raw

PATCH 1/5 target-arm: Fix implementation of TLB invalidate operations

Fix some bugs in the implementation of the TLB invalidate operations on ARM:
* the 'invalidate all' op was not passing flush_global=1 to tlb_flush(); this doesn't have a practical effect since tlb_flush() currently ignores that argument, but is semantically incorrect
* 'invalidate by address for all ASIDs' was implemented as flushing the whole TLB, which invalidates much more than strictly necessary. Use tlb_flush_page() instead.
We also annotate the ops with the ARM ARM official acronyms.

---
 target-arm/helper.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
target-arm/helper.c +6 -7
index 00458fc..f11279e 100644
@@ -1610,18 +1610,17 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
         break;
     case 8: /* MMU TLB control.  */
         switch (op2) {
-        case 0: /* Invalidate all.  */
-            tlb_flush(env, 0);
+        case 0: /* Invalidate all (TLBIALL) */
+            tlb_flush(env, 1);
             break;
-        case 1: /* Invalidate single TLB entry.  */
+        case 1: /* Invalidate single TLB entry by MVA and ASID (TLBIMVA) */
             tlb_flush_page(env, val & TARGET_PAGE_MASK);
             break;
-        case 2: /* Invalidate on ASID.  */
+        case 2: /* Invalidate by ASID (TLBIASID) */
             tlb_flush(env, val == 0);
             break;
-        case 3: /* Invalidate single entry on MVA.  */
-            /* ??? This is like case 1, but ignores ASID.  */
-            tlb_flush(env, 1);
+        case 3: /* Invalidate single entry by MVA, all ASIDs (TLBIMVAA) */
+            tlb_flush_page(env, val & TARGET_PAGE_MASK);
             break;
         default:
             goto bad_reg;
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/5 target-arm/helper.c: Don't assume softfloat int32 is 32 bits only

In reply to Peter Maydell

In the helper routines for VCVT float-to-int conversions, add an explicit cast rather than relying on the softfloat int32 type being exactly 32 bits wide (which it is not guaranteed to be). Without this, if the softfloat type was 64 bits wide we would get zero-extension of the 32 bit value from the ARM register rather than sign-extension, since TCG i32 values are passed as uint32_t.

---
 target-arm/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-arm/helper.c +1 -1
index f11279e..f6e998b 100644
@@ -2785,7 +2785,7 @@ DO_VFP_cmp(d, float64)
     float##fsz HELPER(name)(uint32_t x, void *fpstp) \
 { \
     float_status *fpst = fpstp; \
-    return sign##int32_to_##float##fsz(x, fpst); \
+    return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \
 }
 
 #define CONV_FTOI(name, fsz, sign, round) \
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/5 arm: store the config_base_register during cpu_reset

In reply to Peter Maydell

From: Mark Langsdorf <[email protected]>

Long term, the config_base_register will be a QDM parameter. In the meantime, models that use it need to be able to preserve it across cpu_reset() calls.

---
 target-arm/helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
target-arm/helper.c +3 -0
index f6e998b..22e40fc 100644
@@ -255,6 +255,7 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
 void cpu_reset(CPUARMState *env)
 {
     uint32_t id;
+    uint32_t tmp = 0;
 
     if (qemu_loglevel_mask(CPU_LOG_RESET)) {
         qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
@@ -262,9 +263,11 @@ void cpu_reset(CPUARMState *env)
     }
 
     id = env->cp15.c0_cpuid;
+    tmp = env->cp15.c15_config_base_address;
     memset(env, 0, offsetof(CPUARMState, breakpoints));
     if (id)
         cpu_reset_model_id(env, id);
+    env->cp15.c15_config_base_address = tmp;
 #if defined (CONFIG_USER_ONLY)
     env->uncached_cpsr = ARM_CPU_MODE_USR;
     /* For user mode we must enable access to coprocessors */
Signature · 1 line
1.7.1
#4 lore raw

PATCH 4/5 Add dummy implementation of generic timer cp15 registers

In reply to Peter Maydell

Add a dummy implementation of the cp15 registers for the generic timer (found in the Cortex-A15), just sufficient for Linux to decide that it can't use it. This requires at least CNTP_CTL and CNTFRQ to be implemented as RAZ/WI; we RAZ/WI all of c14.

---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
target-arm/cpu.h +1 -0
index 42c53a7..7442c99 100644
@@ -382,6 +382,7 @@ enum arm_features {
     ARM_FEATURE_VAPA, /* cp15 VA to PA lookups */
     ARM_FEATURE_ARM_DIV, /* divide supported in ARM encoding */
     ARM_FEATURE_VFP4, /* VFPv4 (implies that NEON is v2) */
+    ARM_FEATURE_GENERIC_TIMER,
 };
 
 static inline int arm_feature(CPUARMState *env, int feature)
target-arm/helper.c +10 -2
index 22e40fc..5e7205a 100644
@@ -1764,7 +1764,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
             goto bad_reg;
         }
         break;
-    case 14: /* Reserved.  */
+    case 14: /* Generic timer */
+        if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
+            /* Dummy implementation: RAZ/WI for all */
+            break;
+        }
         goto bad_reg;
     case 15: /* Implementation specific.  */
         if (arm_feature(env, ARM_FEATURE_XSCALE)) {
@@ -2134,7 +2138,11 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
         default:
             goto bad_reg;
         }
-    case 14: /* Reserved.  */
+    case 14: /* Generic timer */
+        if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
+            /* Dummy implementation: RAZ/WI for all */
+            return 0;
+        }
         goto bad_reg;
     case 15: /* Implementation specific.  */
         if (arm_feature(env, ARM_FEATURE_XSCALE)) {
Signature · 1 line
1.7.1
#5 lore raw

PATCH 5/5 Add Cortex-A15 CPU definition

In reply to Peter Maydell

Add a definition of a Cortex-A15 CPU. Note that for the moment we do not implement any of:
* Large Physical Address Extensions (LPAE)
* Virtualization Extensions
* Generic Timer
* TrustZone (this is also true of our existing Cortex-A9 model, etc)

This CPU model is sufficient to boot a Linux kernel which has been compiled for an A15 without LPAE enabled.

---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 5 deletions(-)
target-arm/cpu.h +1 -0
index 7442c99..0d9b39c 100644
@@ -433,6 +433,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID_ARM11MPCORE 0x410fb022
 #define ARM_CPUID_CORTEXA8    0x410fc080
 #define ARM_CPUID_CORTEXA9    0x410fc090
+#define ARM_CPUID_CORTEXA15   0x412fc0f1
 #define ARM_CPUID_CORTEXM3    0x410fc231
 #define ARM_CPUID_ANY         0xffffffff
 
target-arm/helper.c +51 -5

94 lines not on this page · raw message

Signature · 1 line
1.7.1
#6 lore raw

Re: [Qemu-devel] [PATCH 5/5] Add Cortex-A15 CPU definition

Quoted 5 lines

Add a definition of a Cortex-A15 CPU. Note that for the moment we do not implement any of:
* Large Physical Address Extensions (LPAE)
* Virtualization Extensions
* Generic Timer

Are there feature bits that the guest can check before blindly using them? I assume for at least LPAE and the timer there's a way for the OS to test for these features without just poking at them and seing if they explode.

If so it's worth adding coments describing where these diverge from a real A15.

Paul

#7 lore raw

Re: [Qemu-devel] [PATCH 5/5] Add Cortex-A15 CPU definition

Quoted 6 lines · Paul Brook
Quoted 5 lines

Add a definition of a Cortex-A15 CPU. Note that for the moment we do not implement any of:
 * Large Physical Address Extensions (LPAE)
 * Virtualization Extensions
 * Generic Timer

Quoted 6 lines

Are there feature bits that the guest can check before blindly using them?  I assume for at least LPAE and the timer there's a way for the OS to test for these features without just poking at them and seing if they explode.

If so it's worth adding coments describing where these diverge from a real A15.

There are feature bits, yes, but I've followed the general current qemu practice of following the feature bits of the real hardware rather than clearing feature bits for things we don't support (eg for A9 we are currently claiming TrustZone and ThumbEE when neither are actually true for QEMU).

-- PMM

#8 lore raw

Re: [Qemu-devel] [PATCH 5/5] Add Cortex-A15 CPU definition

Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

Add a definition of a Cortex-A15 CPU. Note that for the moment we do not implement any of:
* Large Physical Address Extensions (LPAE)
* Virtualization Extensions
* Generic Timer

Are there feature bits that the guest can check before blindly using them? I assume for at least LPAE and the timer there's a way for the OS to test for these features without just poking at them and seing if they explode.

Quoted 8 lines
Quoted 2 lines

If so it's worth adding coments describing where these diverge from a real A15.

There are feature bits, yes, but I've followed the general current qemu practice of following the feature bits of the real hardware rather than clearing feature bits for things we don't support (eg for A9 we are currently claiming TrustZone and ThumbEE when neither are actually true for QEMU).

These are bugs.

Paul

#9 lore raw
In reply to Peter Maydell
Quoted 6 lines · Peter Maydell

Here's the latest target-arm pullreq. It includes Mark's fix for config_base_register, which is in turn a dependency of the arm-devs pullreq I'm about to send out, and which I'd like to get in before Anthony's QOM patchset lands and invalidates it :-)

Please pull.

Thanks, pulled.

Quoted 23 lines

-- PMM

The following changes since commit 5b4448d27d7c6ff6e18a1edc8245cb1db783e37c:

 Merge remote-tracking branch 'qemu-kvm/uq/master' into staging (2012-01-23 11:00:26 -0600)

are available in the git repository at:

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

Mark Langsdorf (1):
     arm: store the config_base_register during cpu_reset

Peter Maydell (4):
     target-arm: Fix implementation of TLB invalidate operations target-arm/helper.c: Don't assume softfloat int32 is 32 bits only Add dummy implementation of generic timer cp15 registers Add Cortex-A15 CPU definition

 target-arm/cpu.h    |    2 +
 target-arm/helper.c |   86 ++++++++++++++++++++++++++++++++++++++++++---------

 2 files changed, 73 insertions(+), 15 deletions(-)