Andreas Färber | 1 May 2012 01:12
Picon

[PATCH for-1.1 2/2] configure: Assure printing "yes" or "no" for VirtFS support

When auto-detecting VirtFS support, virtfs="". Set it to "no" after
checking whether it was explicitly requested through --enable-virtfs.

Signed-off-by: Andreas Färber <afaerber <at> suse.de>
Cc: Aneesh Kumar K.V <aneesh.kumar <at> linux.vnet.ibm.com>
---
 configure |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 641f147..67016d9 100755
--- a/configure
+++ b/configure
 <at>  <at>  -2905,6 +2905,7  <at>  <at>  if test "$softmmu" = yes ; then
       if test "$virtfs" = yes; then
         feature_not_found "virtfs"
       fi
+      virtfs=no
     fi
   fi
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
--

-- 
1.7.7

Andreas Färber | 1 May 2012 01:12
Picon

[PATCH for-1.1 0/2] configure: Cosmetic VirtFS fix

Hello,

I recently noticed that lack of VirtFS support leads to configure printing just
"VirtFS support". This mini-series fixes it to say "VirtFS support   no".

I'm not sure if we have a definitive Coding Style for shell scripts (or Python
code for that matter), so encountering tabs I went for the surrounding
two-spaces indentation.

Regards,
Andreas

Cc: Aneesh Kumar K.V <aneesh.kumar <at> linux.vnet.ibm.com>
Cc: Blue Swirl <blauwirbel <at> gmail.com>

Andreas Färber (2):
  configure: Reindent VirtFS check
  configure: Assure printing "yes" or "no" for VirtFS support

 configure |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

--

-- 
1.7.7

Andreas Färber | 1 May 2012 01:12
Picon

[PATCH for-1.1 1/2] configure: Reindent VirtFS check

Avoid tab-indention and fit in with the surrounding code.

Signed-off-by: Andreas Färber <afaerber <at> suse.de>
Cc: Aneesh Kumar K.V <aneesh.kumar <at> linux.vnet.ibm.com>
---
 configure |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 25697bb..641f147 100755
--- a/configure
+++ b/configure
 <at>  <at>  -2898,14 +2898,14  <at>  <at>  tools=
 if test "$softmmu" = yes ; then
   tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
   if test "$virtfs" != no ; then
-      if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
-	  virtfs=yes
-	  tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
-      else
-	  if test "$virtfs" = yes; then
-	      feature_not_found "virtfs"
-	  fi
+    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
+      virtfs=yes
+      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
+    else
+      if test "$virtfs" = yes; then
+        feature_not_found "virtfs"
       fi
(Continue reading)

Yue Chen | 1 May 2012 07:01
Picon

To run (replay) the intermediate micro-ops directly

Hi,


Does anyone know, how to run(replay) the intermediate micro-ops directly?

For example, I have traced some micro-op instructions, and want to see what happens with these instructions(after being translated into host code and then run). Probably with Graphic User Interface.

Any approach to do this in QEMU? Thanks.
Stefan Weil | 1 May 2012 07:53
Picon
Favicon

[PATCH] sdl: Avoid unnecessary resizing of the display surface

If neither width nor height changes, nothing has to be done.

Cc: Anthony Liguori <aliguori <at> us.ibm.com>
Signed-off-by: Stefan Weil <sw <at> weilnetz.de>
---

This patch improves SDL for any host (for example with remote X displays),
but the main reason why I wrote it was another problem:

On w32 / w64 hosts, qemu-system-arm has a deadlock when it calls
sdl_resize_displaysurface during Linux boot. One thread waits for
a critical region, another thread waits inside SDL_SetVideoMode.

The patch avoids this problem. Paolo, maybe you have an idea what
could cause the deadlock. Debugging on wxx is terrible - up to now,
I did not succeed in analysing the lock situation with gdb.

Regards,
Stefan W.

 ui/sdl.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ui/sdl.c b/ui/sdl.c
index 8700b7a..8c1c71c 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
 <at>  <at>  -224,8 +224,11  <at>  <at>  static void sdl_free_displaysurface(DisplaySurface *surface)

 static DisplaySurface* sdl_resize_displaysurface(DisplaySurface *surface, int width, int height)
 {
-    sdl_free_displaysurface(surface);
-    return sdl_create_displaysurface(width, height);
+    if (surface->width != width || surface->height != height) {
+        sdl_free_displaysurface(surface);
+        surface = sdl_create_displaysurface(width, height);
+    }
+    return surface;
 }

 /* generic keyboard conversion */
