Skip to contentSkip to conversation

Implement basic part of SA-1110/SA-1100

PATCH In review Dmitry Eremin-Solenikov 3 participants 6 messages Mar 22, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Implement basic part of SA-1110/SA-1100

Basic implementation of DEC/Intel SA-1100/SA-1110 chips emulation. Implemented:
- IRQs
- GPIO
- PPC
- RTC
- UARTs (no IrDA/etc.)
- OST reused from pxa25x

Everything else is TODO (esp. PM/idle/sleep!) - see the todo in the hw/strongarm.c

---
 Makefile.target     |    1 +
 hw/strongarm.c      | 1118 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/strongarm.h      |   62 +++
 hw/strongarm_pic.c  |  153 +++++++
 target-arm/cpu.h    |   16 +-
 target-arm/helper.c |   29 ++
 6 files changed, 1378 insertions(+), 1 deletions(-)
 create mode 100644 hw/strongarm.c
 create mode 100644 hw/strongarm.h
 create mode 100644 hw/strongarm_pic.c
Makefile.target +1 -0
index 62b102a..ddf3008 100644
@@ -328,6 +328,7 @@ obj-arm-y += framebuffer.o
 obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 obj-arm-y += syborg_virtio.o
+obj-arm-y += strongarm.o strongarm_pic.o
 
 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
hw/strongarm.c new file +1118 -0

1,118 lines not on this page · raw message

hw/strongarm.h new file +62 -0

62 lines not on this page · raw message

hw/strongarm_pic.c new file +153 -0

153 lines not on this page · raw message

target-arm/cpu.h +15 -1
index 1ae7982..2338270 100644
@@ -360,7 +360,8 @@ enum arm_features {
     ARM_FEATURE_M, /* Microcontroller profile.  */
     ARM_FEATURE_OMAPCP, /* OMAP specific CP15 ops handling.  */
     ARM_FEATURE_THUMB2EE,
-    ARM_FEATURE_V7MP    /* v7 Multiprocessing Extensions */
+    ARM_FEATURE_V7MP,    /* v7 Multiprocessing Extensions */
+    ARM_FEATURE_STRONGARM,
 };
 
 static inline int arm_feature(CPUARMState *env, int feature)
@@ -391,6 +392,19 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID_ARM946      0x41059461
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
+#define ARM_CPUID_SA1100      0x4401A11B
+#define ARM_CPUID_SA1100_B    0x4401A111
+#define ARM_CPUID_SA1100_C    0x4401A112
+#define ARM_CPUID_SA1100_D    0x4401A118
+#define ARM_CPUID_SA1100_E    0x4401A119
+#define ARM_CPUID_SA1100_G    0x4401A11B
+#define ARM_CPUID_SA1110      0x6901B119
+#define ARM_CPUID_SA1110_A0   0x6901B110
+#define ARM_CPUID_SA1110_B0   0x6901B114
+#define ARM_CPUID_SA1110_B1   0x6901B115
+#define ARM_CPUID_SA1110_B2   0x6901B116
+#define ARM_CPUID_SA1110_B4   0x6901B118
+#define ARM_CPUID_SA1110_B5   0x6901B119
 #define ARM_CPUID_PXA250      0x69052100
 #define ARM_CPUID_PXA255      0x69052d00
 #define ARM_CPUID_PXA260      0x69052903
target-arm/helper.c +29 -0
index 78f3d39..c59e414 100644
@@ -191,6 +191,20 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_cachetype = 0xd172172;
         env->cp15.c1_sys = 0x00000078;
         break;
+    case ARM_CPUID_SA1100_B:
+    case ARM_CPUID_SA1100_C:
+    case ARM_CPUID_SA1100_D:
+    case ARM_CPUID_SA1100_E:
+    case ARM_CPUID_SA1100_G:
+    case ARM_CPUID_SA1110_A0:
+    case ARM_CPUID_SA1110_B0:
+    case ARM_CPUID_SA1110_B1:
+    case ARM_CPUID_SA1110_B2:
+    case ARM_CPUID_SA1110_B4:
+    case ARM_CPUID_SA1110_B5:
+	set_feature(env, ARM_FEATURE_STRONGARM);
+	env->cp15.c1_sys = 0x00000070;
+	break;
     default:
         cpu_abort(env, "Bad CPU ID: %x\n", id);
         break;
