All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15
@ 2012-01-24 12:39 Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers Peter Maydell
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

This patchset adds support for (a rather limited version of) the
Cortex-A15 CPU and the Versatile Express A15 daughterboard.
The resulting model is capable of booting a Linux kernel which has
been configured for Cortex-A15 with the Versatile Express "extended
memory map" and without support for LPAE.

The patchset is based on top of arm-devs.next to avoid the conflict
with the arm_boot patches in the Highbank series.

Changes since v1 (nothing substantive):
 * dropped patches which are now in master
 * reshuffled the patches to put the target-arm ones at the front
 * minor formatting changes as suggested by Andreas
 * arm_boot patch tweaked to sit on top of arm-devs.next

Peter Maydell (9):
  Add dummy implementation of generic timer cp15 registers
  Add Cortex-A15 CPU definition
  hw/a15mpcore.c: Add Cortex-A15 private peripheral model
  hw/vexpress.c: Make motherboard peripheral memory map table-driven
  hw/vexpress.c: Move secondary CPU boot code to SRAM
  hw/vexpress.c: Factor out daughterboard-specific initialization
  hw/vexpress.c: Instantiate the motherboard CLCD
  arm_boot: Pass base address of GIC CPU interface, not whole GIC
  hw/vexpress.c: Add vexpress-a15 machine

 Makefile.target     |    2 +-
 hw/a15mpcore.c      |   93 ++++++++++++
 hw/arm-misc.h       |    2 +-
 hw/arm_boot.c       |    8 +-
 hw/realview.c       |   12 +-
 hw/vexpress.c       |  410 +++++++++++++++++++++++++++++++++++++++++----------
 target-arm/cpu.h    |    2 +
 target-arm/helper.c |   68 ++++++++-
 8 files changed, 498 insertions(+), 99 deletions(-)
 create mode 100644 hw/a15mpcore.c

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 12:37   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition Peter Maydell
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 42c53a7..d71d310 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -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_GENERICTIMER,
 };
 
 static inline int arm_feature(CPUARMState *env, int feature)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 00458fc..ecba0c6 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1762,7 +1762,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_GENERICTIMER)) {
+            /* Dummy implementation: RAZ/WI for all */
+            break;
+        }
         goto bad_reg;
     case 15: /* Implementation specific.  */
         if (arm_feature(env, ARM_FEATURE_XSCALE)) {
@@ -2132,7 +2136,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_GENERICTIMER)) {
+            /* Dummy implementation: RAZ/WI for all */
+            return 0;
+        }
         goto bad_reg;
     case 15: /* Implementation specific.  */
         if (arm_feature(env, ARM_FEATURE_XSCALE)) {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 12:31   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model Peter Maydell
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index d71d310..7597467 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -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
 
diff --git a/target-arm/helper.c b/target-arm/helper.c
index ecba0c6..2751165 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -10,6 +10,16 @@
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
 #endif
+#include "sysemu.h"
+
+static uint32_t cortexa15_cp15_c0_c1[8] = {
+    0x00001131, 0x00011011, 0x02010555, 0x00000000,
+    0x10201105, 0x20000000, 0x01240000, 0x02102211
+};
+
+static uint32_t cortexa15_cp15_c0_c2[8] = {
+    0x02101110, 0x13112111, 0x21232041, 0x11112131, 0x10011142, 0, 0, 0
+};
 
 static uint32_t cortexa9_cp15_c0_c1[8] =
 { 0x1031, 0x11, 0x000, 0, 0x00100103, 0x20000000, 0x01230000, 0x00002111 };
@@ -158,6 +168,27 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
         env->cp15.c0_ccsid[1] = 0x200fe015; /* 16k L1 icache. */
         env->cp15.c1_sys = 0x00c50078;
         break;
+    case ARM_CPUID_CORTEXA15:
+        set_feature(env, ARM_FEATURE_V7);
+        set_feature(env, ARM_FEATURE_VFP4);
+        set_feature(env, ARM_FEATURE_VFP_FP16);
+        set_feature(env, ARM_FEATURE_NEON);
+        set_feature(env, ARM_FEATURE_THUMB2EE);
+        set_feature(env, ARM_FEATURE_ARM_DIV);
+        set_feature(env, ARM_FEATURE_V7MP);
+        set_feature(env, ARM_FEATURE_GENERICTIMER);
+        env->vfp.xregs[ARM_VFP_FPSID] = 0x410430f0;
+        env->vfp.xregs[ARM_VFP_MVFR0] = 0x10110222;
+        env->vfp.xregs[ARM_VFP_MVFR1] = 0x11111111;
+        memcpy(env->cp15.c0_c1, cortexa15_cp15_c0_c1, 8 * sizeof(uint32_t));
+        memcpy(env->cp15.c0_c2, cortexa15_cp15_c0_c2, 8 * sizeof(uint32_t));
+        env->cp15.c0_cachetype = 0x8444c004;
+        env->cp15.c0_clid = 0x0a200023;
+        env->cp15.c0_ccsid[0] = 0x701fe00a; /* 32K L1 dcache */
+        env->cp15.c0_ccsid[1] = 0x201fe00a; /* 32K L1 icache */
+        env->cp15.c0_ccsid[2] = 0x711fe07a; /* 4096K L2 unified cache */
+        env->cp15.c1_sys = 0x00c50078;
+        break;
     case ARM_CPUID_CORTEXM3:
         set_feature(env, ARM_FEATURE_V7);
         set_feature(env, ARM_FEATURE_M);
@@ -413,6 +444,7 @@ static const struct arm_cpu_t arm_cpu_names[] = {
     { ARM_CPUID_CORTEXM3, "cortex-m3"},
     { ARM_CPUID_CORTEXA8, "cortex-a8"},
     { ARM_CPUID_CORTEXA9, "cortex-a9"},
+    { ARM_CPUID_CORTEXA15, "cortex-a15" },
     { ARM_CPUID_TI925T, "ti925t" },
     { ARM_CPUID_PXA250, "pxa250" },
     { ARM_CPUID_SA1100,    "sa1100" },
@@ -667,8 +699,6 @@ uint32_t HELPER(get_r13_banked)(CPUState *env, uint32_t mode)
 
 #else
 
-extern int semihosting_enabled;
-
 /* Map CPU modes onto saved register banks.  */
 static inline int bank_number(CPUState *env, int mode)
 {
@@ -1943,6 +1973,7 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
             case ARM_CPUID_CORTEXA8:
                 return 2;
             case ARM_CPUID_CORTEXA9:
+            case ARM_CPUID_CORTEXA15:
                 return 0;
             default:
                 goto bad_reg;
@@ -2063,11 +2094,26 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
                     goto bad_reg;
                 }
             case 1: /* L2 cache */
-                if (crm != 0) {
+                /* L2 Lockdown and Auxiliary control.  */
+                switch (op2) {
+                case 0:
+                    /* L2 cache lockdown (A8 only) */
+                    return 0;
+                case 2:
+                    /* L2 cache auxiliary control (A8) or control (A15) */
+                    if (ARM_CPUID(env) == ARM_CPUID_CORTEXA15) {
+                        /* Linux wants the number of processors from here.
+                         * Might as well set the interrupt-controller bit too.
+                         */
+                        return ((smp_cpus - 1) << 24) | (1 << 23);
+                    }
+                    return 0;
+                case 3:
+                    /* L2 cache extended control (A15) */
+                    return 0;
+                default:
                     goto bad_reg;
                 }
-                /* L2 Lockdown and Auxiliary control.  */
-                return 0;
             default:
                 goto bad_reg;
             }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 16:08   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven Peter Maydell
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

Add a model of the Cortex-A15 memory mapped private peripheral
space. This is fairly simple because the only memory mapped
bit of the A15 is the GIC.

Note that we don't currently model a VGIC and therefore don't
map the VGIC related bits of the GIC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 Makefile.target |    2 +-
 hw/a15mpcore.c  |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+), 1 deletions(-)
 create mode 100644 hw/a15mpcore.c

diff --git a/Makefile.target b/Makefile.target
index 38b0c4d..dd0867f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -336,7 +336,7 @@ obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
 obj-arm-y += versatile_pci.o
 obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
 obj-arm-y += arm_l2x0.o
-obj-arm-y += arm_mptimer.o
+obj-arm-y += arm_mptimer.o a15mpcore.o
 obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
 obj-arm-y += highbank.o
 obj-arm-y += pl061.o
diff --git a/hw/a15mpcore.c b/hw/a15mpcore.c
new file mode 100644
index 0000000..fbbf2dc
--- /dev/null
+++ b/hw/a15mpcore.c
@@ -0,0 +1,93 @@
+/*
+ * Cortex-A15MPCore internal peripheral emulation.
+ *
+ * Copyright (c) 2012 Linaro Limited.
+ * Written by Peter Maydell.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "sysbus.h"
+
+/* Configuration for arm_gic.c:
+ * max number of CPUs, how to ID current CPU
+ */
+#define NCPU 4
+
+static inline int gic_get_current_cpu(void)
+{
+  return cpu_single_env->cpu_index;
+}
+
+#include "arm_gic.c"
+
+/* A15MP private memory region.  */
+
+typedef struct A15MPPrivState {
+    gic_state gic;
+    uint32_t num_cpu;
+    uint32_t num_irq;
+    MemoryRegion container;
+} A15MPPrivState;
+
+static int a15mp_priv_init(SysBusDevice *dev)
+{
+    A15MPPrivState *s = FROM_SYSBUSGIC(A15MPPrivState, dev);
+
+    if (s->num_cpu > NCPU) {
+        hw_error("a15mp_priv_init: num-cpu may not be more than %d\n", NCPU);
+    }
+
+    gic_init(&s->gic, s->num_cpu, s->num_irq);
+
+    /* Memory map (addresses are offsets from PERIPHBASE):
+     *  0x0000-0x0fff -- reserved
+     *  0x1000-0x1fff -- GIC Distributor
+     *  0x2000-0x2fff -- GIC CPU interface
+     *  0x4000-0x4fff -- GIC virtual interface control (not modelled)
+     *  0x5000-0x5fff -- GIC virtual interface control (not modelled)
+     *  0x6000-0x7fff -- GIC virtual CPU interface (not modelled)
+     */
+    memory_region_init(&s->container, "a15mp-priv-container", 0x8000);
+    memory_region_add_subregion(&s->container, 0x1000, &s->gic.iomem);
+    memory_region_add_subregion(&s->container, 0x2000, &s->gic.cpuiomem[0]);
+
+    sysbus_init_mmio(dev, &s->container);
+    return 0;
+}
+
+static SysBusDeviceInfo a15mp_priv_info = {
+    .init = a15mp_priv_init,
+    .qdev.name  = "a15mpcore_priv",
+    .qdev.size  = sizeof(A15MPPrivState),
+    /* We currently have no savable state outside the common GIC state */
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_UINT32("num-cpu", A15MPPrivState, num_cpu, 1),
+        /* The Cortex-A15MP may have anything from 0 to 224 external interrupt
+         * IRQ lines (with another 32 internal). We default to 64+32, which
+         * is the number provided by the Cortex-A15MP test chip in the
+         * Versatile Express A15 development board.
+         * Other boards may differ and should set this property appropriately.
+         */
+        DEFINE_PROP_UINT32("num-irq", A15MPPrivState, num_irq, 96),
+        DEFINE_PROP_END_OF_LIST(),
+    }
+};
+
+static void a15mp_register_devices(void)
+{
+    sysbus_register_withprop(&a15mp_priv_info);
+}
+
+device_init(a15mp_register_devices)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (2 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 16:59   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 5/9] hw/vexpress.c: Move secondary CPU boot code to SRAM Peter Maydell
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