--

-- 
1.7.9

Josh Durgin | 1 May 2012 08:16
Favicon

[PATCH] rbd: add discard support

Change the write flag to an operation type in RBDAIOCB, and make the
buffer optional since discard doesn't use it.

Discard is first included in librbd 0.1.2 (which is in Ceph 0.46).
If librbd is too old, leave out qemu_rbd_aio_discard entirely,
so the old behavior is preserved.

Signed-off-by: Josh Durgin <josh.durgin <at> dreamhost.com>
---
 block/rbd.c |   89 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 73 insertions(+), 16 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index 6cd8448..1280d66 100644
--- a/block/rbd.c
+++ b/block/rbd.c
 <at>  <at>  -44,6 +44,13  <at>  <at> 
  * leading "\".
  */

+/* rbd_aio_discard added in 0.1.2 */
+#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 2)
+#define LIBRBD_SUPPORTS_DISCARD
+#else
+#undef LIBRBD_SUPPORTS_DISCARD
+#endif
+
 #define OBJ_MAX_SIZE (1UL << OBJ_DEFAULT_OBJ_ORDER)

 #define RBD_MAX_CONF_NAME_SIZE 128
 <at>  <at>  -53,13 +60,19  <at>  <at> 
 #define RBD_MAX_SNAP_NAME_SIZE 128
 #define RBD_MAX_SNAPS 100

