From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAtGC-00036T-IL for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:39:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAtGB-00035c-VC for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:39:52 -0500 Received: from [199.232.76.173] (port=39346 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAtGB-00035Y-Lu for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:39:51 -0500 Received: from an-out-0708.google.com ([209.85.132.244]:20274) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAtGB-0003tN-2e for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:39:51 -0500 Received: by an-out-0708.google.com with SMTP id c38so536152ana.37 for ; Thu, 11 Dec 2008 13:39:50 -0800 (PST) Message-ID: <494188A2.10009@codemonkey.ws> Date: Thu, 11 Dec 2008 15:39:46 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation References: <1229028752-9480-1-git-send-email-hollisb@us.ibm.com> <8d7e31f5f951172065c0bb9a6ec333a052c7ece2.1229027683.git.hollisb@us.ibm.com> In-Reply-To: <8d7e31f5f951172065c0bb9a6ec333a052c7ece2.1229027683.git.hollisb@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm-ppc@vger.kernel.org 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 > --- > 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 > + * Christian Ehrhardt > + * Hollis Blanchard > + * > + * 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