All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: kvm-ppc@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board
Date: Thu, 11 Dec 2008 21:39:46 +0000	[thread overview]
Message-ID: <494188A2.10009@codemonkey.ws> (raw)
In-Reply-To: <8d7e31f5f951172065c0bb9a6ec333a052c7ece2.1229027683.git.hollisb@us.ibm.com>

Hollis Blanchard wrote:
> Since most IO devices are integrated into the 440EP chip, "Bamboo support"
> mostly entails implementing the -kernel, -initrd, and -append options.
>
> These options are implemented by loading the guest as if u-boot had done it,
> i.e. loading a flat device tree, updating it to hold initrd addresses, ram
> size, and command line, and passing the FDT address in r3.
>
> Since we use it with KVM, we enable the virtio block driver and include hooks
> necessary for KVM support.
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> ---
>  Makefile             |    2 +-
>  Makefile.target      |    2 +-
>  hw/boards.h          |    1 +
>  hw/ppc440_bamboo.c   |  190 ++++++++++++++++++++++++++++++++++++++++
>  pc-bios/bamboo.dtb   |  Bin 0 -> 3163 bytes
>  pc-bios/bamboo.dts   |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  target-ppc/machine.c |    2 +
>  7 files changed, 429 insertions(+), 2 deletions(-)
>  create mode 100644 hw/ppc440_bamboo.c
>  create mode 100644 pc-bios/bamboo.dtb
>  create mode 100644 pc-bios/bamboo.dts
>
> diff --git a/Makefile b/Makefile
> index a2a03ec..f9496fe 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -219,7 +219,7 @@ common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
>  ifdef INSTALL_BLOBS
>  BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
>  video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
> -pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin
> +pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin bamboo.dtb
>  else
>  BLOBS>  endif
> diff --git a/Makefile.target b/Makefile.target
> index 6032af0..82bc746 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -652,7 +652,7 @@ OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
>  OBJS+= unin_pci.o ppc_chrp.o
>  # PowerPC 4xx boards
>  OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
> -OBJS+= ppc440.o
> +OBJS+= ppc440.o ppc440_bamboo.o
>  ifdef CONFIG_KVM
>  OBJS+= kvm_ppc.o
>  endif
> diff --git a/hw/boards.h b/hw/boards.h
> index d30c0fc..debe9a6 100644
> --- a/hw/boards.h
> +++ b/hw/boards.h
> @@ -38,6 +38,7 @@ extern QEMUMachine core99_machine;
>  extern QEMUMachine heathrow_machine;
>  extern QEMUMachine ref405ep_machine;
>  extern QEMUMachine taihu_machine;
> +extern QEMUMachine bamboo_machine;
>  
>  /* mips_r4k.c */
>  extern QEMUMachine mips_machine;
> diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
> new file mode 100644
> index 0000000..b0e3106
> --- /dev/null
> +++ b/hw/ppc440_bamboo.c
> @@ -0,0 +1,190 @@
> +/*
> + * Qemu PowerPC 440 board emulation
> + *
> + * Copyright 2007 IBM Corporation.
> + * Authors:
> + * 	Jerone Young <jyoung5@us.ibm.com>
> + * 	Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
> + * 	Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#include "config.h"
> +#include "qemu-common.h"
> +#include "net.h"
> +#include "hw.h"
> +#include "pci.h"
> +#include "virtio-blk.h"
> +#include "boards.h"
> +#include "sysemu.h"
> +#include "ppc440.h"
> +#include "kvm.h"
> +#include "kvm_ppc.h"
> +#include "device_tree.h"
> +
> +#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
> +
> +static void *bamboo_load_device_tree(void *addr,
> +                                     uint32_t ramsize,
> +                                     target_phys_addr_t initrd_base,
> +                                     target_phys_addr_t initrd_size,
> +                                     const char *kernel_cmdline)
> +{
> +    void *fdt = NULL;
> +#ifdef HAVE_FDT
>   

Is this at all usable without libfdt?  If not, just don't compile this 
board in unless libfdt is present.

> +    uint32_t mem_reg_property[] = { 0, 0, ramsize };
> +    char *path = NULL;
> +    int len;
> +    int ret;
> +
> +    len = asprintf(&path, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);
>   

asprintf() is a GNU-ism and won't compile on Win32.

> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
> index be0cbe1..72f67d0 100644
> --- a/target-ppc/machine.c
> +++ b/target-ppc/machine.c
> @@ -1,5 +1,6 @@
>  #include "hw/hw.h"
>  #include "hw/boards.h"
> +#include "kvm.h"

Is this necessary?

>  
>  void register_machines(void)
>  {
> @@ -8,6 +9,7 @@ void register_machines(void)
>      qemu_register_machine(&prep_machine);
>      qemu_register_machine(&ref405ep_machine);
>      qemu_register_machine(&taihu_machine);
> +    qemu_register_machine(&bamboo_machine);
>  }
>  
>  void cpu_save(QEMUFile *f, void *opaque)
>   


Regards,

Anthony Liguori

WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: kvm-ppc@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation
Date: Thu, 11 Dec 2008 15:39:46 -0600	[thread overview]
Message-ID: <494188A2.10009@codemonkey.ws> (raw)
In-Reply-To: <8d7e31f5f951172065c0bb9a6ec333a052c7ece2.1229027683.git.hollisb@us.ibm.com>

Hollis Blanchard wrote:
> Since most IO devices are integrated into the 440EP chip, "Bamboo support"
> mostly entails implementing the -kernel, -initrd, and -append options.
>
> These options are implemented by loading the guest as if u-boot had done it,
> i.e. loading a flat device tree, updating it to hold initrd addresses, ram
> size, and command line, and passing the FDT address in r3.
>
> Since we use it with KVM, we enable the virtio block driver and include hooks
> necessary for KVM support.
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> ---
>  Makefile             |    2 +-
>  Makefile.target      |    2 +-
>  hw/boards.h          |    1 +
>  hw/ppc440_bamboo.c   |  190 ++++++++++++++++++++++++++++++++++++++++
>  pc-bios/bamboo.dtb   |  Bin 0 -> 3163 bytes
>  pc-bios/bamboo.dts   |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  target-ppc/machine.c |    2 +
>  7 files changed, 429 insertions(+), 2 deletions(-)
>  create mode 100644 hw/ppc440_bamboo.c
>  create mode 100644 pc-bios/bamboo.dtb
>  create mode 100644 pc-bios/bamboo.dts
>
> diff --git a/Makefile b/Makefile
> index a2a03ec..f9496fe 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -219,7 +219,7 @@ common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
>  ifdef INSTALL_BLOBS
>  BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
>  video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
> -pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin
> +pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin bamboo.dtb
>  else
>  BLOBS=
>  endif
> diff --git a/Makefile.target b/Makefile.target
> index 6032af0..82bc746 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -652,7 +652,7 @@ OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
>  OBJS+= unin_pci.o ppc_chrp.o
>  # PowerPC 4xx boards
>  OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
> -OBJS+= ppc440.o
> +OBJS+= ppc440.o ppc440_bamboo.o
>  ifdef CONFIG_KVM
>  OBJS+= kvm_ppc.o
>  endif
> diff --git a/hw/boards.h b/hw/boards.h
> index d30c0fc..debe9a6 100644
> --- a/hw/boards.h
> +++ b/hw/boards.h
> @@ -38,6 +38,7 @@ extern QEMUMachine core99_machine;
>  extern QEMUMachine heathrow_machine;
>  extern QEMUMachine ref405ep_machine;
>  extern QEMUMachine taihu_machine;
> +extern QEMUMachine bamboo_machine;
>  
>  /* mips_r4k.c */
>  extern QEMUMachine mips_machine;
> diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
> new file mode 100644
> index 0000000..b0e3106
> --- /dev/null
> +++ b/hw/ppc440_bamboo.c
> @@ -0,0 +1,190 @@
> +/*
> + * Qemu PowerPC 440 board emulation
> + *
> + * Copyright 2007 IBM Corporation.
> + * Authors:
> + * 	Jerone Young <jyoung5@us.ibm.com>
> + * 	Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
> + * 	Hollis Blanchard <hollisb@us.ibm.com>
> + *
> + * This work is licensed under the GNU GPL license version 2 or later.
> + *
> + */
> +
> +#include "config.h"
> +#include "qemu-common.h"
> +#include "net.h"
> +#include "hw.h"
> +#include "pci.h"
> +#include "virtio-blk.h"
> +#include "boards.h"
> +#include "sysemu.h"
> +#include "ppc440.h"
> +#include "kvm.h"
> +#include "kvm_ppc.h"
> +#include "device_tree.h"
> +
> +#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
> +
> +static void *bamboo_load_device_tree(void *addr,
> +                                     uint32_t ramsize,
> +                                     target_phys_addr_t initrd_base,
> +                                     target_phys_addr_t initrd_size,
> +                                     const char *kernel_cmdline)
> +{
> +    void *fdt = NULL;
> +#ifdef HAVE_FDT
>   

Is this at all usable without libfdt?  If not, just don't compile this 
board in unless libfdt is present.

> +    uint32_t mem_reg_property[] = { 0, 0, ramsize };
> +    char *path = NULL;
> +    int len;
> +    int ret;
> +
> +    len = asprintf(&path, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);
>   

asprintf() is a GNU-ism and won't compile on Win32.

> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
> index be0cbe1..72f67d0 100644
> --- a/target-ppc/machine.c
> +++ b/target-ppc/machine.c
> @@ -1,5 +1,6 @@
>  #include "hw/hw.h"
>  #include "hw/boards.h"
> +#include "kvm.h"

Is this necessary?

>  
>  void register_machines(void)
>  {
> @@ -8,6 +9,7 @@ void register_machines(void)
>      qemu_register_machine(&prep_machine);
>      qemu_register_machine(&ref405ep_machine);
>      qemu_register_machine(&taihu_machine);
> +    qemu_register_machine(&bamboo_machine);
>  }
>  
>  void cpu_save(QEMUFile *f, void *opaque)
>   


Regards,

Anthony Liguori

  parent reply	other threads:[~2008-12-11 21:39 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 20:52 PowerPC KVM support Hollis Blanchard
2008-12-11 20:52 ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 1/6] Include headers for types used in helper_regs.h Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:57   ` Hollis Blanchard
2008-12-11 20:57     ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:24   ` [Qemu-devel] " Anthony Liguori
2008-12-11 21:24     ` Anthony Liguori
2008-12-13  0:23     ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during Hollis Blanchard
2008-12-13  0:23       ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-13  0:24       ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during Hollis Blanchard
2008-12-13  0:24         ` [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization Hollis Blanchard
2008-12-13 16:37         ` Anthony Liguori
2008-12-13 16:37           ` Anthony Liguori
2008-12-11 20:52 ` [PATCH 3/6] Enable KVM for ppcemb Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:19   ` Blue Swirl
2008-12-12  0:04     ` Hollis Blanchard
2008-12-11 21:30   ` Anthony Liguori
2008-12-11 21:30     ` Anthony Liguori
2008-12-11 22:54     ` Hollis Blanchard
2008-12-11 22:54       ` Hollis Blanchard
2008-12-14  1:37       ` Hollis Blanchard
2008-12-14  1:37         ` Hollis Blanchard
2008-12-14  3:29         ` Anthony Liguori
2008-12-14  3:29           ` Anthony Liguori
2008-12-11 20:52 ` [PATCH 4/6] Implement device tree support needed for Bamboo emulation Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:33   ` [Qemu-devel] [PATCH 4/6] Implement device tree support needed Anthony Liguori
2008-12-11 21:33     ` [Qemu-devel] [PATCH 4/6] Implement device tree support needed for Bamboo emulation Anthony Liguori
2008-12-11 20:52 ` [PATCH 5/6] PowerPC 440EP SoC emulation Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 20:52 ` [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation Hollis Blanchard
2008-12-11 20:52   ` [Qemu-devel] " Hollis Blanchard
2008-12-11 21:25   ` Blue Swirl
2008-12-11 21:25     ` Blue Swirl
2008-12-11 21:39   ` Anthony Liguori [this message]
2008-12-11 21:39     ` Anthony Liguori
2008-12-11 23:08     ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference Hollis Blanchard
2008-12-11 23:08       ` [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation Hollis Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=494188A2.10009@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.