+typedef enum {
+    RBD_AIO_READ,
+    RBD_AIO_WRITE,
+    RBD_AIO_DISCARD
+} RBDAIOCmd;
+
 typedef struct RBDAIOCB {
     BlockDriverAIOCB common;
     QEMUBH *bh;
     int ret;
     QEMUIOVector *qiov;
     char *bounce;
-    int write;
+    RBDAIOCmd cmd;
     int64_t sector_num;
     int error;
     struct BDRVRBDState *s;
 <at>  <at>  -371,7 +384,8  <at>  <at>  static void qemu_rbd_complete_aio(RADOSCB *rcb)

     r = rcb->ret;

-    if (acb->write) {
+    if (acb->cmd == RBD_AIO_WRITE ||
+        acb->cmd == RBD_AIO_DISCARD) {
         if (r < 0) {
             acb->ret = r;
             acb->error = 1;
 <at>  <at>  -605,7 +619,7  <at>  <at>  static void rbd_aio_bh_cb(void *opaque)
 {
     RBDAIOCB *acb = opaque;

-    if (!acb->write) {
+    if (acb->cmd == RBD_AIO_READ) {
         qemu_iovec_from_buffer(acb->qiov, acb->bounce, acb->qiov->size);
     }
     qemu_vfree(acb->bounce);
 <at>  <at>  -616,12 +630,25  <at>  <at>  static void rbd_aio_bh_cb(void *opaque)
     qemu_aio_release(acb);
 }

-static BlockDriverAIOCB *rbd_aio_rw_vector(BlockDriverState *bs,
-                                           int64_t sector_num,
-                                           QEMUIOVector *qiov,
-                                           int nb_sectors,
-                                           BlockDriverCompletionFunc *cb,
-                                           void *opaque, int write)
+static int rbd_aio_discard_wrapper(rbd_image_t image,
+                                   uint64_t off,
+                                   uint64_t len,
+                                   rbd_completion_t comp)
+{
+#ifdef LIBRBD_SUPPORTS_DISCARD
+    return rbd_aio_discard(image, off, len, comp);
+#else
+    return -ENOTSUP;
+#endif
+}
+
+static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
+                                       int64_t sector_num,
+                                       QEMUIOVector *qiov,
+                                       int nb_sectors,
+                                       BlockDriverCompletionFunc *cb,
+                                       void *opaque,
+                                       RBDAIOCmd cmd)
 {
     RBDAIOCB *acb;
     RADOSCB *rcb;
 <at>  <at>  -633,16 +660,20  <at>  <at>  static BlockDriverAIOCB *rbd_aio_rw_vector(BlockDriverState *bs,
     BDRVRBDState *s = bs->opaque;

     acb = qemu_aio_get(&rbd_aio_pool, bs, cb, opaque);
-    acb->write = write;
+    acb->cmd = cmd;
     acb->qiov = qiov;
-    acb->bounce = qemu_blockalign(bs, qiov->size);
+    if (cmd == RBD_AIO_DISCARD) {
+        acb->bounce = NULL;
+    } else {
+        acb->bounce = qemu_blockalign(bs, qiov->size);
+    }
     acb->ret = 0;
     acb->error = 0;
     acb->s = s;
     acb->cancelled = 0;
     acb->bh = NULL;

-    if (write) {
+    if (cmd == RBD_AIO_WRITE) {
         qemu_iovec_to_buffer(acb->qiov, acb->bounce);
     }

 <at>  <at>  -664,10 +695,18  <at>  <at>  static BlockDriverAIOCB *rbd_aio_rw_vector(BlockDriverState *bs,
         goto failed;
     }

-    if (write) {
+    switch (cmd) {
+    case RBD_AIO_WRITE:
         r = rbd_aio_write(s->image, off, size, buf, c);
-    } else {
+        break;
+    case RBD_AIO_READ:
         r = rbd_aio_read(s->image, off, size, buf, c);
+        break;
+    case RBD_AIO_DISCARD:
+        r = rbd_aio_discard_wrapper(s->image, off, size, c);
+        break;
+    default:
+        r = -EINVAL;
     }

     if (r < 0) {
 <at>  <at>  -690,7 +729,8  <at>  <at>  static BlockDriverAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs,
                                             BlockDriverCompletionFunc *cb,
                                             void *opaque)
 {
-    return rbd_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 0);
+    return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
+                         RBD_AIO_READ);
 }

 static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
 <at>  <at>  -700,7 +740,8  <at>  <at>  static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
                                              BlockDriverCompletionFunc *cb,
                                              void *opaque)
 {
-    return rbd_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 1);
+    return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
+                         RBD_AIO_WRITE);
 }

 static int qemu_rbd_co_flush(BlockDriverState *bs)
 <at>  <at>  -850,6 +891,18  <at>  <at>  static int qemu_rbd_snap_list(BlockDriverState *bs,
     return snap_count;
 }

+#ifdef LIBRBD_SUPPORTS_DISCARD
+static BlockDriverAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs,
+                                              int64_t sector_num,
+                                              int nb_sectors,
+                                              BlockDriverCompletionFunc *cb,
+                                              void *opaque)
+{
+    return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque,
+                         RBD_AIO_DISCARD);
+}
+#endif
+
 static QEMUOptionParameter qemu_rbd_create_options[] = {
     {
      .name = BLOCK_OPT_SIZE,
 <at>  <at>  -880,6 +933,10  <at>  <at>  static BlockDriver bdrv_rbd = {
     .bdrv_aio_writev        = qemu_rbd_aio_writev,
     .bdrv_co_flush_to_disk  = qemu_rbd_co_flush,

+#ifdef LIBRBD_SUPPORTS_DISCARD
+    .bdrv_aio_discard       = qemu_rbd_aio_discard,
+#endif
+
     .bdrv_snapshot_create   = qemu_rbd_snap_create,
     .bdrv_snapshot_delete   = qemu_rbd_snap_remove,
     .bdrv_snapshot_list     = qemu_rbd_snap_list,
--

-- 
1.7.5.4

Blue Swirl | 1 May 2012 08:57
Picon

Re: Memory API: handling unassigned physical memory

On Mon, Apr 30, 2012 at 13:52, Mark Cave-Ayland
<mark.cave-ayland <at> ilande.co.uk> wrote:
> On 30/04/12 14:27, Peter Maydell wrote:
>
> Hi Peter,
>
>
>>> IMO the best fix is to unsysbus the device and qomify it instead.  This
>>> way we're 100% flexible in how we can attach it.
>>
>>
>> You don't need to wait for QOM to grow enough features to
>> replace sysbus. If you don't like what sysbus_mmio_map() does, you
>
>
> Oh - so does this mean that QOM is not feature-complete?

At least 'Pin' class to replace GPIOs and IRQs is not in HEAD (but
Anthony already has a tree somewhere) and I can't remember what was
the plan for buses.

>
>
>> can always use sysbus_mmio_get_region() to get the MemoryRegion* and
>> then deal with it however you need to. This is the standard way
>> to deal with "I have a sysbus device which I want to map into my
>> custom container object".
>
>
> I already have code to do this for the sun4m-only hardware modelled on
> sysbus_mmio_map() like this:
>
>
> static void sbus_mmio_map(void *sbus, SysBusDevice *s, int n,
> target_phys_addr_t addr)
> {
>    MemoryRegion *sbus_mem, *mem;
>    target_phys_addr_t sbus_base;
>    SBusState *sbus_state = FROM_SYSBUS(SBusState, (SysBusDevice *)sbus);
>
>    sbus_mem = sysbus_mmio_get_region((SysBusDevice *)sbus, 0);
>    mem = sysbus_mmio_get_region(s, n);
>
>    /* SBus addresses are physical addresses, so subtract start of region */
>    sbus_base = sbus_state->base;
>    memory_region_add_subregion(sbus_mem, addr - sbus_base, mem);
> }
>
>
> The key problem is that this doesn't worked with shared peripherals, such as
> the ESP device which is also used on various PPC Mac models as well as
> SPARC. That's because its init function looks like this:
>
>
>
> void esp_init(target_phys_addr_t espaddr, int it_shift,
>              ESPDMAMemoryReadWriteFunc dma_memory_read,
>              ESPDMAMemoryReadWriteFunc dma_memory_write,
>              void *dma_opaque, qemu_irq irq, qemu_irq *reset,
>              qemu_irq *dma_enable)
> {
>    ...
>    ...
>    sysbus_mmio_map(s, 0, espaddr);
>    ...
> }
>
>
> Therefore I can't change it to my (modified) sbus_mmio_map() function
> because it would break other non-SPARC platforms, and AIUI there is nothing
> in the memory API that allows me to move a subregion to a different
> MemoryRegion parent, even if I can get a reference to it with
> sysbus_mmio_get_region() after the sysbus_mmio_map() call - or have I
> misunderstood something?

Sysbus is used as a generic class for motherboard devices, there is an
assumption that there is no higher level bus. What we need here is a
full blown bus. The translations and mappigs between bus addresses and
motherboard addresses should be done in a Sysbus to SBus bridge
device, just like PCI host bridges do.

>
>
> ATB,
>
> Mark.
>

Blue Swirl | 1 May 2012 09:10
Picon

Re: Memory API: handling unassigned physical memory

On Mon, Apr 30, 2012 at 14:33, Mark Cave-Ayland
<mark.cave-ayland <at> ilande.co.uk> wrote:
> On 30/04/12 15:03, Peter Maydell wrote:
>
>>> Therefore I can't change it to my (modified) sbus_mmio_map() function
>>> because it would break other non-SPARC platforms, and AIUI there is
>>> nothing
>>> in the memory API that allows me to move a subregion to a different
>>> MemoryRegion parent, even if I can get a reference to it with
>>> sysbus_mmio_get_region() after the sysbus_mmio_map() call - or have I
>>> misunderstood something?
>>
>>
>> Init functions like esp_init should be purely convenience functions
>> which create, set properties on, and map the sysbus/qdev device. If
>> they make use of private knowledge about the internals of the device
>> then this is wrong and should be fixed. For esp_init() it looks like
>> the handling of dma_memory_read, dma_memory_write, dma_opaque, it_shift
>> and dma_enabled are wrong.
>>
>> If you fix that then you can just ignore the convenience function,
>> and create, configure and map the device as appropriate for you.
>
>
> Right I think I'm starting to understand this now - in which case it becomes
> a matter of just copying a handful of lines within sun4m which is more
> bearable.
>
> In your view, would a suitable fix be to change dma_memory_read,
> dma_memory_write, dma_opaque, it_shift and dma_enabled to be qdev properties
> and modify esp_init() to return the qdev reference so they can be set by the
> caller?

There's an ongoing work to introduce IOMMUs by changing how DMA work
and this could simplify the DMA part. There's no clean way to use
function pointers in qdev.

For it_shift, a qdev or QOM property should be OK.

The signal dma_enabled should be eventually replaced by a Pin.

>
>
> ATB,
>
> Mark.
>

Peter Chubb | 1 May 2012 03:33
Picon
Favicon

[PATCH v7 0/5] add i.MX31 support

This patch series adds rudimentary support for the Freescale i.MX31 SoC,
and the Kyoto Micro KZM-ARM11-01, an evaluation board built
around the Freescale i.MX31.

Changes since last patch round: (v6)
   * shortened patch titles
   * canonised spelling of `Freescale'
   * Fixed 10 to 32-bit sign extension in the clock-control-module 
   * Use a post-load hook in the clock-control-module instead of 
     storing frequencies in the VMState.
   * Deleted undocumented second UART on KZM board's FPGA.

Apart from that the patches are unchanged.  Thanks to Peter M and Andreas F for
comments.
--

-- 
Dr Peter Chubb        www.nicta.com.au      peter DOT chubb AT nicta.com.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
>From Imagination to Impact                       Imagining the (ICT) Future

Peter Chubb | 1 May 2012 03:33
Picon
Favicon

[PATCH v7 5/5] i.MX31: KZM-ARM11-01 evaluation board

Board support for Kyoto Micro's KZM-ARM11-01, an evaluation board built
around the Freescale i.MX31.

Signed-off-by: Philip O'Sullivan <philipo <at> ok-labs.com>
Signed-off-by: Peter Chubb <peter.chubb <at> nicta.com.au>

---
 Makefile.target |    2 
 hw/kzm.c        |  155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 156 insertions(+), 1 deletion(-)
 create mode 100644 hw/kzm.c

Index: qemu-working/hw/kzm.c
===================================================================
--- /dev/null
+++ qemu-working/hw/kzm.c
 <at>  <at>  -0,0 +1,155  <at>  <at> 
+/*
+ * KZM Board System emulation.
+ *
+ * Copyright (c) 2008 OKL and 2011 NICTA
+ * Written by Hans
+ * Updated by Peter Chubb.
+ *
+ * This code is licenced under the GPL, version 2 or later.
+ * See the file `COPYING' in the top level directory.
+ *
+ * It (partially) emulates a Kyoto Microcomputer
+ * KZM-ARM11-01 evaluation board, with a Freescale
+ * I.MX31 SoC
+ */
+
+#include "sysbus.h"
+#include "exec-memory.h"
+#include "hw.h"
+#include "arm-misc.h"
+#include "devices.h"
+#include "net.h"
+#include "sysemu.h"
+#include "boards.h"
+#include "pc.h" /* for the FPGA UART that emulates a 16550 */
+#include "imx.h"
+
+    /* Memory map for Kzm Emulation Baseboard:
+     * 0x00000000-0x00003fff 16k secure ROM       IGNORED
+     * 0x00004000-0x00407fff Reserved             IGNORED
+     * 0x00404000-0x00407fff ROM                  IGNORED
+     * 0x00408000-0x0fffffff Reserved             IGNORED
+     * 0x10000000-0x1fffbfff RAM aliasing         IGNORED
+     * 0x1fffc000-0x1fffffff RAM                  EMULATED
+     * 0x20000000-0x2fffffff Reserved             IGNORED
+     * 0x30000000-0x7fffffff I.MX31 Internal Register Space
+     *   0x43f00000 IO_AREA0
+     *   0x43f90000 UART1                         EMULATED
+     *   0x43f94000 UART2                         EMULATED
+     *   0x68000000 AVIC                          EMULATED
+     *   0x53f80000 CCM                           EMULATED
+     *   0x53f94000 PIT 1                         EMULATED
+     *   0x53f98000 PIT 2                         EMULATED
+     *   0x53f90000 GPT                           EMULATED
+     * 0x80000000-0x87ffffff RAM                  EMULATED
+     * 0x88000000-0x8fffffff RAM Aliasing         EMULATED
+     * 0xa0000000-0xafffffff NAND Flash           IGNORED
+     * 0xb0000000-0xb3ffffff Unavailable          IGNORED
+     * 0xb4000000-0xb4000fff 8-bit free space     IGNORED
+     * 0xb4001000-0xb400100f Board control        IGNORED
+     *  0xb4001003           DIP switch
+     * 0xb4001010-0xb400101f 7-segment LED        IGNORED
+     * 0xb4001020-0xb400102f LED                  IGNORED
+     * 0xb4001030-0xb400103f LED                  IGNORED
+     * 0xb4001040-0xb400104f FPGA, UART           EMULATED
+     * 0xb4001050-0xb400105f FPGA, UART           EMULATED
+     * 0xb4001060-0xb40fffff FPGA                 IGNORED
+     * 0xb6000000-0xb61fffff LAN controller       EMULATED
+     * 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED
+     * 0xb6300000-0xb7ffffff Free                 IGNORED
+     * 0xb8000000-0xb8004fff Memory control registers IGNORED
+     * 0xc0000000-0xc3ffffff PCMCIA/CF            IGNORED
+     * 0xc4000000-0xffffffff Reserved             IGNORED
+     */
+
+#define KZM_RAMADDRESS (0x80000000)
+#define KZM_FPGA       (0xb4001040)
+
+static struct arm_boot_info kzm_binfo = {
+    .loader_start = KZM_RAMADDRESS,
+    .board_id = 1722,
+};
+
+static void kzm_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)
+{
+    CPUARMState *env;
+    MemoryRegion *address_space_mem = get_system_memory();
+    MemoryRegion *ram = g_new(MemoryRegion, 1);
+    MemoryRegion *sram = g_new(MemoryRegion, 1);
+    MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
+    qemu_irq *cpu_pic;
+    DeviceState *dev;
+    DeviceState *ccm;
+
+    if (!cpu_model) {
+        cpu_model = "arm1136";
+    }
+
+    env = cpu_init(cpu_model);
+    if (!env) {
+        fprintf(stderr, "Unable to find CPU definition\n");
+        exit(1);
+    }
+
+    /* On a real system, the first 16k is a `secure boot rom' */
+
+    memory_region_init_ram(ram, "kzm.ram", ram_size);
+    vmstate_register_ram_global(ram);
+    memory_region_add_subregion(address_space_mem, KZM_RAMADDRESS, ram);
+
+    memory_region_init_alias(ram_alias, "ram.alias", ram, 0, ram_size);
+    memory_region_add_subregion(address_space_mem, 0x88000000, ram_alias);
+
+    memory_region_init_ram(sram, "kzm.sram", 0x4000);
+    memory_region_add_subregion(address_space_mem, 0x1FFFC000, sram);
+
+
+    cpu_pic = arm_pic_init_cpu(env);
+    dev = sysbus_create_varargs("imx_avic", 0x68000000,
+                               cpu_pic[ARM_PIC_CPU_IRQ],
+                               cpu_pic[ARM_PIC_CPU_FIQ], NULL);
+
+
+    imx_serial_create(0,  0x43f90000, qdev_get_gpio_in(dev, 45));
+    imx_serial_create(1,  0x43f94000, qdev_get_gpio_in(dev, 32));
+
+    ccm = sysbus_create_simple("imx_ccm", 0x53f80000, NULL);
+
+    imx_timerp_create(0x53f94000, qdev_get_gpio_in(dev, 28), ccm);
+    imx_timerp_create(0x53f98000, qdev_get_gpio_in(dev, 27), ccm);
+    imx_timerg_create(0x53f90000, qdev_get_gpio_in(dev, 29), ccm);
+
+    if (nd_table[0].vlan) {
+        lan9118_init(&nd_table[0], 0xb6000000, qdev_get_gpio_in(dev, 52));
+    }
+
+    if (serial_hds[2]) { /* touchscreen */
+        serial_mm_init(address_space_mem, KZM_FPGA+0x10, 0,
+                       qdev_get_gpio_in(dev, 52),
+                       14745600, serial_hds[2],
+                       DEVICE_NATIVE_ENDIAN);
+    }
+
+    kzm_binfo.ram_size = ram_size;
+    kzm_binfo.kernel_filename = kernel_filename;
+    kzm_binfo.kernel_cmdline = kernel_cmdline;
+    kzm_binfo.initrd_filename = initrd_filename;
+    kzm_binfo.nb_cpus = 1;
+    arm_load_kernel(first_cpu, &kzm_binfo);
+}
+
+static QEMUMachine kzm_machine = {
+    .name = "kzm",
+    .desc = "ARM KZM Emulation Baseboard (ARM1136)",
+    .init = kzm_init,
+};
+
+static void kzm_machine_init(void)
+{
+    qemu_register_machine(&kzm_machine);
+}
+
+machine_init(kzm_machine_init);
Index: qemu-working/Makefile.target
===================================================================
--- qemu-working.orig/Makefile.target
+++ qemu-working/Makefile.target
 <at>  <at>  -402,7 +402,7  <at>  <at>  obj-arm-y += vexpress.o
 obj-arm-y += strongarm.o
 obj-arm-y += collie.o
 obj-arm-y += pl041.o lm4549.o
-obj-arm-y += imx_serial.o imx_ccm.o imx_timer.o imx_avic.o
+obj-arm-y += imx_serial.o imx_ccm.o imx_timer.o imx_avic.o kzm.o
 obj-arm-$(CONFIG_FDT) += device_tree.o

 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o


Gmane