Pull the addresses used for mapping motherboard peripherals into
memory out into a table. This will allow us to simply provide a
second table to implement the "Cortex-A Series" memory map used by
the A15 variant of Versatile Express, as well as the current
"Legacy" map used by A9.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/vexpress.c |  137 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 103 insertions(+), 34 deletions(-)

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 64fab45..8c4d3b3 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -31,13 +31,80 @@
 #include "exec-memory.h"
 
 #define SMP_BOOT_ADDR 0xe0000000
-#define SMP_BOOTREG_ADDR 0x10000030
 
 #define VEXPRESS_BOARD_ID 0x8e0
 
 static struct arm_boot_info vexpress_binfo = {
     .smp_loader_start = SMP_BOOT_ADDR,
-    .smp_bootreg_addr = SMP_BOOTREG_ADDR,
+};
+
+/* Address maps for peripherals:
+ * the Versatile Express motherboard has two possible maps,
+ * the "legacy" one (used for A9) and the "Cortex-A Series"
+ * map (used for newer cores).
+ * Individual daughterboards can also have different maps for
+ * their peripherals.
+ */
+
+enum {
+    VE_SYSREGS,
+    VE_SP810,
+    VE_SERIALPCI,
+    VE_PL041,
+    VE_MMCI,
+    VE_KMI0,
+    VE_KMI1,
+    VE_UART0,
+    VE_UART1,
+    VE_UART2,
+    VE_UART3,
+    VE_WDT,
+    VE_TIMER01,
+    VE_TIMER23,
+    VE_SERIALDVI,
+    VE_RTC,
+    VE_COMPACTFLASH,
+    VE_CLCD,
+    VE_NORFLASH0,
+    VE_NORFLASH0ALIAS,
+    VE_NORFLASH1,
+    VE_SRAM,
+    VE_VIDEORAM,
+    VE_ETHERNET,
+    VE_USB,
+    VE_DAPROM,
+};
+
+static target_phys_addr_t motherboard_legacy_map[] = {
+    /* CS7: 0x10000000 .. 0x10020000 */
+    [VE_SYSREGS] = 0x10000000,
+    [VE_SP810] = 0x10001000,
+    [VE_SERIALPCI] = 0x10002000,
+    [VE_PL041] = 0x10004000,
+    [VE_MMCI] = 0x10005000,
+    [VE_KMI0] = 0x10006000,
+    [VE_KMI1] = 0x10007000,
+    [VE_UART0] = 0x10009000,
+    [VE_UART1] = 0x1000a000,
+    [VE_UART2] = 0x1000b000,
+    [VE_UART3] = 0x1000c000,
+    [VE_WDT] = 0x1000f000,
+    [VE_TIMER01] = 0x10011000,
+    [VE_TIMER23] = 0x10012000,
+    [VE_SERIALDVI] = 0x10016000,
+    [VE_RTC] = 0x10017000,
+    [VE_COMPACTFLASH] = 0x1001a000,
+    [VE_CLCD] = 0x1001f000,
+    /* CS0: 0x40000000 .. 0x44000000 */
+    [VE_NORFLASH0] = 0x40000000,
+    /* CS1: 0x44000000 .. 0x48000000 */
+    [VE_NORFLASH1] = 0x44000000,
+    /* CS2: 0x48000000 .. 0x4a000000 */
+    [VE_SRAM] = 0x48000000,
+    /* CS3: 0x4c000000 .. 0x50000000 */
+    [VE_VIDEORAM] = 0x4c000000,
+    [VE_ETHERNET] = 0x4e000000,
+    [VE_USB] = 0x4f000000,
 };
 
 static void vexpress_a9_init(ram_addr_t ram_size,
@@ -61,6 +128,7 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     uint32_t proc_id;
     uint32_t sys_id;
     ram_addr_t low_ram_size, vram_size, sram_size;
+    target_phys_addr_t *map = motherboard_legacy_map;
 
     if (!cpu_model) {
         cpu_model = "cortex-a9";
@@ -116,53 +184,53 @@ static void vexpress_a9_init(ram_addr_t ram_size,
         pic[n] = qdev_get_gpio_in(dev, n);
     }
 
-    /* Motherboard peripherals CS7 : 0x10000000 .. 0x10020000 */
+    /* Motherboard peripherals: the wiring is the same but the
+     * addresses vary between the legacy and A-Series memory maps.
+     */
+
     sys_id = 0x1190f500;
     proc_id = 0x0c000191;
 
-    /* 0x10000000 System registers */
     sysctl = qdev_create(NULL, "realview_sysctl");
     qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
     qdev_init_nofail(sysctl);
     qdev_prop_set_uint32(sysctl, "proc_id", proc_id);
-    sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, 0x10000000);
+    sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, map[VE_SYSREGS]);
+
+    /* VE_SP810: not modelled */
+    /* VE_SERIALPCI: not modelled */
 