@@ -351,6 +365,19 @@ static const struct arm_cpu_t arm_cpu_names[] = {
     { ARM_CPUID_CORTEXA9, "cortex-a9"},
     { ARM_CPUID_TI925T, "ti925t" },
     { ARM_CPUID_PXA250, "pxa250" },
+    { ARM_CPUID_SA1100,    "sa1100" },
+    { ARM_CPUID_SA1100_B,  "sa1100-b" },
+    { ARM_CPUID_SA1100_C,  "sa1100-c" },
+    { ARM_CPUID_SA1100_D,  "sa1100-d" },
+    { ARM_CPUID_SA1100_E,  "sa1100-e" },
+    { ARM_CPUID_SA1100_G,  "sa1100-g" },
+    { ARM_CPUID_SA1110,    "sa1110" },
+    { ARM_CPUID_SA1110_A0, "sa1110-a0" },
+    { ARM_CPUID_SA1110_B0, "sa1110-b0" },
+    { ARM_CPUID_SA1110_B1, "sa1110-b1" },
+    { ARM_CPUID_SA1110_B2, "sa1110-b2" },
+    { ARM_CPUID_SA1110_B4, "sa1110-b4" },
+    { ARM_CPUID_SA1110_B5, "sa1110-b5" },
     { ARM_CPUID_PXA255, "pxa255" },
     { ARM_CPUID_PXA260, "pxa260" },
     { ARM_CPUID_PXA261, "pxa261" },
@@ -1522,6 +1549,8 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
     case 9:
         if (arm_feature(env, ARM_FEATURE_OMAPCP))
             break;
+        if (arm_feature(env, ARM_FEATURE_STRONGARM))
+            break; /* Ignore ReadBuffer access */
         switch (crm) {
         case 0: /* Cache lockdown.  */
 	    switch (op1) {
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 Basic implementation of Sharp Zaurus SL-5500 collie PDA

Add very basic implementation of collie PDA emulation. The system lacks LoCoMo and graphics/sound emulation. Linux kernel boots up to mounting rootfs (theoretically it can be provided in pflash images).

---
 Makefile.target |    1 +
 hw/collie.c     |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100644 hw/collie.c
Makefile.target +1 -0
index ddf3008..66a003b 100644
@@ -329,6 +329,7 @@ obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 obj-arm-y += syborg_virtio.o
 obj-arm-y += strongarm.o strongarm_pic.o
+obj-arm-y += collie.o
 
 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
hw/collie.c new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw
In reply to Dmitry Eremin-Solenikov
Quoted 11 lines · Dmitry Eremin-Solenikov

 static inline int arm_feature(CPUARMState *env, int feature)

target-arm/cpu.h +6 -0
@@ -391,6 +392,19 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
  #define ARM_CPUID_ARM946      0x41059461
  #define ARM_CPUID_TI915T      0x54029152
  #define ARM_CPUID_TI925T      0x54029252
+#define ARM_CPUID_SA1100      0x4401A11B
+#define ARM_CPUID_SA1100_B    0x4401A111
+#define ARM_CPUID_SA1100_C    0x4401A112
+#define ARM_CPUID_SA1100_D    0x4401A118
+#define ARM_CPUID_SA1100_E    0x4401A119
+#define ARM_CPUID_SA1100_G    0x4401A11B

target-arm/cpu.h void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, · line 410

Quoted 10 lines
target-arm/cpu.h +7 -0
+#define ARM_CPUID_SA1110      0x6901B119
+#define ARM_CPUID_SA1110_A0   0x6901B110
+#define ARM_CPUID_SA1110_B0   0x6901B114
+#define ARM_CPUID_SA1110_B1   0x6901B115
+#define ARM_CPUID_SA1110_B2   0x6901B116
+#define ARM_CPUID_SA1110_B4   0x6901B118
+#define ARM_CPUID_SA1110_B5   0x6901B119
  #define ARM_CPUID_PXA250      0x69052100
  #define ARM_CPUID_PXA255      0x69052d00
  #define ARM_CPUID_PXA260      0x69052903

Yikes. Do we really need 13 new strongarm CPU types? That's half again as many as we currently have defined for ARM CPUs of all flavours.

Quoted 9 lines
(quoted diff) +0 -0
@@ -1522,6 +1549,8 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)

    case 9:
        if (arm_feature(env, ARM_FEATURE_OMAPCP)) break;
+        if (arm_feature(env, ARM_FEATURE_STRONGARM))
+            break; /* Ignore ReadBuffer access */ switch (crm) {
        case 0: /* Cache lockdown.  */
           switch (op1) {

I know we don't really have very good infrastructure for handling device-specific cp15 registers, but I'm not sure defining a new FEATURE_STRONGARM is the right approach here. (Yeah, it's just following ARM_FEATURE_OMAPCP but I don't like that either :-)) I'll have a think about whether we can do something cleaner in this area (and indeed with the translate-time access checks).

PS: CODING_STYLE mandates braces on all if statements...

-- PMM

#3 lore raw

Hello,

Quoted 20 lines · Peter Maydell
Quoted 17 lines · Dmitry Eremin-Solenikov

static inline int arm_feature(CPUARMState *env, int feature)

target-arm/cpu.h +12 -0
@@ -391,6 +392,19 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID_ARM946      0x41059461
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
+#define ARM_CPUID_SA1100      0x4401A11B
+#define ARM_CPUID_SA1100_B    0x4401A111
+#define ARM_CPUID_SA1100_C    0x4401A112
+#define ARM_CPUID_SA1100_D    0x4401A118
+#define ARM_CPUID_SA1100_E    0x4401A119
+#define ARM_CPUID_SA1100_G    0x4401A11B
+#define ARM_CPUID_SA1110      0x6901B119
+#define ARM_CPUID_SA1110_A0   0x6901B110
+#define ARM_CPUID_SA1110_B0   0x6901B114
+#define ARM_CPUID_SA1110_B1   0x6901B115
+#define ARM_CPUID_SA1110_B2   0x6901B116
+#define ARM_CPUID_SA1110_B4   0x6901B118
Quoted 8 lines

target-arm/cpu.h void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, · line 410

Quoted 4 lines
target-arm/cpu.h +1 -0
+#define ARM_CPUID_SA1110_B5   0x6901B119
 #define ARM_CPUID_PXA250      0x69052100
 #define ARM_CPUID_PXA255      0x69052d00
 #define ARM_CPUID_PXA260      0x69052903

Yikes. Do we really need 13 new strongarm CPU types? That's half again as many as we currently have defined for ARM CPUs of all flavours.

Just followed (more or less) PXA model. What do you suggest? Leave only the latest ones?

Quoted 10 lines
Quoted 10 lines
target-arm/helper.c +2 -0
@@ -1522,6 +1549,8 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn,
 uint32_t val)
    case 9:
        if (arm_feature(env, ARM_FEATURE_OMAPCP))
            break;
+        if (arm_feature(env, ARM_FEATURE_STRONGARM))
+            break; /* Ignore ReadBuffer access */
        switch (crm) {
        case 0: /* Cache lockdown.  */
Quoted 8 lines
Quoted 1 line
           switch (op1) {

I know we don't really have very good infrastructure for handling device-specific cp15 registers, but I'm not sure defining a new FEATURE_STRONGARM is the right approach here. (Yeah, it's just following ARM_FEATURE_OMAPCP but I don't like that either :-)) I'll have a think about whether we can do something cleaner in this area (and indeed with the translate-time access checks).

Yeah, OMAPCP, XSCALE and IWMMX. Basically I'd need to plug into cp15 regs: c9 (this one), c15 (later, idle/wait for interrupt) and maybe c14 (debug: hwbp, data watch).

Quoted 1 line

PS: CODING_STYLE mandates braces on all if statements...

Looking around the code it doesn't seem so mandatory... I'll try fixing my patches though.

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw
In reply to Dmitry Eremin-Solenikov
Quoted 1 line · Dmitry Eremin-Solenikov

Basic implementation of DEC/Intel SA-1100/SA-1110 chips emulation.

The other important point is that these cores are ARMv4, and at the moment target-arm/ kind of assumes ARMv5. I believe there have been patches proposed before to add ARMv4 support, eg
http://patchwork.ozlabs.org/patch/36841/

Rough list of things that need to be done:
* make sure we don't ever switch to thumb mode (and for v4T make sure we switch to thumb mode only for BX)
* undef on instructions that are new in v5
* support base-updated abort model (not actually needed for StrongARM)

Have I missed anything?

-- PMM

#5 lore raw
In reply to Dmitry Eremin-Solenikov

hw/strongarm.c line 103

Quoted 3 lines · Dmitry Eremin-Solenikov
hw/strongarm.c new file +3 -0
+static inline void strongarm_rtc_alarm_tick(void *opaque)
+{
+    StrongARMRTCState *s = (StrongARMRTCState *) opaque;

cast is not needed. Just a NOP in C. (lost of places)

hw/strongarm.c line 230

Quoted 3 lines
hw/strongarm.c new file +3 -0
+static const VMStateDescription vmstate_strongarm_rtc_regs = {
+    .name = "strongarm-rtc",
+    .version_id = 0,

New devices should be added with version 0. You add them with version 1 in a several places.

hw/strongarm_pic.c line 136

Quoted 12 lines
hw/strongarm_pic.c new file +12 -0
+static VMStateDescription vmstate_strongarm_pic_regs = {
+    .name = "strongarm_pic",
+    .version_id = 0,
+    .minimum_version_id = 0,
+    .minimum_version_id_old = 0,
+    .post_load = strongarm_pic_post_load,
+    .fields = (VMStateField[]) {
+//        VMSTATE_UINT32_ARRAY(int_enabled, StrongARMPICState, 2),
+//        VMSTATE_UINT32_ARRAY(int_pending, StrongARMPICState, 2),
+//        VMSTATE_UINT32_ARRAY(is_fiq, StrongARMPICState, 2),
+//        VMSTATE_UINT32(int_idle, StrongARMPICState),
+//        VMSTATE_UINT32_ARRAY(priority, StrongARMPICState, PXA2XX_PIC_SRCS),

This looks fishy. You implement savevm for this device, or you don't O:-)

Rest of vmstate stuff look right. (I didn't look at the other stuff, though).

Later, Juan.