-    /* 0x10001000 SP810 system control */
-    /* 0x10002000 serial bus PCI */
-    /* 0x10004000 PL041 audio */
     pl041 = qdev_create(NULL, "pl041");
     qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512);
     qdev_init_nofail(pl041);
-    sysbus_mmio_map(sysbus_from_qdev(pl041), 0, 0x10004000);
+    sysbus_mmio_map(sysbus_from_qdev(pl041), 0, map[VE_PL041]);
     sysbus_connect_irq(sysbus_from_qdev(pl041), 0, pic[11]);
 
-    dev = sysbus_create_varargs("pl181", 0x10005000, pic[9], pic[10], NULL);
+    dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL);
     /* Wire up MMC card detect and read-only signals */
     qdev_connect_gpio_out(dev, 0,
                           qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
     qdev_connect_gpio_out(dev, 1,
                           qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));
 
-    sysbus_create_simple("pl050_keyboard", 0x10006000, pic[12]);
-    sysbus_create_simple("pl050_mouse", 0x10007000, pic[13]);
-
-    sysbus_create_simple("pl011", 0x10009000, pic[5]);
-    sysbus_create_simple("pl011", 0x1000a000, pic[6]);
-    sysbus_create_simple("pl011", 0x1000b000, pic[7]);
-    sysbus_create_simple("pl011", 0x1000c000, pic[8]);
+    sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]);
+    sysbus_create_simple("pl050_mouse", map[VE_KMI1], pic[13]);
 
-    /* 0x1000f000 SP805 WDT */
+    sysbus_create_simple("pl011", map[VE_UART0], pic[5]);
+    sysbus_create_simple("pl011", map[VE_UART1], pic[6]);
+    sysbus_create_simple("pl011", map[VE_UART2], pic[7]);
+    sysbus_create_simple("pl011", map[VE_UART3], pic[8]);
 
-    sysbus_create_simple("sp804", 0x10011000, pic[2]);
-    sysbus_create_simple("sp804", 0x10012000, pic[3]);
+    sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]);
+    sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]);
 
-    /* 0x10016000 Serial Bus DVI */
+    /* VE_SERIALDVI: not modelled */
 
-    sysbus_create_simple("pl031", 0x10017000, pic[4]); /* RTC */
+    sysbus_create_simple("pl031", map[VE_RTC], pic[4]); /* RTC */
 
-    /* 0x1001a000 Compact Flash */
+    /* VE_COMPACTFLASH: not modelled */
 
-    /* 0x1001f000 PL111 CLCD (motherboard) */
+    /* VE_CLCD: not modelled (we use the daughterboard CLCD only) */
 
     /* Daughterboard peripherals : 0x10020000 .. 0x20000000 */
 
@@ -184,28 +252,28 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     /* 0x1e00a000 PL310 L2 Cache Controller */
     sysbus_create_varargs("l2x0", 0x1e00a000, NULL);
 
-    /* CS0: NOR0 flash          : 0x40000000 .. 0x44000000 */
-    /* CS4: NOR1 flash          : 0x44000000 .. 0x48000000 */
-    /* CS2: SRAM                : 0x48000000 .. 0x4a000000 */
+    /* VE_NORFLASH0: not modelled */
+    /* VE_NORFLASH0ALIAS: not modelled */
+    /* VE_NORFLASH1: not modelled */
+
     sram_size = 0x2000000;
     memory_region_init_ram(sram, "vexpress.sram", sram_size);
     vmstate_register_ram_global(sram);
-    memory_region_add_subregion(sysmem, 0x48000000, sram);
-
-    /* CS3: USB, ethernet, VRAM : 0x4c000000 .. 0x50000000 */
+    memory_region_add_subregion(sysmem, map[VE_SRAM], sram);
 
-    /* 0x4c000000 Video RAM */
     vram_size = 0x800000;
     memory_region_init_ram(vram, "vexpress.vram", vram_size);
     vmstate_register_ram_global(vram);
-    memory_region_add_subregion(sysmem, 0x4c000000, vram);
+    memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram);
 
     /* 0x4e000000 LAN9118 Ethernet */
     if (nd_table[0].vlan) {
-        lan9118_init(&nd_table[0], 0x4e000000, pic[15]);
+        lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]);
     }
 
-    /* 0x4f000000 ISP1761 USB */
+    /* VE_USB: not modelled */
+
+    /* VE_DAPROM: not modelled */
 
     /* ??? Hack to map an additional page of ram for the secondary CPU
        startup code.  I guess this works on real hardware because the
@@ -222,6 +290,7 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     vexpress_binfo.nb_cpus = smp_cpus;
     vexpress_binfo.board_id = VEXPRESS_BOARD_ID;
     vexpress_binfo.loader_start = 0x60000000;
+    vexpress_binfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
     arm_load_kernel(first_cpu, &vexpress_binfo);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 5/9] hw/vexpress.c: Move secondary CPU boot code to SRAM
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (3 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization Peter Maydell
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

On real Versatile Express hardware, the boot ROM puts the secondary
CPU bootcode/holding pen in SRAM. We can therefore rely on Linux not
trashing this memory until secondary CPUs have booted up, and can
put our QEMU-specific pen code in the same place. This allows us to
drop the odd "hack" RAM page we were using before.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/vexpress.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 8c4d3b3..99a9690 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -30,13 +30,9 @@
 #include "boards.h"
 #include "exec-memory.h"
 
-#define SMP_BOOT_ADDR 0xe0000000
-
 #define VEXPRESS_BOARD_ID 0x8e0
 
-static struct arm_boot_info vexpress_binfo = {
-    .smp_loader_start = SMP_BOOT_ADDR,
-};
+static struct arm_boot_info vexpress_binfo;
 
 /* Address maps for peripherals:
  * the Versatile Express motherboard has two possible maps,
@@ -118,7 +114,6 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     MemoryRegion *lowram = g_new(MemoryRegion, 1);
     MemoryRegion *vram = g_new(MemoryRegion, 1);
     MemoryRegion *sram = g_new(MemoryRegion, 1);
-    MemoryRegion *hackram = g_new(MemoryRegion, 1);
     DeviceState *dev, *sysctl, *pl041;
     SysBusDevice *busdev;
     qemu_irq *irqp;
@@ -275,14 +270,6 @@ static void vexpress_a9_init(ram_addr_t ram_size,
 
     /* VE_DAPROM: not modelled */
 
-    /* ??? Hack to map an additional page of ram for the secondary CPU
-       startup code.  I guess this works on real hardware because the
-       BootROM happens to be in ROM/flash or in memory that isn't clobbered
-       until after Linux boots the secondary CPUs.  */
-    memory_region_init_ram(hackram, "vexpress.hack", 0x1000);
-    vmstate_register_ram_global(hackram);
-    memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, hackram);
-
     vexpress_binfo.ram_size = ram_size;
     vexpress_binfo.kernel_filename = kernel_filename;
     vexpress_binfo.kernel_cmdline = kernel_cmdline;
@@ -290,6 +277,7 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     vexpress_binfo.nb_cpus = smp_cpus;
     vexpress_binfo.board_id = VEXPRESS_BOARD_ID;
     vexpress_binfo.loader_start = 0x60000000;
+    vexpress_binfo.smp_loader_start = map[VE_SRAM];
     vexpress_binfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
     arm_load_kernel(first_cpu, &vexpress_binfo);
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (4 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 5/9] hw/vexpress.c: Move secondary CPU boot code to SRAM Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 18:04   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD Peter Maydell
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

Factor out daughterboard specifics into a data structure and
daughterboard initialization function, in preparation for adding
vexpress-a15 support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/vexpress.c |  118 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 83 insertions(+), 35 deletions(-)

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 99a9690..9033b50 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -103,32 +103,43 @@ static target_phys_addr_t motherboard_legacy_map[] = {
     [VE_USB] = 0x4f000000,
 };
 
-static void vexpress_a9_init(ram_addr_t ram_size,
-                     const char *boot_device,
-                     const char *kernel_filename, const char *kernel_cmdline,
-                     const char *initrd_filename, const char *cpu_model)
+/* Structure defining the peculiarities of a specific daughterboard */
+
+typedef struct VEDBoardInfo VEDBoardInfo;
+
+typedef void DBoardInitFn(const VEDBoardInfo *daughterboard,
+                          ram_addr_t ram_size,
+                          const char *cpu_model,
+                          qemu_irq *pic, uint32_t *proc_id);
+
+struct VEDBoardInfo {
+    const target_phys_addr_t *motherboard_map;
+    const target_phys_addr_t loader_start;
+    DBoardInitFn *init;
+};
+
+static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
+                                  ram_addr_t ram_size,
+                                  const char *cpu_model,
+                                  qemu_irq *pic, uint32_t *proc_id)
 {
     CPUState *env = NULL;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *lowram = g_new(MemoryRegion, 1);
-    MemoryRegion *vram = g_new(MemoryRegion, 1);
-    MemoryRegion *sram = g_new(MemoryRegion, 1);
-    DeviceState *dev, *sysctl, *pl041;
+    DeviceState *dev;
     SysBusDevice *busdev;
     qemu_irq *irqp;
-    qemu_irq pic[64];
     int n;
     qemu_irq cpu_irq[4];
-    uint32_t proc_id;
-    uint32_t sys_id;
-    ram_addr_t low_ram_size, vram_size, sram_size;
-    target_phys_addr_t *map = motherboard_legacy_map;
+    ram_addr_t low_ram_size;
 
     if (!cpu_model) {
         cpu_model = "cortex-a9";
     }
 
+    *proc_id = 0x0c000191;
+
     for (n = 0; n < smp_cpus; n++) {
         env = cpu_init(cpu_model);
         if (!env) {
@@ -141,7 +152,7 @@ static void vexpress_a9_init(ram_addr_t ram_size,
 
     if (ram_size > 0x40000000) {
         /* 1GB is the maximum the address space permits */
-        fprintf(stderr, "vexpress: cannot model more than 1GB RAM\n");
+        fprintf(stderr, "vexpress-a9: cannot model more than 1GB RAM\n");
         exit(1);
     }
 
@@ -179,12 +190,58 @@ static void vexpress_a9_init(ram_addr_t ram_size,
         pic[n] = qdev_get_gpio_in(dev, n);
     }
 
+    /* Daughterboard peripherals : 0x10020000 .. 0x20000000 */
+
+    /* 0x10020000 PL111 CLCD (daughterboard) */
+    sysbus_create_simple("pl111", 0x10020000, pic[44]);
+
+    /* 0x10060000 AXI RAM */
+    /* 0x100e0000 PL341 Dynamic Memory Controller */
+    /* 0x100e1000 PL354 Static Memory Controller */
+    /* 0x100e2000 System Configuration Controller */
+
+    sysbus_create_simple("sp804", 0x100e4000, pic[48]);
+    /* 0x100e5000 SP805 Watchdog module */
+    /* 0x100e6000 BP147 TrustZone Protection Controller */
+    /* 0x100e9000 PL301 'Fast' AXI matrix */
+    /* 0x100ea000 PL301 'Slow' AXI matrix */
+    /* 0x100ec000 TrustZone Address Space Controller */
+    /* 0x10200000 CoreSight debug APB */
+    /* 0x1e00a000 PL310 L2 Cache Controller */
+    sysbus_create_varargs("l2x0", 0x1e00a000, NULL);
+}
+
+static const VEDBoardInfo a9_daughterboard = {
+    .motherboard_map = motherboard_legacy_map,
+    .loader_start = 0x60000000,
+    .init = a9_daughterboard_init,
+};
+
+static void vexpress_common_init(const VEDBoardInfo *daughterboard,
+                                 ram_addr_t ram_size,
+                                 const char *boot_device,
+                                 const char *kernel_filename,
+                                 const char *kernel_cmdline,
+                                 const char *initrd_filename,
+                                 const char *cpu_model)
+{
+    DeviceState *dev, *sysctl, *pl041;
+    qemu_irq pic[64];
+    uint32_t proc_id;
+    uint32_t sys_id;
+    ram_addr_t vram_size, sram_size;
+    MemoryRegion *sysmem = get_system_memory();
+    MemoryRegion *vram = g_new(MemoryRegion, 1);
+    MemoryRegion *sram = g_new(MemoryRegion, 1);
+    const target_phys_addr_t *map = daughterboard->motherboard_map;
+
+    daughterboard->init(daughterboard, ram_size, cpu_model, pic, &proc_id);
+
     /* Motherboard peripherals: the wiring is the same but the
      * addresses vary between the legacy and A-Series memory maps.
      */
 
     sys_id = 0x1190f500;
-    proc_id = 0x0c000191;
 
     sysctl = qdev_create(NULL, "realview_sysctl");
     qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
@@ -227,26 +284,6 @@ static void vexpress_a9_init(ram_addr_t ram_size,
 
     /* VE_CLCD: not modelled (we use the daughterboard CLCD only) */
 
-    /* Daughterboard peripherals : 0x10020000 .. 0x20000000 */
-
-    /* 0x10020000 PL111 CLCD (daughterboard) */
-    sysbus_create_simple("pl111", 0x10020000, pic[44]);
-
-    /* 0x10060000 AXI RAM */
-    /* 0x100e0000 PL341 Dynamic Memory Controller */
-    /* 0x100e1000 PL354 Static Memory Controller */
-    /* 0x100e2000 System Configuration Controller */
-
-    sysbus_create_simple("sp804", 0x100e4000, pic[48]);
-    /* 0x100e5000 SP805 Watchdog module */
-    /* 0x100e6000 BP147 TrustZone Protection Controller */
-    /* 0x100e9000 PL301 'Fast' AXI matrix */
-    /* 0x100ea000 PL301 'Slow' AXI matrix */
-    /* 0x100ec000 TrustZone Address Space Controller */
-    /* 0x10200000 CoreSight debug APB */
-    /* 0x1e00a000 PL310 L2 Cache Controller */
-    sysbus_create_varargs("l2x0", 0x1e00a000, NULL);
-
     /* VE_NORFLASH0: not modelled */
     /* VE_NORFLASH0ALIAS: not modelled */
     /* VE_NORFLASH1: not modelled */
@@ -276,12 +313,23 @@ static void vexpress_a9_init(ram_addr_t ram_size,
     vexpress_binfo.initrd_filename = initrd_filename;
     vexpress_binfo.nb_cpus = smp_cpus;
     vexpress_binfo.board_id = VEXPRESS_BOARD_ID;
-    vexpress_binfo.loader_start = 0x60000000;
+    vexpress_binfo.loader_start = daughterboard->loader_start;
     vexpress_binfo.smp_loader_start = map[VE_SRAM];
     vexpress_binfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
     arm_load_kernel(first_cpu, &vexpress_binfo);
 }
 
+static void vexpress_a9_init(ram_addr_t ram_size,
+                             const char *boot_device,
+                             const char *kernel_filename,
+                             const char *kernel_cmdline,
+                             const char *initrd_filename,
+                             const char *cpu_model)
+{
+    vexpress_common_init(&a9_daughterboard,
+                         ram_size, boot_device, kernel_filename,
+                         kernel_cmdline, initrd_filename, cpu_model);
+}
 
 static QEMUMachine vexpress_a9_machine = {
     .name = "vexpress-a9",
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (5 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 18:28   ` Andreas Färber
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 8/9] arm_boot: Pass base address of GIC CPU interface, not whole GIC Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine Peter Maydell
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

Instantiate the CLCD on the vexpress motherboard as well as one on
the daughterboard -- the A15 daughterboard does not have a CLCD
and so relies on the motherboard one.

At the moment QEMU doesn't provide infrastructure for selecting
which display device gets to actually show graphics -- the first
one registered is it. Fortunately this works for the major use
case (Linux): if the daughterboard has a CLCD it will come first
and be used, otherwise we fall back to the motherboard CLCD.
So we don't (currently) need to implement the control register
which allows software to tell the mux which video output to pass
through to the outside world.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/vexpress.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 9033b50..9860085 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -282,7 +282,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
 
     /* VE_COMPACTFLASH: not modelled */
 
-    /* VE_CLCD: not modelled (we use the daughterboard CLCD only) */
+    sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
 
     /* VE_NORFLASH0: not modelled */
     /* VE_NORFLASH0ALIAS: not modelled */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 8/9] arm_boot: Pass base address of GIC CPU interface, not whole GIC
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (6 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine Peter Maydell
  8 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

The arm_boot secondary boot loader code needs the address of
the GIC CPU interface. Obtaining this from the base address
of the private peripheral region was possible for A9 and 11MPcore,
but the A15 puts the GIC CPU interface in a different place.
So make boards pass in the GIC CPU interface address directly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm-misc.h |    2 +-
 hw/arm_boot.c |    8 ++++----
 hw/realview.c |   12 +++++++-----
 hw/vexpress.c |    6 ++++--
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 5e5204b..306013a 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -37,7 +37,7 @@ struct arm_boot_info {
      */
     target_phys_addr_t smp_loader_start;
     target_phys_addr_t smp_bootreg_addr;
-    target_phys_addr_t smp_priv_base;
+    target_phys_addr_t gic_cpu_if_addr;
     int nb_cpus;
     int board_id;
     int (*atag_board)(const struct arm_boot_info *info, void *p);
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 5f163fd..4637636 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -43,16 +43,16 @@ static uint32_t bootloader[] = {
  * location for the kernel secondary CPU entry point.
  */
 static uint32_t smpboot[] = {
-  0xe59f201c, /* ldr r2, privbase */
+  0xe59f201c, /* ldr r2, gic_cpu_if */
   0xe59f001c, /* ldr r0, startaddr */
   0xe3a01001, /* mov r1, #1 */
-  0xe5821100, /* str r1, [r2, #256] */
+  0xe5821000, /* str r1, [r2] */
   0xe320f003, /* wfi */
   0xe5901000, /* ldr     r1, [r0] */
   0xe1110001, /* tst     r1, r1 */
   0x0afffffb, /* beq     <wfi> */
   0xe12fff11, /* bx      r1 */
-  0,          /* privbase: Private memory region base address.  */
+  0,          /* gic_cpu_if: base address of GIC CPU interface */
   0           /* bootreg: Boot register address is held here */
 };
 
@@ -61,7 +61,7 @@ static void default_write_secondary(CPUState *env,
 {
     int n;
     smpboot[ARRAY_SIZE(smpboot) - 1] = info->smp_bootreg_addr;
-    smpboot[ARRAY_SIZE(smpboot) - 2] = info->smp_priv_base;
+    smpboot[ARRAY_SIZE(smpboot) - 2] = info->gic_cpu_if_addr;
     for (n = 0; n < ARRAY_SIZE(smpboot); n++) {
         smpboot[n] = tswap32(smpboot[n]);
     }
diff --git a/hw/realview.c b/hw/realview.c
index d2fde44..9adc46d 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -214,21 +214,23 @@ static void realview_init(ram_addr_t ram_size,
     sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, 0x10000000);
 
     if (is_mpcore) {
+        target_phys_addr_t periphbase;
         dev = qdev_create(NULL, is_pb ? "a9mpcore_priv": "realview_mpcore");
         qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
         qdev_init_nofail(dev);
         busdev = sysbus_from_qdev(dev);
         if (is_pb) {
-            realview_binfo.smp_priv_base = 0x1f000000;
+            periphbase = 0x1f000000;
         } else {
-            realview_binfo.smp_priv_base = 0x10100000;
+            periphbase = 0x10100000;
         }
-        sysbus_mmio_map(busdev, 0, realview_binfo.smp_priv_base);
+        sysbus_mmio_map(busdev, 0, periphbase);
         for (n = 0; n < smp_cpus; n++) {
             sysbus_connect_irq(busdev, n, cpu_irq[n]);
         }
-        sysbus_create_varargs("l2x0", realview_binfo.smp_priv_base + 0x2000,
-                              NULL);
+        sysbus_create_varargs("l2x0", periphbase + 0x2000, NULL);
+        /* Both A9 and 11MPCore put the GIC CPU i/f at base + 0x100 */
+        realview_binfo.gic_cpu_if_addr = periphbase + 0x100;
     } else {
         uint32_t gic_addr = is_pb ? 0x1e000000 : 0x10040000;
         /* For now just create the nIRQ GIC, and ignore the others.  */
diff --git a/hw/vexpress.c b/hw/vexpress.c
index 9860085..4b9454f 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -115,6 +115,7 @@ typedef void DBoardInitFn(const VEDBoardInfo *daughterboard,
 struct VEDBoardInfo {
     const target_phys_addr_t *motherboard_map;
     const target_phys_addr_t loader_start;
+    const target_phys_addr_t gic_cpu_if_addr;
     DBoardInitFn *init;
 };
 
@@ -175,8 +176,7 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
     qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
     qdev_init_nofail(dev);
     busdev = sysbus_from_qdev(dev);
-    vexpress_binfo.smp_priv_base = 0x1e000000;
-    sysbus_mmio_map(busdev, 0, vexpress_binfo.smp_priv_base);
+    sysbus_mmio_map(busdev, 0, 0x1e000000);
     for (n = 0; n < smp_cpus; n++) {
         sysbus_connect_irq(busdev, n, cpu_irq[n]);
     }
@@ -214,6 +214,7 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,
 static const VEDBoardInfo a9_daughterboard = {
     .motherboard_map = motherboard_legacy_map,
     .loader_start = 0x60000000,
+    .gic_cpu_if_addr = 0x1e000100,
     .init = a9_daughterboard_init,
 };
 
@@ -316,6 +317,7 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard,
     vexpress_binfo.loader_start = daughterboard->loader_start;
     vexpress_binfo.smp_loader_start = map[VE_SRAM];
     vexpress_binfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
+    vexpress_binfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr;
     arm_load_kernel(first_cpu, &vexpress_binfo);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine
  2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
                   ` (7 preceding siblings ...)
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 8/9] arm_boot: Pass base address of GIC CPU interface, not whole GIC Peter Maydell
@ 2012-01-24 12:39 ` Peter Maydell
  2012-01-25 18:15   ` Andreas Färber
  8 siblings, 1 reply; 21+ messages in thread
From: Peter Maydell @ 2012-01-24 12:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, patches

Add the vexpress-a15 machine, and the A-Series memory map it uses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/vexpress.c |  141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 141 insertions(+), 0 deletions(-)

diff --git a/hw/vexpress.c b/hw/vexpress.c
index 4b9454f..9d16fbf 100644
--- a/hw/vexpress.c
+++ b/hw/vexpress.c
@@ -103,6 +103,41 @@ static target_phys_addr_t motherboard_legacy_map[] = {
     [VE_USB] = 0x4f000000,
 };
 
+static target_phys_addr_t motherboard_aseries_map[] = {
+    /* CS0: 0x00000000 .. 0x0c000000 */
+    [VE_NORFLASH0] = 0x00000000,
+    [VE_NORFLASH0ALIAS] = 0x08000000,
+    /* CS4: 0x0c000000 .. 0x10000000 */
+    [VE_NORFLASH1] = 0x0c000000,
+    /* CS5: 0x10000000 .. 0x14000000 */
+    /* CS1: 0x14000000 .. 0x18000000 */
+    [VE_SRAM] = 0x14000000,
+    /* CS2: 0x18000000 .. 0x1c000000 */
+    [VE_VIDEORAM] = 0x18000000,
+    [VE_ETHERNET] = 0x1a000000,
+    [VE_USB] = 0x1b000000,
+    /* CS3: 0x1c000000 .. 0x20000000 */
+    [VE_DAPROM] = 0x1c000000,
+    [VE_SYSREGS] = 0x1c010000,
+    [VE_SP810] = 0x1c020000,
+    [VE_SERIALPCI] = 0x1c030000,
+    [VE_PL041] = 0x1c040000,
+    [VE_MMCI] = 0x1c050000,
+    [VE_KMI0] = 0x1c060000,
+    [VE_KMI1] = 0x1c070000,
+    [VE_UART0] = 0x1c090000,
+    [VE_UART1] = 0x1c0a0000,
+    [VE_UART2] = 0x1c0b0000,
+    [VE_UART3] = 0x1c0c0000,
+    [VE_WDT] = 0x1c0f0000,
+    [VE_TIMER01] = 0x1c110000,
+    [VE_TIMER23] = 0x1c120000,
+    [VE_SERIALDVI] = 0x1c160000,
+    [VE_RTC] = 0x1c170000,
+    [VE_COMPACTFLASH] = 0x1c1a0000,
+    [VE_CLCD] = 0x1c1f0000,
+};
+
 /* Structure defining the peculiarities of a specific daughterboard */
 
 typedef struct VEDBoardInfo VEDBoardInfo;
@@ -218,6 +253,91 @@ static const VEDBoardInfo a9_daughterboard = {
     .init = a9_daughterboard_init,
 };
 
+static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,
+                                   ram_addr_t ram_size,
+                                   const char *cpu_model,
+                                   qemu_irq *pic, uint32_t *proc_id)
+{
+    int n;
+    CPUState *env = NULL;
+    MemoryRegion *sysmem = get_system_memory();
+    MemoryRegion *ram = g_new(MemoryRegion, 1);
+    MemoryRegion *sram = g_new(MemoryRegion, 1);
+    qemu_irq cpu_irq[4];
+    DeviceState *dev;
+    SysBusDevice *busdev;
+
+    if (!cpu_model) {
+        cpu_model = "cortex-a15";
+    }
+
+    *proc_id = 0x14000217;
+
+    for (n = 0; n < smp_cpus; n++) {
+        qemu_irq *irqp;
+        env = cpu_init(cpu_model);
+        if (!env) {
+            fprintf(stderr, "Unable to find CPU definition\n");
+            exit(1);
+        }
+        irqp = arm_pic_init_cpu(env);
+        cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ];
+    }
+
+    if (ram_size > 0x80000000) {
+        fprintf(stderr, "vexpress-a15: cannot model more than 2GB RAM\n");
+        exit(1);
+    }
+
+    memory_region_init_ram(ram, "vexpress.highmem", ram_size);
+    vmstate_register_ram_global(ram);
+    /* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */
+    memory_region_add_subregion(sysmem, 0x80000000, ram);
+
+    /* 0x2c000000 A15MPCore private memory region (GIC) */
+    dev = qdev_create(NULL, "a15mpcore_priv");
+    qdev_prop_set_uint32(dev, "num-cpu", smp_cpus);
+    qdev_init_nofail(dev);
+    busdev = sysbus_from_qdev(dev);
+    sysbus_mmio_map(busdev, 0, 0x2c000000);
+    for (n = 0; n < smp_cpus; n++) {
+        sysbus_connect_irq(busdev, n, cpu_irq[n]);
+    }
+    /* Interrupts [42:0] are from the motherboard;
+     * [47:43] are reserved; [63:48] are daughterboard
+     * peripherals. Note that some documentation numbers
+     * external interrupts starting from 32 (because there
+     * are internal interrupts 0..31).
+     */
+    for (n = 0; n < 64; n++) {
+        pic[n] = qdev_get_gpio_in(dev, n);
+    }
+
+    /* A15 daughterboard peripherals: */
+
+    /* 0x20000000: CoreSight interfaces: not modelled */
+    /* 0x2a000000: PL301 AXI interconnect: not modelled */
+    /* 0x2a420000: SCC: not modelled */
+    /* 0x2a430000: system counter: not modelled */
+    /* 0x2b000000: HDLCD controller: not modelled */
+    /* 0x2b060000: SP805 watchdog: not modelled */
+    /* 0x2b0a0000: PL341 dynamic memory controller: not modelled */
+    /* 0x2e000000: system SRAM */
+    memory_region_init_ram(sram, "vexpress.a15sram", 0x10000);
+    vmstate_register_ram_global(sram);
+    memory_region_add_subregion(sysmem, 0x2e000000, sram);
+
+    /* 0x7ffb0000: DMA330 DMA controller: not modelled */
+    /* 0x7ffd0000: PL354 static memory controller: not modelled */
+}
+
+static const VEDBoardInfo a15_daughterboard = {
+    .motherboard_map = motherboard_aseries_map,
+    .loader_start = 0x80000000,
+    .gic_cpu_if_addr = 0x2c002000,
+    .init = a15_daughterboard_init,
+};
+
 static void vexpress_common_init(const VEDBoardInfo *daughterboard,
                                  ram_addr_t ram_size,
                                  const char *boot_device,
@@ -333,6 +453,18 @@ static void vexpress_a9_init(ram_addr_t ram_size,
                          kernel_cmdline, initrd_filename, cpu_model);
 }
 
+static void vexpress_a15_init(ram_addr_t ram_size,
+                              const char *boot_device,
+                              const char *kernel_filename,
+                              const char *kernel_cmdline,
+                              const char *initrd_filename,
+                              const char *cpu_model)
+{
+    vexpress_common_init(&a15_daughterboard,
+                         ram_size, boot_device, kernel_filename,
+                         kernel_cmdline, initrd_filename, cpu_model);
+}
+
 static QEMUMachine vexpress_a9_machine = {
     .name = "vexpress-a9",
     .desc = "ARM Versatile Express for Cortex-A9",
@@ -341,9 +473,18 @@ static QEMUMachine vexpress_a9_machine = {
     .max_cpus = 4,
 };
 
+static QEMUMachine vexpress_a15_machine = {
+    .name = "vexpress-a15",
+    .desc = "ARM Versatile Express for Cortex-A15",
+    .init = vexpress_a15_init,
+    .use_scsi = 1,
+    .max_cpus = 4,
+};
+
 static void vexpress_machine_init(void)
 {
     qemu_register_machine(&vexpress_a9_machine);
+    qemu_register_machine(&vexpress_a15_machine);
 }
 
 machine_init(vexpress_machine_init);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition Peter Maydell
@ 2012-01-25 12:31   ` Andreas Färber
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 12:31 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers Peter Maydell
@ 2012-01-25 12:37   ` Andreas Färber
  2012-01-25 13:01     ` Peter Maydell
  0 siblings, 1 reply; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 12:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/cpu.h    |    1 +
>  target-arm/helper.c |   12 ++++++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 42c53a7..d71d310 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -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_GENERICTIMER,

Personally I would've preferred GENERIC_TIMER (we have ARM_DIV,
THUMB_DIV as counterexamples), but no strong objection here.

Andreas

>  };
>  
>  static inline int arm_feature(CPUARMState *env, int feature)
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 00458fc..ecba0c6 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -1762,7 +1762,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_GENERICTIMER)) {
> +            /* Dummy implementation: RAZ/WI for all */
> +            break;
> +        }
>          goto bad_reg;
>      case 15: /* Implementation specific.  */
>          if (arm_feature(env, ARM_FEATURE_XSCALE)) {
> @@ -2132,7 +2136,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_GENERICTIMER)) {
> +            /* Dummy implementation: RAZ/WI for all */
> +            return 0;
> +        }
>          goto bad_reg;
>      case 15: /* Implementation specific.  */
>          if (arm_feature(env, ARM_FEATURE_XSCALE)) {

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers
  2012-01-25 12:37   ` Andreas Färber
@ 2012-01-25 13:01     ` Peter Maydell
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2012-01-25 13:01 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel, patches

On 25 January 2012 12:37, Andreas Färber <afaerber@suse.de> wrote:
> Am 24.01.2012 13:39, schrieb Peter Maydell:
>> +    ARM_FEATURE_GENERICTIMER,
>
> Personally I would've preferred GENERIC_TIMER (we have ARM_DIV,
> THUMB_DIV as counterexamples), but no strong objection here.

I think I agree.

-- PMM

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model Peter Maydell
@ 2012-01-25 16:08   ` Andreas Färber
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 16:08 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb Peter Maydell:
> Add a model of the Cortex-A15 memory mapped private peripheral
> space. This is fairly simple because the only memory mapped
> bit of the A15 is the GIC.
> 
> Note that we don't currently model a VGIC and therefore don't
> map the VGIC related bits of the GIC.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven Peter Maydell
@ 2012-01-25 16:59   ` Andreas Färber
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 16:59 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb Peter Maydell:
> Pull the addresses used for mapping motherboard peripherals into
> memory out into a table. This will allow us to simply provide a
> second table to implement the "Cortex-A Series" memory map used by
> the A15 variant of Versatile Express, as well as the current
> "Legacy" map used by A9.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Nice! (Liked-by :))

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization Peter Maydell
@ 2012-01-25 18:04   ` Andreas Färber
  2012-01-25 19:53     ` Peter Maydell
  0 siblings, 1 reply; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 18:04 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb Peter Maydell:
> Factor out daughterboard specifics into a data structure and
> daughterboard initialization function, in preparation for adding
> vexpress-a15 support.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/vexpress.c |  118 ++++++++++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 83 insertions(+), 35 deletions(-)
> 
> diff --git a/hw/vexpress.c b/hw/vexpress.c
> index 99a9690..9033b50 100644
> --- a/hw/vexpress.c
> +++ b/hw/vexpress.c

> +struct VEDBoardInfo {
> +    const target_phys_addr_t *motherboard_map;
> +    const target_phys_addr_t loader_start;

const for a value type in a struct looks fishy...is it intentional and
valid C99?

Otherwise looks okay.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine Peter Maydell
@ 2012-01-25 18:15   ` Andreas Färber
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 18:15 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb Peter Maydell:
> Add the vexpress-a15 machine, and the A-Series memory map it uses.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD
  2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD Peter Maydell
@ 2012-01-25 18:28   ` Andreas Färber
  2012-02-10  2:51     ` Paul Brook
  0 siblings, 1 reply; 21+ messages in thread
From: Andreas Färber @ 2012-01-25 18:28 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

Am 24.01.2012 13:39, schrieb Peter Maydell:
> Instantiate the CLCD on the vexpress motherboard as well as one on
> the daughterboard -- the A15 daughterboard does not have a CLCD
> and so relies on the motherboard one.
> 
> At the moment QEMU doesn't provide infrastructure for selecting
> which display device gets to actually show graphics -- the first
> one registered is it. Fortunately this works for the major use
> case (Linux): if the daughterboard has a CLCD it will come first
> and be used, otherwise we fall back to the motherboard CLCD.
> So we don't (currently) need to implement the control register
> which allows software to tell the mux which video output to pass
> through to the outside world.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

I do hope we find a solution to deal with n displays in the future. I
consider that a post-QOM topic and maybe Anthony's planned DisplayState
refactoring helps with that.

The Origen Board has (provisions for) an LCD in addition to HDMI output,
for instance.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization
  2012-01-25 18:04   ` Andreas Färber
@ 2012-01-25 19:53     ` Peter Maydell
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2012-01-25 19:53 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel, patches

On 25 January 2012 18:04, Andreas Färber <afaerber@suse.de> wrote:
> Am 24.01.2012 13:39, schrieb Peter Maydell:
>> +struct VEDBoardInfo {
>> +    const target_phys_addr_t *motherboard_map;
>> +    const target_phys_addr_t loader_start;
>
> const for a value type in a struct looks fishy...is it intentional and
> valid C99?

It's valid C99 (the effect would be that you can't assign to
boardinfo->loader_start and you can't do a structure copy
of a boardinfo either, but assigning to boardinfo->some_other_field
would be OK). However it's not what I actually meant to do;
this should just be "target_phys_addr_t loader_start;".

(The const target_phys_addr_t *motherboard_map; is of course OK.)

-- PMM

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD
  2012-01-25 18:28   ` Andreas Färber
@ 2012-02-10  2:51     ` Paul Brook
  2012-02-15 13:36       ` Peter Maydell
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Brook @ 2012-02-10  2:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andreas Färber, patches

> I do hope we find a solution to deal with n displays in the future. I
> consider that a post-QOM topic and maybe Anthony's planned DisplayState
> refactoring helps with that.

It used to work.  Not particularly pretty or user friendly, but definitely 
functional.  I put a fair amount of effort into making DisplayState support 
this the first time round :-)

I think the mips jazz board is currently the only board that actually has 
multiple displays.  I used it with a simple custom PCI display device.
The VGA devices hardcode a particular ISA port range, so multiple instances 
don't get along well.

Paul

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD
  2012-02-10  2:51     ` Paul Brook
@ 2012-02-15 13:36       ` Peter Maydell
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2012-02-15 13:36 UTC (permalink / raw)
  To: Paul Brook; +Cc: patches, qemu-devel, Andreas Färber

On 10 February 2012 02:51, Paul Brook <paul@codesourcery.com> wrote:
>> I do hope we find a solution to deal with n displays in the future. I
>> consider that a post-QOM topic and maybe Anthony's planned DisplayState
>> refactoring helps with that.
>
> It used to work.  Not particularly pretty or user friendly, but definitely
> functional.  I put a fair amount of effort into making DisplayState support
> this the first time round :-)

Yes, it looks like the console.c code mostly supports this, but at the
moment vl.c calls get_displaystate() which just returns the first registered
DisplayState, and that is the one which gets passed to sdl_display_init()
and friends.

-- PMM

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-02-15 13:36 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-24 12:39 [Qemu-devel] [PATCH v2 0/9] Add support for Cortex-A15 and vexpress-a15 Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 1/9] Add dummy implementation of generic timer cp15 registers Peter Maydell
2012-01-25 12:37   ` Andreas Färber
2012-01-25 13:01     ` Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 2/9] Add Cortex-A15 CPU definition Peter Maydell
2012-01-25 12:31   ` Andreas Färber
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 3/9] hw/a15mpcore.c: Add Cortex-A15 private peripheral model Peter Maydell
2012-01-25 16:08   ` Andreas Färber
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 4/9] hw/vexpress.c: Make motherboard peripheral memory map table-driven Peter Maydell
2012-01-25 16:59   ` Andreas Färber
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 5/9] hw/vexpress.c: Move secondary CPU boot code to SRAM Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 6/9] hw/vexpress.c: Factor out daughterboard-specific initialization Peter Maydell
2012-01-25 18:04   ` Andreas Färber
2012-01-25 19:53     ` Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 7/9] hw/vexpress.c: Instantiate the motherboard CLCD Peter Maydell
2012-01-25 18:28   ` Andreas Färber
2012-02-10  2:51     ` Paul Brook
2012-02-15 13:36       ` Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 8/9] arm_boot: Pass base address of GIC CPU interface, not whole GIC Peter Maydell
2012-01-24 12:39 ` [Qemu-devel] [PATCH v2 9/9] hw/vexpress.c: Add vexpress-a15 machine Peter Maydell
2012-01-25 18:15   ` Andreas Färber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.