* [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM
@ 2008-12-16 23:27 ` Hollis Blanchard
0 siblings, 0 replies; 4+ messages in thread
From: Hollis Blanchard @ 2008-12-16 23:27 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, kvm-ppc
PowerPC KVM support was accepted into upstream qemu. To ease the merge
conflicts, you should apply this patch to remove all traces of PowerPC
KVM code from kvm-userspace before the next qemu pull.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
---
You'll also want to remove qemu/pc-bios/bamboo.dtb, which I can't
express in this patch because guilt sucks.
Sorry if I missed anything; let me know if you you have problems.
diff --git a/qemu/Makefile b/qemu/Makefile
index b2ca039..745851d 100644
--- a/qemu/Makefile
+++ b/qemu/Makefile
@@ -228,7 +228,6 @@ 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
BLOBS += extboot.bin
-BLOBS += bamboo.dtb
else
BLOBS endif
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 315c3c9..a304570 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -231,12 +231,6 @@ LIBOBJS+=qemu-kvm-helper.o
endif
endif
-ifeq ($(TARGET_BASE_ARCH), ppc)
-ifeq ($(USE_KVM), 1)
-LIBOBJS+= qemu-kvm-powerpc.o
-endif
-endif
-
LIBOBJS+= op_helper.o
ifneq ($(TARGET_ARCH), ia64)
@@ -679,11 +673,6 @@ ifdef CONFIG_BLUEZ
LIBS += $(CONFIG_BLUEZ_LIBS)
endif
-ifdef CONFIG_LIBFDT
-LIBS += -lfdt
-DEPLIBS += ../libfdt/libfdt.a
-endif
-
# SCSI layer
OBJS+= lsi53c895a.o esp.o
@@ -747,7 +736,6 @@ 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 ppc440_bamboo.o device_tree.o
# virtio support
OBJS+= virtio.o virtio-blk.o virtio-balloon.o
OBJS+= virtio-net.o
diff --git a/qemu/configure b/qemu/configure
index 5f5264f..468896e 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -124,7 +124,6 @@ blobs="yes"
signalfd="no"
eventfd="no"
cpu_emulation="yes"
-device_tree_support=""
# OS specific
targetos=`uname -s`
@@ -389,8 +388,6 @@ for opt do
;;
--disable-cpu-emulation) cpu_emulation="no"
;;
- --disable-libfdt) device_tree_support="no"
- ;;
*) echo "ERROR: unknown option $opt"; exit 1
;;
esac
@@ -503,7 +500,6 @@ echo " --disable-aio disable AIO support"
echo " --disable-blobs disable installing provided firmware blobs"
echo " --kerneldir=PATH look for kernel includes in PATH"
echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
-echo " --disable-libfdt disables use of libfdt support for device tree"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -1092,31 +1088,6 @@ else
binsuffix="/bin"
fi
-######################################
-# libfdt probe
-#
-if test -z "$device_tree_support" -a \
- "$cpu" = "powerpc"; then
- device_tree_support="no"
- cat > $TMPC << EOF
-#include <libfdt.h>
-/* XXX uncomment later when libfdt is built before this test */
-//int main(void) { void *fdt; return fdt_create(fdt, 1024); }
-int main (void) {return 0;}
-EOF
-# XXX for now do not try to link to libfdt and just check for header */
-# if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
- if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
- device_tree_support="yes"
- else
- echo
- echo "Error: Could not find libfdt"
- echo "Make sure to have the libfdt libs and headers installed."
- echo
- exit 1
- fi
-fi
-
echo "Install prefix $prefix"
echo "BIOS directory $prefix$datasuffix"
echo "binary directory $prefix$binsuffix"
@@ -1161,9 +1132,6 @@ fi
echo "kqemu support $kqemu"
echo "kvm support $kvm"
echo "CPU emulation $cpu_emulation"
-if test $cpu = "powerpc"; then
-echo "libfdt support $device_tree_support"
-fi
echo "brlapi support $brlapi"
echo "Documentation $build_docs"
[ ! -z "$uname_release" ] && \
@@ -1726,10 +1694,6 @@ case "$target_cpu" in
echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
echo "#define TARGET_PPC 1" >> $config_h
echo "#define TARGET_PPCEMB 1" >> $config_h
- if test "$device_tree_support" = "yes" ; then
- echo "#define CONFIG_LIBFDT 1" >> $config_h
- echo "CONFIG_LIBFDT=1" >> $config_mak
- fi
configure_kvm
;;
ppc64)
diff --git a/qemu/hw/boards.h b/qemu/hw/boards.h
index d2b26c6..fae6d19 100644
--- a/qemu/hw/boards.h
+++ b/qemu/hw/boards.h
@@ -40,7 +40,6 @@ 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/qemu/hw/device_tree.c b/qemu/hw/device_tree.c
deleted file mode 100644
index 2621ff1..0000000
--- a/qemu/hw/device_tree.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Functions to help device tree manipulation using libfdt.
- * It also provides functions to read entries from device tree proc
- * interface.
- *
- * Copyright 2008 IBM Corporation.
- * Authors: Jerone Young <jyoung5@us.ibm.com>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "config.h"
-#include "ppc440.h"
-
-#ifdef CONFIG_LIBFDT
-#include "libfdt.h"
-#endif
-
-#define DT_PROC_INTERFACE_PATH "/proc/device-tree"
-
-/* FUNCTIONS FOR READING FROM DEVICE TREE OF HOST IN /PROC */
-
-/* This function reads device-tree property files that are of
- * a single cell size
- */
-uint32_t read_proc_dt_prop_cell(const char *path_in_device_tree)
-{
- char *buf = NULL;
- int i;
- uint32_t num;
- FILE *stream;
-
- i = asprintf(&buf, "%s/%s", DT_PROC_INTERFACE_PATH,
- path_in_device_tree);
-
- if (i < 0) {
- printf("%s: Unable to malloc string buffer buf\n",
- __func__);
- exit(1);
- }
-
- stream = fopen(buf, "rb");
-
- if (stream = NULL) {
- printf("%s: Unable to open '%s'\n", __func__, buf);
- exit(1);
- }
-
- fread(&num, sizeof(num), 1, stream);
- fclose(stream);
- free(buf);
-
- return num;
-}
-
-/* FUNCTIONS FOR LOADING & MANIPULATION OF DEVICE TREE IN GUEST */
-
-#ifdef CONFIG_LIBFDT
-/* support functions */
-static int get_offset_of_node(void *fdt, const char *node_path)
-{
- int node_offset;
- node_offset = fdt_path_offset(fdt, node_path);
- if (node_offset < 0) {
- printf("Unable to find node in device tree '%s'\n",
- node_path);
- exit(1);
- }
- return node_offset;
-}
-
-/* public functions */
-void *load_device_tree(const char *filename_path, unsigned long load_addr)
-{
- int dt_file_size;
- int dt_file_load_size;
- int new_dt_size;
- int ret;
- void *dt_file = NULL;
- void *fdt;
-
- dt_file_size = get_image_size(filename_path);
- if (dt_file_size < 0) {
- printf("Unable to get size of device tree file '%s'\n",
- filename_path);
- goto fail;
- }
-
- /* First allocate space in qemu for device tree */
- dt_file = qemu_malloc(dt_file_size);
- if (dt_file = NULL) {
- printf("Unable to allocate memory in qemu for device tree\n");
- goto fail;
- }
- memset(dt_file, 0, dt_file_size);
-
- dt_file_load_size = load_image(filename_path, dt_file);
-
-
- /* XXX Second we place new copy of 2x size in guest memory
- * This give us enough room for manipulation.
- */
- new_dt_size = dt_file_size * 2;
-
- fdt = (void *)load_addr;
-
- ret = fdt_open_into(dt_file, fdt, new_dt_size);
- if (ret) {
- printf("Unable to copy device tree in memory\n");
- goto fail;
- }
-
- /* Check sanity of device tree */
- if (fdt_check_header(fdt)) {
- printf ("Device tree file loaded into memory is invalid: %s\n",
- filename_path);
- goto fail;
- }
- /* free qemu memory with old device tree */
- qemu_free(dt_file);
- return fdt;
-
-fail:
- if (dt_file)
- qemu_free(dt_file);
- return NULL;
-}
-
-void dump_device_tree_to_file(void *fdt, const char *filename)
-{
- int fd;
- fd = open(filename, O_RDWR|O_CREAT, O_RDWR);
- if (fd < 0) {
- printf("Failed to open file %s\n Cannot dum device-tree\n",
- filename);
- return;
- }
-
- write(fd, fdt, fdt_totalsize(fdt));
- close(fd);
-}
-
-void dt_cell(void *fdt, const char *node_path, const char *property,
- uint32_t val)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop_cell(fdt, offset, property, val);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-
-/* This function is to manipulate a cell with multiple values */
-void dt_cell_multi(void *fdt, const char *node_path, const char *property,
- uint32_t *val_array, int size)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop(fdt, offset, property, val_array, size);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-
-void dt_string(void *fdt, const char *node_path, const char *property,
- char *string)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop_string(fdt, offset, property, string);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-#endif
diff --git a/qemu/hw/device_tree.h b/qemu/hw/device_tree.h
deleted file mode 100644
index a311309..0000000
--- a/qemu/hw/device_tree.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Header with function prototypes to help device tree manipulation using
- * libfdt. It also provides functions to read entries from device tree proc
- * interface.
- *
- * Copyright 2008 IBM Corporation.
- * Authors: Jerone Young <jyoung5@us.ibm.com>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-/* device-tree proc support functions */
-uint32_t read_proc_dt_prop_cell(const char *path_in_device_tree);
-
-#ifdef CONFIG_LIBFDT
-/* device tree functions */
-void *load_device_tree(const char *filename_path, target_ulong load_addr);
-void dump_device_tree_to_file(void *fdt, const char *filename);
-void dt_cell(void *fdt, const char *node_path, const char *property,
- uint32_t val);
-void dt_cell_multi(void *fdt, const char *node_path, const char *property,
- uint32_t *val_array, int size);
-void dt_string(void *fdt, const char *node_path, const char *property,
- char *string);
-#endif
diff --git a/qemu/hw/ppc440.c b/qemu/hw/ppc440.c
deleted file mode 100644
index 249add5..0000000
--- a/qemu/hw/ppc440.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors: Jerone Young <jyoung5@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-
-#include "hw.h"
-#include "hw/isa.h"
-#include "ppc440.h"
-#include "pci.h"
-
-#define PPC440EP_PCI_CONFIG 0xeec00000
-#define PPC440EP_PCI_INTACK 0xeed00000
-#define PPC440EP_PCI_SPECIAL 0xeed00000
-#define PPC440EP_PCI_REGS 0xef400000
-#define PPC440EP_PCI_IO 0xe8000000
-#define PPC440EP_PCI_IOLEN 0x10000
-#define PPC440EP_PCI_MEM 0xa0000000
-#define PPC440EP_PCI_MEMLEN 0x20000000
-
-
-void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
- int nbanks,
- qemu_irq **picp,
- PCIBus **pcibusp,
- int do_init)
-{
- ppc4xx_mmio_t *mmio;
- qemu_irq *pic, *irqs;
- PCIBus *pcibus;
- int i;
-
- ppc_dcr_init(env, NULL, NULL);
-
- /* mmio */
- printf("setup mmio\n");
- mmio = ppc4xx_mmio_init(env, 0xEF600000);
-
- /* universal controller */
- printf("setup universal controller\n");
- irqs = qemu_mallocz(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB);
- irqs[PPCUIC_OUTPUT_INT] - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT];
- irqs[PPCUIC_OUTPUT_CINT] - ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT];
- pic = ppcuic_init(env, irqs, 0x0C0, 0, 1);
- *picp = pic;
-
- /* SDRAM controller */
- printf("trying to setup sdram controller\n");
- /* XXX 440EP's ECC interrupts are on UIC1 */
- ppc405_sdram_init(env, pic[14], nbanks, ram_bases, ram_sizes, do_init);
-
- /* PCI */
- pcibus = ppc4xx_pci_init(env, pic,
- PPC440EP_PCI_CONFIG,
- PPC440EP_PCI_INTACK,
- PPC440EP_PCI_SPECIAL,
- PPC440EP_PCI_REGS);
- if (!pcibus)
- printf("couldn't create PCI controller!\n");
- *pcibusp = pcibus;
-
- isa_mmio_init(PPC440EP_PCI_IO, PPC440EP_PCI_IOLEN);
-
- /* serial ports on page 126 of 440EP user manual */
- if (serial_hds[0]) {
- printf("Initializing first serial port\n");
- ppc405_serial_init(env, mmio,0x300, pic[0], serial_hds[0]);
- }
- if (serial_hds[1]) {
- printf("Initializing 2nd serial port\n");
- ppc405_serial_init(env, mmio,0x400, pic[1], serial_hds[1]);
- }
-}
diff --git a/qemu/hw/ppc440.h b/qemu/hw/ppc440.h
deleted file mode 100644
index 9523f94..0000000
--- a/qemu/hw/ppc440.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors: Jerone Young <jyoung5@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- *
- * This work is licensed under the GNU GPL licence version 2 or later
- *
- */
-
-#ifndef QEMU_PPC440_H
-#define QEMU_PPC440_H
-
-#include "hw.h"
-#include "ppc.h"
-#include "ppc405.h"
-#include "pc.h"
-#include "qemu-timer.h"
-#include "sysemu.h"
-#include "exec-all.h"
-#include "boards.h"
-#include "pci.h"
-
-#define PPC440_MAX_RAM_SLOTS 4
-
-void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
- int nbanks,
- qemu_irq **picp,
- PCIBus **pcip,
- int do_init);
-
-#endif
diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
deleted file mode 100644
index 50959cb..0000000
--- a/qemu/hw/ppc440_bamboo.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors:
- * Jerone Young <jyoung5@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.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 "sysemu.h"
-#include "ppc440.h"
-#include "qemu-kvm.h"
-#include "device_tree.h"
-#include "virtio-blk.h"
-
-#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
-
-#define bytes_to_mb(a) (a>>20)
-
-void bamboo_init(ram_addr_t ram_size, int vga_ram_size,
- const char *boot_device, DisplayState *ds,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model)
-{
- char *buf=NULL;
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS];
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS];
- NICInfo *nd;
- qemu_irq *pic;
- PCIBus *pcibus;
- CPUState *env;
- uint64_t elf_entry;
- uint64_t elf_lowaddr;
- target_ulong entry = 0;
- target_ulong loadaddr = 0;
- target_long kernel_size = 0;
- target_ulong initrd_base = 0;
- target_long initrd_size = 0;
- target_ulong dt_base = 0;
- void *fdt;
- int ret;
- int ram_stick_sizes[] = {256<<20, 128<<20, 64<<20,
- 32<<20, 16<<20, 8<<20 }; /* in bytes */
- int nbanks = 0; /* number of used memory banks */
- int next_bank_offset = 0;
- ram_addr_t tmp_ram_size;
- int i=0, k=0;
- uint32_t cpu_freq;
- uint32_t timebase_freq;
- uint32_t mem_reg_property[]={0, 0, ram_size};
-
- printf("%s: START\n", __func__);
-
- /* Setup Memory */
- if (ram_size < 8<<20) {
- printf("ERROR: ram size too small (min 8mb)\n");
- exit(1);
- } else
- printf("Ram size passed is: %i MB\n",
- bytes_to_mb((int)ram_size));
-
- tmp_ram_size = ram_size;
-
- for (i = 0; i < PPC440_MAX_RAM_SLOTS; i++) {
- for (k = 0; k < (sizeof(ram_stick_sizes)/sizeof(int)); k++) {
- if ((tmp_ram_size/ram_stick_sizes[k]) > 0) {
- ram_sizes[i] = ram_stick_sizes[k];
- ram_bases[i] = next_bank_offset;
- next_bank_offset += ram_stick_sizes[k];
- nbanks++;
- tmp_ram_size -= ram_stick_sizes[k];
- break;
- }
- }
- }
-
- if (tmp_ram_size) {
- printf("WARNING: %i MB left over memory is ram\n",
- bytes_to_mb((int)tmp_ram_size));
- ram_size -= tmp_ram_size;
- mem_reg_property[2] = ram_size;
- }
-
- /* Setup CPU.
- * XXX Since qemu doesn't implement 440, we just say it's a 405. Since
- * we don't use qemu's CPU emulation it seems to be working OK. */
- env = cpu_ppc_init("405");
- if (!env) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
-
- /* call init */
- printf("Calling function ppc440_init\n");
- ppc440ep_init(env, ram_bases, ram_sizes, nbanks, &pic, &pcibus, 1);
- printf("Done calling ppc440_init\n");
-
- /* load kernel with uboot loader */
- printf("%s: load kernel\n", __func__);
- kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
- if (kernel_size < 0) {
- kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr,
- NULL);
- entry = elf_entry;
- loadaddr = elf_lowaddr;
- }
-
- if (kernel_size < 0) {
- fprintf(stderr, "qemu: could not load kernel '%s'\n",
- kernel_filename);
- exit(1);
- }
- printf("kernel is at guest address: 0x%lx\n", (unsigned long)loadaddr);
-
- /* load initrd */
- if (initrd_filename) {
- initrd_base = kernel_size + loadaddr;
- printf("%s: load initrd\n", __func__);
- initrd_size = load_image(initrd_filename,
- phys_ram_base + initrd_base);
-
- printf("initrd is at guest address: 0x%lx\n",
- (unsigned long) initrd_base);
-
- if (initrd_size < 0) {
- fprintf(stderr,
- "qemu: could not load initial ram disk '%s'\n",
- initrd_filename);
- exit(1);
- }
- }
-
-#ifdef CONFIG_LIBFDT
- /* get variable for device tree */
- cpu_freq = read_proc_dt_prop_cell("cpus/cpu@0/clock-frequency");
- timebase_freq = read_proc_dt_prop_cell("cpus/cpu@0/timebase-frequency");
-
- /* load binary device tree into qemu (not guest memory) */
- printf("%s: load device tree file\n", __func__);
-
- /* get string size */
- ret = asprintf(&buf, "%s/%s", bios_dir,
- BINARY_DEVICE_TREE_FILE);
-
- if (ret < 0) {
- printf("%s: Unable to malloc string buffer buf\n",
- __func__);
- exit(1);
- }
-
- /* set base for device tree that will be in guest memory */
- if (initrd_base)
- dt_base = initrd_base + initrd_size;
- else
- dt_base = kernel_size + loadaddr;
-
- fdt = load_device_tree(buf, (unsigned long)(phys_ram_base + dt_base));
- if (fdt = NULL) {
- printf("Loading device tree failed!\n");
- exit(1);
- }
-
- printf("device tree address is at guest address: 0x%lx\n",
- (unsigned long) dt_base);
-
- free(buf);
-
- /* manipulate device tree in memory */
- dt_cell(fdt, "/cpus/cpu@0", "clock-frequency", cpu_freq);
- dt_cell(fdt, "/cpus/cpu@0", "timebase-frequency", timebase_freq);
- dt_cell_multi(fdt, "/memory", "reg", mem_reg_property,
- sizeof(mem_reg_property));
- dt_cell(fdt, "/chosen", "linux,initrd-start", initrd_base);
- dt_cell(fdt, "/chosen", "linux,initrd-end",
- (initrd_base + initrd_size));
- dt_string(fdt, "/chosen", "bootargs", (char *)kernel_cmdline);
-#endif
-
- if (kvm_enabled()) {
- /* XXX insert TLB entries */
- env->gpr[1] = (16<<20) - 8;
-
-#ifdef CONFIG_LIBFDT
- /* location of device tree in register */
- env->gpr[3] = dt_base;
-#endif
- env->nip = entry;
- }
-
- if (pcibus) {
- int unit_id = 0;
-
- /* Add virtio block devices. */
- while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
- virtio_blk_init(pcibus, 0x1AF4, 0x1001,
- drives_table[i].bdrv);
- unit_id++;
- }
-
- /* Register network interfaces. */
- for (i = 0; i < nb_nics; i++) {
- nd = &nd_table[i];
- if (!nd->model)
- nd->model = "virtio";
- pci_nic_init(pcibus, nd, -1);
- }
- }
-
- printf("%s: DONE\n", __func__);
-}
-
-QEMUMachine bamboo_machine = {
- .name = "bamboo",
- .desc = "bamboo",
- .init = bamboo_init,
- .max_cpus = 1,
-};
diff --git a/qemu/pc-bios/bamboo.dts b/qemu/pc-bios/bamboo.dts
deleted file mode 100644
index 655442c..0000000
--- a/qemu/pc-bios/bamboo.dts
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Device Tree Source for AMCC Bamboo
- *
- * Copyright (c) 2006, 2007 IBM Corp.
- * Josh Boyer <jwboyer@linux.vnet.ibm.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without
- * any warranty of any kind, whether express or implied.
- */
-
-/ {
- #address-cells = <2>;
- #size-cells = <1>;
- model = "amcc,bamboo";
- compatible = "amcc,bamboo";
- dcr-parent = <&/cpus/cpu@0>;
-
- aliases {
- serial0 = &UART0;
- serial1 = &UART1;
- };
-
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-
- cpu@0 {
- device_type = "cpu";
- model = "PowerPC,440EP";
- reg = <0>;
- clock-frequency = <1fca0550>;
- timebase-frequency = <017d7840>;
- i-cache-line-size = <20>;
- d-cache-line-size = <20>;
- i-cache-size = <8000>;
- d-cache-size = <8000>;
- dcr-controller;
- dcr-access-method = "native";
- };
- };
-
- memory {
- device_type = "memory";
- reg = <0 0 9000000>;
- };
-
- UIC0: interrupt-controller0 {
- compatible = "ibm,uic-440ep","ibm,uic";
- interrupt-controller;
- cell-index = <0>;
- dcr-reg = <0c0 009>;
- #address-cells = <0>;
- #size-cells = <0>;
- #interrupt-cells = <2>;
- };
-/*
- UIC1: interrupt-controller1 {
- compatible = "ibm,uic-440ep","ibm,uic";
- interrupt-controller;
- cell-index = <1>;
- dcr-reg = <0d0 009>;
- #address-cells = <0>;
- #size-cells = <0>;
- #interrupt-cells = <2>;
- interrupts = <1e 4 1f 4>;
- interrupt-parent = <&UIC0>;
- };
-*/
-
- SDR0: sdr {
- compatible = "ibm,sdr-440ep";
- dcr-reg = <00e 002>;
- };
-
- CPR0: cpr {
- compatible = "ibm,cpr-440ep";
- dcr-reg = <00c 002>;
- };
-
- plb {
- compatible = "ibm,plb-440ep", "ibm,plb-440gp", "ibm,plb4";
- #address-cells = <2>;
- #size-cells = <1>;
- ranges;
- clock-frequency = <07f28154>;
-
- SDRAM0: sdram {
- compatible = "ibm,sdram-440ep", "ibm,sdram-405gp";
- dcr-reg = <010 2>;
- };
-
- DMA0: dma {
- compatible = "ibm,dma-440ep", "ibm,dma-440gp";
- dcr-reg = <100 027>;
- };
-
- POB0: opb {
- compatible = "ibm,opb-440ep", "ibm,opb-440gp", "ibm,opb";
- #address-cells = <1>;
- #size-cells = <1>;
- /* Bamboo is oddball in the 44x world and doesn't use the ERPN
- * bits.
- */
- ranges = <00000000 0 00000000 80000000
- 80000000 0 80000000 80000000>;
- /* interrupt-parent = <&UIC1>; */
- interrupts = <7 4>;
- clock-frequency = <03f940aa>;
-
- EBC0: ebc {
- compatible = "ibm,ebc-440ep", "ibm,ebc-440gp", "ibm,ebc";
- dcr-reg = <012 2>;
- #address-cells = <2>;
- #size-cells = <1>;
- clock-frequency = <03f940aa>;
- interrupts = <5 1>;
- /* interrupt-parent = <&UIC1>; */
- };
-
- UART0: serial@ef600300 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600300 8>;
- virtual-reg = <ef600300>;
- clock-frequency = <00a8c000>;
- current-speed = <1c200>;
- interrupt-parent = <&UIC0>;
- interrupts = <0 4>;
- };
-
- UART1: serial@ef600400 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600400 8>;
- virtual-reg = <ef600400>;
- clock-frequency = <00a8c000>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <1 4>;
- };
-/*
- UART2: serial@ef600500 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600500 8>;
- virtual-reg = <ef600500>;
- clock-frequency = <0>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <3 4>;
- };
-
- UART3: serial@ef600600 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600600 8>;
- virtual-reg = <ef600600>;
- clock-frequency = <0>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <4 4>;
- };
-
-*/
- IIC0: i2c@ef600700 {
- device_type = "i2c";
- compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
- reg = <ef600700 14>;
- interrupt-parent = <&UIC0>;
- interrupts = <2 4>;
- };
-
- IIC1: i2c@ef600800 {
- device_type = "i2c";
- compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
- reg = <ef600800 14>;
- interrupt-parent = <&UIC0>;
- interrupts = <7 4>;
- };
-
- ZMII0: emac-zmii@ef600d00 {
- device_type = "zmii-interface";
- compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii";
- reg = <ef600d00 c>;
- };
-
- };
-
- PCI0: pci@ec000000 {
- device_type = "pci";
- #interrupt-cells = <1>;
- #size-cells = <2>;
- #address-cells = <3>;
- compatible = "ibm,plb440ep-pci", "ibm,plb-pci";
- primary;
- reg = <0 eec00000 8 /* Config space access */
- 0 eed00000 4 /* IACK */
- 0 eed00000 4 /* Special cycle */
- 0 ef400000 40>; /* Internal registers */
-
- /* Outbound ranges, one memory and one IO,
- * later cannot be changed. Chip supports a second
- * IO range but we don't use it for now
- */
- ranges = <02000000 0 a0000000 0 a0000000 0 20000000
- 01000000 0 00000000 0 e8000000 0 00010000>;
-
- /* Inbound 2GB range starting at 0 */
- dma-ranges = <42000000 0 0 0 0 0 80000000>;
-
- /* Bamboo has all 4 IRQ pins tied together per slot */
- interrupt-map-mask = <f800 0 0 0>;
- interrupt-map = <
- /* IDSEL 1 */
- 0800 0 0 0 &UIC0 1c 8
-
- /* IDSEL 2 */
- 1000 0 0 0 &UIC0 1b 8
-
- /* IDSEL 3 */
- 1800 0 0 0 &UIC0 1a 8
-
- /* IDSEL 4 */
- 2000 0 0 0 &UIC0 19 8
- >;
- };
-
- };
-
- chosen {
- linux,stdout-path = "/plb/opb/serial@ef600300";
- };
-};
diff --git a/qemu/qemu-kvm-powerpc.c b/qemu/qemu-kvm-powerpc.c
deleted file mode 100644
index dadcd1c..0000000
--- a/qemu/qemu-kvm-powerpc.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * qemu-kvm-power.c
- *
- * Add KVM PowerPC specific calls for qemu.
- *
- * Copyright 2007 IBM Corporation.
- * Added by & Authors:
- * Jerone Young <jyoung5@us.ibm.com>
- * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
- *
- * This work is licensed under the GNU GPL licence version 2 or later.
- *
- */
-
-#include "config.h"
-#include "config-host.h"
-
-#include <string.h>
-#include "hw/hw.h"
-#include "sysemu.h"
-#include "cpu.h"
-#include "exec-all.h"
-#include "helper_regs.h"
-
-#include "qemu-kvm.h"
-#include <libkvm.h>
-#include <pthread.h>
-#include <sys/utsname.h>
-
-extern kvm_context_t kvm_context;
-
-void cpu_reset(CPUState *env)
-{
- memset(env, 0, offsetof(CPUPPCState, breakpoints));
- cpu_ppc_reset(env);
-}
-
-
-int kvm_arch_qemu_create_context(void)
-{
- return 0;
-}
-
-void kvm_arch_load_regs(CPUState *env)
-{
- struct kvm_regs regs;
- int rc,i;
-
- rc = kvm_get_regs(kvm_context, env->cpu_index, ®s);
- if (rc = -1)
- perror("kvm_get_regs FAILED");
-
- /* cr is untouched in qemu and not existant in CPUState fr ppr */
- /* hflags is a morphed to MSR on ppc, no need to sync that down to kvm */
-
- regs.pc = env->nip;
-
- regs.ctr = env->ctr;
- regs.lr = env->lr;
- regs.xer = env->xer;
- regs.msr = env->msr;
-
- regs.srr0 = env->spr[SPR_SRR0];
- regs.srr1 = env->spr[SPR_SRR1];
-
- regs.sprg0 = env->spr[SPR_SPRG0];
- regs.sprg1 = env->spr[SPR_SPRG1];
- regs.sprg2 = env->spr[SPR_SPRG2];
- regs.sprg3 = env->spr[SPR_SPRG3];
- regs.sprg4 = env->spr[SPR_SPRG4];
- regs.sprg5 = env->spr[SPR_SPRG5];
- regs.sprg6 = env->spr[SPR_SPRG6];
- regs.sprg7 = env->spr[SPR_SPRG7];
-
- for (i = 0;i < 32; i++){
- regs.gpr[i] = env->gpr[i];
- }
-
- rc = kvm_set_regs(kvm_context, env->cpu_index, ®s);
- if (rc = -1)
- perror("kvm_set_regs FAILED");
-}
-
-
-void kvm_arch_save_regs(CPUState *env)
-{
- struct kvm_regs regs;
- uint32_t i, rc;
-
- rc = kvm_get_regs(kvm_context, env->cpu_index, ®s);
- if (rc = -1)
- perror("kvm_get_regs FAILED");
-
- env->ctr =regs.ctr;
- env->lr = regs.lr;
- env->xer = regs.xer;
- env->msr = regs.msr;
- /* calculate hflags based on the current msr using the ppc qemu helper */
- hreg_compute_hflags(env);
-
- env->nip = regs.pc;
-
- env->spr[SPR_SRR0] = regs.srr0;
- env->spr[SPR_SRR1] = regs.srr1;
-
- env->spr[SPR_SPRG0] = regs.sprg0;
- env->spr[SPR_SPRG1] = regs.sprg1;
- env->spr[SPR_SPRG2] = regs.sprg2;
- env->spr[SPR_SPRG3] = regs.sprg3;
- env->spr[SPR_SPRG4] = regs.sprg4;
- env->spr[SPR_SPRG5] = regs.sprg5;
- env->spr[SPR_SPRG6] = regs.sprg6;
- env->spr[SPR_SPRG7] = regs.sprg7;
-
- for (i = 0;i < 32; i++){
- env->gpr[i] = regs.gpr[i];
- }
-
-}
-
-int kvm_arch_qemu_init_env(CPUState *cenv)
-{
- if (cenv->cpu_index = 0) {
- /* load any registers set in env into
- kvm for the first guest vcpu */
- kvm_load_registers(cenv);
- }
-
- return 0;
-}
-
-int kvm_arch_halt(void *opaque, int vcpu)
-{
- CPUState *env = cpu_single_env;
-
- if (!(env->interrupt_request & CPU_INTERRUPT_HARD)
- && (msr_ee))
- {
- env->halted = 1;
- env->exception_index = EXCP_HLT;
- }
- return 1;
-}
-
-void kvm_arch_pre_kvm_run(void *opaque, CPUState *env)
-{
- return;
-}
-
-void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
-{
- cpu_single_env = env;
-}
-
-int kvm_arch_has_work(CPUState *env)
-{
- if ((env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) &&
- (msr_ee))
- return 1;
- return 0;
-}
-
-int kvm_arch_try_push_interrupts(void *opaque)
-{
- CPUState *env = cpu_single_env;
- int r;
- unsigned irq;
-
- /* PowerPC Qemu tracks the various core input pins (interrupt, critical
- * interrupt, reset, etc) in PPC-specific env->irq_input_state. */
- if (kvm_is_ready_for_interrupt_injection(kvm_context, env->cpu_index) &&
- (env->irq_input_state & (1<<PPC40x_INPUT_INT)))
- {
- /* For now KVM disregards the 'irq' argument. However, in the
- * future KVM could cache it in-kernel to avoid a heavyweight exit
- * when reading the UIC.
- */
- irq = -1U;
-
- r = kvm_inject_irq(kvm_context, env->cpu_index, irq);
- if (r < 0)
- printf("cpu %d fail inject %x\n", env->cpu_index, irq);
- }
-
- /* We don't know if there are more interrupts pending after this. However,
- * the guest will return to userspace in the course of handling this one
- * anyways, so we will get a chance to deliver the rest. */
- return 0;
-}
-
-void kvm_arch_update_regs_for_sipi(CPUState *env)
-{
- printf("%s: no kvm-powerpc multi processor support yet!\n", __func__);
-}
-
-/* map dcr access to existing qemu dcr emulation */
-int handle_powerpc_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data)
-{
- CPUState *env = cpu_single_env;
- if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0)
- fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn);
-
- return 0; /* XXX ignore failed DCR ops */
-}
-
-int handle_powerpc_dcr_write(int vcpu, uint32_t dcrn, uint32_t data)
-{
- CPUState *env = cpu_single_env;
- if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0)
- fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn);
-
- return 0; /* XXX ignore failed DCR ops */
-}
-
-void kvm_arch_cpu_reset(CPUState *env)
-{
-}
diff --git a/qemu/target-ppc/machine.c b/qemu/target-ppc/machine.c
index ea2257b..be0cbe1 100644
--- a/qemu/target-ppc/machine.c
+++ b/qemu/target-ppc/machine.c
@@ -8,7 +8,6 @@ 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)
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support in qemu
@ 2008-12-16 23:27 ` Hollis Blanchard
0 siblings, 0 replies; 4+ messages in thread
From: Hollis Blanchard @ 2008-12-16 23:27 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, kvm-ppc
PowerPC KVM support was accepted into upstream qemu. To ease the merge
conflicts, you should apply this patch to remove all traces of PowerPC
KVM code from kvm-userspace before the next qemu pull.
Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
You'll also want to remove qemu/pc-bios/bamboo.dtb, which I can't
express in this patch because guilt sucks.
Sorry if I missed anything; let me know if you you have problems.
diff --git a/qemu/Makefile b/qemu/Makefile
index b2ca039..745851d 100644
--- a/qemu/Makefile
+++ b/qemu/Makefile
@@ -228,7 +228,6 @@ 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
BLOBS += extboot.bin
-BLOBS += bamboo.dtb
else
BLOBS=
endif
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 315c3c9..a304570 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -231,12 +231,6 @@ LIBOBJS+=qemu-kvm-helper.o
endif
endif
-ifeq ($(TARGET_BASE_ARCH), ppc)
-ifeq ($(USE_KVM), 1)
-LIBOBJS+= qemu-kvm-powerpc.o
-endif
-endif
-
LIBOBJS+= op_helper.o
ifneq ($(TARGET_ARCH), ia64)
@@ -679,11 +673,6 @@ ifdef CONFIG_BLUEZ
LIBS += $(CONFIG_BLUEZ_LIBS)
endif
-ifdef CONFIG_LIBFDT
-LIBS += -lfdt
-DEPLIBS += ../libfdt/libfdt.a
-endif
-
# SCSI layer
OBJS+= lsi53c895a.o esp.o
@@ -747,7 +736,6 @@ 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 ppc440_bamboo.o device_tree.o
# virtio support
OBJS+= virtio.o virtio-blk.o virtio-balloon.o
OBJS+= virtio-net.o
diff --git a/qemu/configure b/qemu/configure
index 5f5264f..468896e 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -124,7 +124,6 @@ blobs="yes"
signalfd="no"
eventfd="no"
cpu_emulation="yes"
-device_tree_support=""
# OS specific
targetos=`uname -s`
@@ -389,8 +388,6 @@ for opt do
;;
--disable-cpu-emulation) cpu_emulation="no"
;;
- --disable-libfdt) device_tree_support="no"
- ;;
*) echo "ERROR: unknown option $opt"; exit 1
;;
esac
@@ -503,7 +500,6 @@ echo " --disable-aio disable AIO support"
echo " --disable-blobs disable installing provided firmware blobs"
echo " --kerneldir=PATH look for kernel includes in PATH"
echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
-echo " --disable-libfdt disables use of libfdt support for device tree"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -1092,31 +1088,6 @@ else
binsuffix="/bin"
fi
-######################################
-# libfdt probe
-#
-if test -z "$device_tree_support" -a \
- "$cpu" = "powerpc"; then
- device_tree_support="no"
- cat > $TMPC << EOF
-#include <libfdt.h>
-/* XXX uncomment later when libfdt is built before this test */
-//int main(void) { void *fdt; return fdt_create(fdt, 1024); }
-int main (void) {return 0;}
-EOF
-# XXX for now do not try to link to libfdt and just check for header */
-# if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
- if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
- device_tree_support="yes"
- else
- echo
- echo "Error: Could not find libfdt"
- echo "Make sure to have the libfdt libs and headers installed."
- echo
- exit 1
- fi
-fi
-
echo "Install prefix $prefix"
echo "BIOS directory $prefix$datasuffix"
echo "binary directory $prefix$binsuffix"
@@ -1161,9 +1132,6 @@ fi
echo "kqemu support $kqemu"
echo "kvm support $kvm"
echo "CPU emulation $cpu_emulation"
-if test $cpu = "powerpc"; then
-echo "libfdt support $device_tree_support"
-fi
echo "brlapi support $brlapi"
echo "Documentation $build_docs"
[ ! -z "$uname_release" ] && \
@@ -1726,10 +1694,6 @@ case "$target_cpu" in
echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
echo "#define TARGET_PPC 1" >> $config_h
echo "#define TARGET_PPCEMB 1" >> $config_h
- if test "$device_tree_support" = "yes" ; then
- echo "#define CONFIG_LIBFDT 1" >> $config_h
- echo "CONFIG_LIBFDT=1" >> $config_mak
- fi
configure_kvm
;;
ppc64)
diff --git a/qemu/hw/boards.h b/qemu/hw/boards.h
index d2b26c6..fae6d19 100644
--- a/qemu/hw/boards.h
+++ b/qemu/hw/boards.h
@@ -40,7 +40,6 @@ 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/qemu/hw/device_tree.c b/qemu/hw/device_tree.c
deleted file mode 100644
index 2621ff1..0000000
--- a/qemu/hw/device_tree.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Functions to help device tree manipulation using libfdt.
- * It also provides functions to read entries from device tree proc
- * interface.
- *
- * Copyright 2008 IBM Corporation.
- * Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "config.h"
-#include "ppc440.h"
-
-#ifdef CONFIG_LIBFDT
-#include "libfdt.h"
-#endif
-
-#define DT_PROC_INTERFACE_PATH "/proc/device-tree"
-
-/* FUNCTIONS FOR READING FROM DEVICE TREE OF HOST IN /PROC */
-
-/* This function reads device-tree property files that are of
- * a single cell size
- */
-uint32_t read_proc_dt_prop_cell(const char *path_in_device_tree)
-{
- char *buf = NULL;
- int i;
- uint32_t num;
- FILE *stream;
-
- i = asprintf(&buf, "%s/%s", DT_PROC_INTERFACE_PATH,
- path_in_device_tree);
-
- if (i < 0) {
- printf("%s: Unable to malloc string buffer buf\n",
- __func__);
- exit(1);
- }
-
- stream = fopen(buf, "rb");
-
- if (stream == NULL) {
- printf("%s: Unable to open '%s'\n", __func__, buf);
- exit(1);
- }
-
- fread(&num, sizeof(num), 1, stream);
- fclose(stream);
- free(buf);
-
- return num;
-}
-
-/* FUNCTIONS FOR LOADING & MANIPULATION OF DEVICE TREE IN GUEST */
-
-#ifdef CONFIG_LIBFDT
-/* support functions */
-static int get_offset_of_node(void *fdt, const char *node_path)
-{
- int node_offset;
- node_offset = fdt_path_offset(fdt, node_path);
- if (node_offset < 0) {
- printf("Unable to find node in device tree '%s'\n",
- node_path);
- exit(1);
- }
- return node_offset;
-}
-
-/* public functions */
-void *load_device_tree(const char *filename_path, unsigned long load_addr)
-{
- int dt_file_size;
- int dt_file_load_size;
- int new_dt_size;
- int ret;
- void *dt_file = NULL;
- void *fdt;
-
- dt_file_size = get_image_size(filename_path);
- if (dt_file_size < 0) {
- printf("Unable to get size of device tree file '%s'\n",
- filename_path);
- goto fail;
- }
-
- /* First allocate space in qemu for device tree */
- dt_file = qemu_malloc(dt_file_size);
- if (dt_file == NULL) {
- printf("Unable to allocate memory in qemu for device tree\n");
- goto fail;
- }
- memset(dt_file, 0, dt_file_size);
-
- dt_file_load_size = load_image(filename_path, dt_file);
-
-
- /* XXX Second we place new copy of 2x size in guest memory
- * This give us enough room for manipulation.
- */
- new_dt_size = dt_file_size * 2;
-
- fdt = (void *)load_addr;
-
- ret = fdt_open_into(dt_file, fdt, new_dt_size);
- if (ret) {
- printf("Unable to copy device tree in memory\n");
- goto fail;
- }
-
- /* Check sanity of device tree */
- if (fdt_check_header(fdt)) {
- printf ("Device tree file loaded into memory is invalid: %s\n",
- filename_path);
- goto fail;
- }
- /* free qemu memory with old device tree */
- qemu_free(dt_file);
- return fdt;
-
-fail:
- if (dt_file)
- qemu_free(dt_file);
- return NULL;
-}
-
-void dump_device_tree_to_file(void *fdt, const char *filename)
-{
- int fd;
- fd = open(filename, O_RDWR|O_CREAT, O_RDWR);
- if (fd < 0) {
- printf("Failed to open file %s\n Cannot dum device-tree\n",
- filename);
- return;
- }
-
- write(fd, fdt, fdt_totalsize(fdt));
- close(fd);
-}
-
-void dt_cell(void *fdt, const char *node_path, const char *property,
- uint32_t val)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop_cell(fdt, offset, property, val);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-
-/* This function is to manipulate a cell with multiple values */
-void dt_cell_multi(void *fdt, const char *node_path, const char *property,
- uint32_t *val_array, int size)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop(fdt, offset, property, val_array, size);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-
-void dt_string(void *fdt, const char *node_path, const char *property,
- char *string)
-{
- int offset;
- int ret;
- offset = get_offset_of_node(fdt, node_path);
- ret = fdt_setprop_string(fdt, offset, property, string);
- if (ret < 0) {
- printf("Unable to set device tree property '%s'\n",
- property);
- exit(1);
- }
-}
-#endif
diff --git a/qemu/hw/device_tree.h b/qemu/hw/device_tree.h
deleted file mode 100644
index a311309..0000000
--- a/qemu/hw/device_tree.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Header with function prototypes to help device tree manipulation using
- * libfdt. It also provides functions to read entries from device tree proc
- * interface.
- *
- * Copyright 2008 IBM Corporation.
- * Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-/* device-tree proc support functions */
-uint32_t read_proc_dt_prop_cell(const char *path_in_device_tree);
-
-#ifdef CONFIG_LIBFDT
-/* device tree functions */
-void *load_device_tree(const char *filename_path, target_ulong load_addr);
-void dump_device_tree_to_file(void *fdt, const char *filename);
-void dt_cell(void *fdt, const char *node_path, const char *property,
- uint32_t val);
-void dt_cell_multi(void *fdt, const char *node_path, const char *property,
- uint32_t *val_array, int size);
-void dt_string(void *fdt, const char *node_path, const char *property,
- char *string);
-#endif
diff --git a/qemu/hw/ppc440.c b/qemu/hw/ppc440.c
deleted file mode 100644
index 249add5..0000000
--- a/qemu/hw/ppc440.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
- *
- * This work is licensed under the GNU GPL license version 2 or later.
- *
- */
-
-
-#include "hw.h"
-#include "hw/isa.h"
-#include "ppc440.h"
-#include "pci.h"
-
-#define PPC440EP_PCI_CONFIG 0xeec00000
-#define PPC440EP_PCI_INTACK 0xeed00000
-#define PPC440EP_PCI_SPECIAL 0xeed00000
-#define PPC440EP_PCI_REGS 0xef400000
-#define PPC440EP_PCI_IO 0xe8000000
-#define PPC440EP_PCI_IOLEN 0x10000
-#define PPC440EP_PCI_MEM 0xa0000000
-#define PPC440EP_PCI_MEMLEN 0x20000000
-
-
-void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
- int nbanks,
- qemu_irq **picp,
- PCIBus **pcibusp,
- int do_init)
-{
- ppc4xx_mmio_t *mmio;
- qemu_irq *pic, *irqs;
- PCIBus *pcibus;
- int i;
-
- ppc_dcr_init(env, NULL, NULL);
-
- /* mmio */
- printf("setup mmio\n");
- mmio = ppc4xx_mmio_init(env, 0xEF600000);
-
- /* universal controller */
- printf("setup universal controller\n");
- irqs = qemu_mallocz(sizeof(qemu_irq) * PPCUIC_OUTPUT_NB);
- irqs[PPCUIC_OUTPUT_INT] =
- ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_INT];
- irqs[PPCUIC_OUTPUT_CINT] =
- ((qemu_irq *)env->irq_inputs)[PPC40x_INPUT_CINT];
- pic = ppcuic_init(env, irqs, 0x0C0, 0, 1);
- *picp = pic;
-
- /* SDRAM controller */
- printf("trying to setup sdram controller\n");
- /* XXX 440EP's ECC interrupts are on UIC1 */
- ppc405_sdram_init(env, pic[14], nbanks, ram_bases, ram_sizes, do_init);
-
- /* PCI */
- pcibus = ppc4xx_pci_init(env, pic,
- PPC440EP_PCI_CONFIG,
- PPC440EP_PCI_INTACK,
- PPC440EP_PCI_SPECIAL,
- PPC440EP_PCI_REGS);
- if (!pcibus)
- printf("couldn't create PCI controller!\n");
- *pcibusp = pcibus;
-
- isa_mmio_init(PPC440EP_PCI_IO, PPC440EP_PCI_IOLEN);
-
- /* serial ports on page 126 of 440EP user manual */
- if (serial_hds[0]) {
- printf("Initializing first serial port\n");
- ppc405_serial_init(env, mmio,0x300, pic[0], serial_hds[0]);
- }
- if (serial_hds[1]) {
- printf("Initializing 2nd serial port\n");
- ppc405_serial_init(env, mmio,0x400, pic[1], serial_hds[1]);
- }
-}
diff --git a/qemu/hw/ppc440.h b/qemu/hw/ppc440.h
deleted file mode 100644
index 9523f94..0000000
--- a/qemu/hw/ppc440.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
- *
- * This work is licensed under the GNU GPL licence version 2 or later
- *
- */
-
-#ifndef QEMU_PPC440_H
-#define QEMU_PPC440_H
-
-#include "hw.h"
-#include "ppc.h"
-#include "ppc405.h"
-#include "pc.h"
-#include "qemu-timer.h"
-#include "sysemu.h"
-#include "exec-all.h"
-#include "boards.h"
-#include "pci.h"
-
-#define PPC440_MAX_RAM_SLOTS 4
-
-void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
- int nbanks,
- qemu_irq **picp,
- PCIBus **pcip,
- int do_init);
-
-#endif
diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
deleted file mode 100644
index 50959cb..0000000
--- a/qemu/hw/ppc440_bamboo.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Qemu PowerPC 440 board emualtion
- *
- * Copyright 2007 IBM Corporation.
- * Authors:
- * Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
- *
- * 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 "sysemu.h"
-#include "ppc440.h"
-#include "qemu-kvm.h"
-#include "device_tree.h"
-#include "virtio-blk.h"
-
-#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
-
-#define bytes_to_mb(a) (a>>20)
-
-void bamboo_init(ram_addr_t ram_size, int vga_ram_size,
- const char *boot_device, DisplayState *ds,
- const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- const char *cpu_model)
-{
- char *buf=NULL;
- target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS];
- target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS];
- NICInfo *nd;
- qemu_irq *pic;
- PCIBus *pcibus;
- CPUState *env;
- uint64_t elf_entry;
- uint64_t elf_lowaddr;
- target_ulong entry = 0;
- target_ulong loadaddr = 0;
- target_long kernel_size = 0;
- target_ulong initrd_base = 0;
- target_long initrd_size = 0;
- target_ulong dt_base = 0;
- void *fdt;
- int ret;
- int ram_stick_sizes[] = {256<<20, 128<<20, 64<<20,
- 32<<20, 16<<20, 8<<20 }; /* in bytes */
- int nbanks = 0; /* number of used memory banks */
- int next_bank_offset = 0;
- ram_addr_t tmp_ram_size;
- int i=0, k=0;
- uint32_t cpu_freq;
- uint32_t timebase_freq;
- uint32_t mem_reg_property[]={0, 0, ram_size};
-
- printf("%s: START\n", __func__);
-
- /* Setup Memory */
- if (ram_size < 8<<20) {
- printf("ERROR: ram size too small (min 8mb)\n");
- exit(1);
- } else
- printf("Ram size passed is: %i MB\n",
- bytes_to_mb((int)ram_size));
-
- tmp_ram_size = ram_size;
-
- for (i = 0; i < PPC440_MAX_RAM_SLOTS; i++) {
- for (k = 0; k < (sizeof(ram_stick_sizes)/sizeof(int)); k++) {
- if ((tmp_ram_size/ram_stick_sizes[k]) > 0) {
- ram_sizes[i] = ram_stick_sizes[k];
- ram_bases[i] = next_bank_offset;
- next_bank_offset += ram_stick_sizes[k];
- nbanks++;
- tmp_ram_size -= ram_stick_sizes[k];
- break;
- }
- }
- }
-
- if (tmp_ram_size) {
- printf("WARNING: %i MB left over memory is ram\n",
- bytes_to_mb((int)tmp_ram_size));
- ram_size -= tmp_ram_size;
- mem_reg_property[2] = ram_size;
- }
-
- /* Setup CPU.
- * XXX Since qemu doesn't implement 440, we just say it's a 405. Since
- * we don't use qemu's CPU emulation it seems to be working OK. */
- env = cpu_ppc_init("405");
- if (!env) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
-
- /* call init */
- printf("Calling function ppc440_init\n");
- ppc440ep_init(env, ram_bases, ram_sizes, nbanks, &pic, &pcibus, 1);
- printf("Done calling ppc440_init\n");
-
- /* load kernel with uboot loader */
- printf("%s: load kernel\n", __func__);
- kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
- if (kernel_size < 0) {
- kernel_size = load_elf(kernel_filename, 0, &elf_entry, &elf_lowaddr,
- NULL);
- entry = elf_entry;
- loadaddr = elf_lowaddr;
- }
-
- if (kernel_size < 0) {
- fprintf(stderr, "qemu: could not load kernel '%s'\n",
- kernel_filename);
- exit(1);
- }
- printf("kernel is at guest address: 0x%lx\n", (unsigned long)loadaddr);
-
- /* load initrd */
- if (initrd_filename) {
- initrd_base = kernel_size + loadaddr;
- printf("%s: load initrd\n", __func__);
- initrd_size = load_image(initrd_filename,
- phys_ram_base + initrd_base);
-
- printf("initrd is at guest address: 0x%lx\n",
- (unsigned long) initrd_base);
-
- if (initrd_size < 0) {
- fprintf(stderr,
- "qemu: could not load initial ram disk '%s'\n",
- initrd_filename);
- exit(1);
- }
- }
-
-#ifdef CONFIG_LIBFDT
- /* get variable for device tree */
- cpu_freq = read_proc_dt_prop_cell("cpus/cpu@0/clock-frequency");
- timebase_freq = read_proc_dt_prop_cell("cpus/cpu@0/timebase-frequency");
-
- /* load binary device tree into qemu (not guest memory) */
- printf("%s: load device tree file\n", __func__);
-
- /* get string size */
- ret = asprintf(&buf, "%s/%s", bios_dir,
- BINARY_DEVICE_TREE_FILE);
-
- if (ret < 0) {
- printf("%s: Unable to malloc string buffer buf\n",
- __func__);
- exit(1);
- }
-
- /* set base for device tree that will be in guest memory */
- if (initrd_base)
- dt_base = initrd_base + initrd_size;
- else
- dt_base = kernel_size + loadaddr;
-
- fdt = load_device_tree(buf, (unsigned long)(phys_ram_base + dt_base));
- if (fdt == NULL) {
- printf("Loading device tree failed!\n");
- exit(1);
- }
-
- printf("device tree address is at guest address: 0x%lx\n",
- (unsigned long) dt_base);
-
- free(buf);
-
- /* manipulate device tree in memory */
- dt_cell(fdt, "/cpus/cpu@0", "clock-frequency", cpu_freq);
- dt_cell(fdt, "/cpus/cpu@0", "timebase-frequency", timebase_freq);
- dt_cell_multi(fdt, "/memory", "reg", mem_reg_property,
- sizeof(mem_reg_property));
- dt_cell(fdt, "/chosen", "linux,initrd-start", initrd_base);
- dt_cell(fdt, "/chosen", "linux,initrd-end",
- (initrd_base + initrd_size));
- dt_string(fdt, "/chosen", "bootargs", (char *)kernel_cmdline);
-#endif
-
- if (kvm_enabled()) {
- /* XXX insert TLB entries */
- env->gpr[1] = (16<<20) - 8;
-
-#ifdef CONFIG_LIBFDT
- /* location of device tree in register */
- env->gpr[3] = dt_base;
-#endif
- env->nip = entry;
- }
-
- if (pcibus) {
- int unit_id = 0;
-
- /* Add virtio block devices. */
- while ((i = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
- virtio_blk_init(pcibus, 0x1AF4, 0x1001,
- drives_table[i].bdrv);
- unit_id++;
- }
-
- /* Register network interfaces. */
- for (i = 0; i < nb_nics; i++) {
- nd = &nd_table[i];
- if (!nd->model)
- nd->model = "virtio";
- pci_nic_init(pcibus, nd, -1);
- }
- }
-
- printf("%s: DONE\n", __func__);
-}
-
-QEMUMachine bamboo_machine = {
- .name = "bamboo",
- .desc = "bamboo",
- .init = bamboo_init,
- .max_cpus = 1,
-};
diff --git a/qemu/pc-bios/bamboo.dts b/qemu/pc-bios/bamboo.dts
deleted file mode 100644
index 655442c..0000000
--- a/qemu/pc-bios/bamboo.dts
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Device Tree Source for AMCC Bamboo
- *
- * Copyright (c) 2006, 2007 IBM Corp.
- * Josh Boyer <jwboyer-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without
- * any warranty of any kind, whether express or implied.
- */
-
-/ {
- #address-cells = <2>;
- #size-cells = <1>;
- model = "amcc,bamboo";
- compatible = "amcc,bamboo";
- dcr-parent = <&/cpus/cpu@0>;
-
- aliases {
- serial0 = &UART0;
- serial1 = &UART1;
- };
-
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-
- cpu@0 {
- device_type = "cpu";
- model = "PowerPC,440EP";
- reg = <0>;
- clock-frequency = <1fca0550>;
- timebase-frequency = <017d7840>;
- i-cache-line-size = <20>;
- d-cache-line-size = <20>;
- i-cache-size = <8000>;
- d-cache-size = <8000>;
- dcr-controller;
- dcr-access-method = "native";
- };
- };
-
- memory {
- device_type = "memory";
- reg = <0 0 9000000>;
- };
-
- UIC0: interrupt-controller0 {
- compatible = "ibm,uic-440ep","ibm,uic";
- interrupt-controller;
- cell-index = <0>;
- dcr-reg = <0c0 009>;
- #address-cells = <0>;
- #size-cells = <0>;
- #interrupt-cells = <2>;
- };
-/*
- UIC1: interrupt-controller1 {
- compatible = "ibm,uic-440ep","ibm,uic";
- interrupt-controller;
- cell-index = <1>;
- dcr-reg = <0d0 009>;
- #address-cells = <0>;
- #size-cells = <0>;
- #interrupt-cells = <2>;
- interrupts = <1e 4 1f 4>;
- interrupt-parent = <&UIC0>;
- };
-*/
-
- SDR0: sdr {
- compatible = "ibm,sdr-440ep";
- dcr-reg = <00e 002>;
- };
-
- CPR0: cpr {
- compatible = "ibm,cpr-440ep";
- dcr-reg = <00c 002>;
- };
-
- plb {
- compatible = "ibm,plb-440ep", "ibm,plb-440gp", "ibm,plb4";
- #address-cells = <2>;
- #size-cells = <1>;
- ranges;
- clock-frequency = <07f28154>;
-
- SDRAM0: sdram {
- compatible = "ibm,sdram-440ep", "ibm,sdram-405gp";
- dcr-reg = <010 2>;
- };
-
- DMA0: dma {
- compatible = "ibm,dma-440ep", "ibm,dma-440gp";
- dcr-reg = <100 027>;
- };
-
- POB0: opb {
- compatible = "ibm,opb-440ep", "ibm,opb-440gp", "ibm,opb";
- #address-cells = <1>;
- #size-cells = <1>;
- /* Bamboo is oddball in the 44x world and doesn't use the ERPN
- * bits.
- */
- ranges = <00000000 0 00000000 80000000
- 80000000 0 80000000 80000000>;
- /* interrupt-parent = <&UIC1>; */
- interrupts = <7 4>;
- clock-frequency = <03f940aa>;
-
- EBC0: ebc {
- compatible = "ibm,ebc-440ep", "ibm,ebc-440gp", "ibm,ebc";
- dcr-reg = <012 2>;
- #address-cells = <2>;
- #size-cells = <1>;
- clock-frequency = <03f940aa>;
- interrupts = <5 1>;
- /* interrupt-parent = <&UIC1>; */
- };
-
- UART0: serial@ef600300 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600300 8>;
- virtual-reg = <ef600300>;
- clock-frequency = <00a8c000>;
- current-speed = <1c200>;
- interrupt-parent = <&UIC0>;
- interrupts = <0 4>;
- };
-
- UART1: serial@ef600400 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600400 8>;
- virtual-reg = <ef600400>;
- clock-frequency = <00a8c000>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <1 4>;
- };
-/*
- UART2: serial@ef600500 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600500 8>;
- virtual-reg = <ef600500>;
- clock-frequency = <0>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <3 4>;
- };
-
- UART3: serial@ef600600 {
- device_type = "serial";
- compatible = "ns16550";
- reg = <ef600600 8>;
- virtual-reg = <ef600600>;
- clock-frequency = <0>;
- current-speed = <0>;
- interrupt-parent = <&UIC0>;
- interrupts = <4 4>;
- };
-
-*/
- IIC0: i2c@ef600700 {
- device_type = "i2c";
- compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
- reg = <ef600700 14>;
- interrupt-parent = <&UIC0>;
- interrupts = <2 4>;
- };
-
- IIC1: i2c@ef600800 {
- device_type = "i2c";
- compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
- reg = <ef600800 14>;
- interrupt-parent = <&UIC0>;
- interrupts = <7 4>;
- };
-
- ZMII0: emac-zmii@ef600d00 {
- device_type = "zmii-interface";
- compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii";
- reg = <ef600d00 c>;
- };
-
- };
-
- PCI0: pci@ec000000 {
- device_type = "pci";
- #interrupt-cells = <1>;
- #size-cells = <2>;
- #address-cells = <3>;
- compatible = "ibm,plb440ep-pci", "ibm,plb-pci";
- primary;
- reg = <0 eec00000 8 /* Config space access */
- 0 eed00000 4 /* IACK */
- 0 eed00000 4 /* Special cycle */
- 0 ef400000 40>; /* Internal registers */
-
- /* Outbound ranges, one memory and one IO,
- * later cannot be changed. Chip supports a second
- * IO range but we don't use it for now
- */
- ranges = <02000000 0 a0000000 0 a0000000 0 20000000
- 01000000 0 00000000 0 e8000000 0 00010000>;
-
- /* Inbound 2GB range starting at 0 */
- dma-ranges = <42000000 0 0 0 0 0 80000000>;
-
- /* Bamboo has all 4 IRQ pins tied together per slot */
- interrupt-map-mask = <f800 0 0 0>;
- interrupt-map = <
- /* IDSEL 1 */
- 0800 0 0 0 &UIC0 1c 8
-
- /* IDSEL 2 */
- 1000 0 0 0 &UIC0 1b 8
-
- /* IDSEL 3 */
- 1800 0 0 0 &UIC0 1a 8
-
- /* IDSEL 4 */
- 2000 0 0 0 &UIC0 19 8
- >;
- };
-
- };
-
- chosen {
- linux,stdout-path = "/plb/opb/serial@ef600300";
- };
-};
diff --git a/qemu/qemu-kvm-powerpc.c b/qemu/qemu-kvm-powerpc.c
deleted file mode 100644
index dadcd1c..0000000
--- a/qemu/qemu-kvm-powerpc.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * qemu-kvm-power.c
- *
- * Add KVM PowerPC specific calls for qemu.
- *
- * Copyright 2007 IBM Corporation.
- * Added by & Authors:
- * Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
- * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
- *
- * This work is licensed under the GNU GPL licence version 2 or later.
- *
- */
-
-#include "config.h"
-#include "config-host.h"
-
-#include <string.h>
-#include "hw/hw.h"
-#include "sysemu.h"
-#include "cpu.h"
-#include "exec-all.h"
-#include "helper_regs.h"
-
-#include "qemu-kvm.h"
-#include <libkvm.h>
-#include <pthread.h>
-#include <sys/utsname.h>
-
-extern kvm_context_t kvm_context;
-
-void cpu_reset(CPUState *env)
-{
- memset(env, 0, offsetof(CPUPPCState, breakpoints));
- cpu_ppc_reset(env);
-}
-
-
-int kvm_arch_qemu_create_context(void)
-{
- return 0;
-}
-
-void kvm_arch_load_regs(CPUState *env)
-{
- struct kvm_regs regs;
- int rc,i;
-
- rc = kvm_get_regs(kvm_context, env->cpu_index, ®s);
- if (rc == -1)
- perror("kvm_get_regs FAILED");
-
- /* cr is untouched in qemu and not existant in CPUState fr ppr */
- /* hflags is a morphed to MSR on ppc, no need to sync that down to kvm */
-
- regs.pc = env->nip;
-
- regs.ctr = env->ctr;
- regs.lr = env->lr;
- regs.xer = env->xer;
- regs.msr = env->msr;
-
- regs.srr0 = env->spr[SPR_SRR0];
- regs.srr1 = env->spr[SPR_SRR1];
-
- regs.sprg0 = env->spr[SPR_SPRG0];
- regs.sprg1 = env->spr[SPR_SPRG1];
- regs.sprg2 = env->spr[SPR_SPRG2];
- regs.sprg3 = env->spr[SPR_SPRG3];
- regs.sprg4 = env->spr[SPR_SPRG4];
- regs.sprg5 = env->spr[SPR_SPRG5];
- regs.sprg6 = env->spr[SPR_SPRG6];
- regs.sprg7 = env->spr[SPR_SPRG7];
-
- for (i = 0;i < 32; i++){
- regs.gpr[i] = env->gpr[i];
- }
-
- rc = kvm_set_regs(kvm_context, env->cpu_index, ®s);
- if (rc == -1)
- perror("kvm_set_regs FAILED");
-}
-
-
-void kvm_arch_save_regs(CPUState *env)
-{
- struct kvm_regs regs;
- uint32_t i, rc;
-
- rc = kvm_get_regs(kvm_context, env->cpu_index, ®s);
- if (rc == -1)
- perror("kvm_get_regs FAILED");
-
- env->ctr =regs.ctr;
- env->lr = regs.lr;
- env->xer = regs.xer;
- env->msr = regs.msr;
- /* calculate hflags based on the current msr using the ppc qemu helper */
- hreg_compute_hflags(env);
-
- env->nip = regs.pc;
-
- env->spr[SPR_SRR0] = regs.srr0;
- env->spr[SPR_SRR1] = regs.srr1;
-
- env->spr[SPR_SPRG0] = regs.sprg0;
- env->spr[SPR_SPRG1] = regs.sprg1;
- env->spr[SPR_SPRG2] = regs.sprg2;
- env->spr[SPR_SPRG3] = regs.sprg3;
- env->spr[SPR_SPRG4] = regs.sprg4;
- env->spr[SPR_SPRG5] = regs.sprg5;
- env->spr[SPR_SPRG6] = regs.sprg6;
- env->spr[SPR_SPRG7] = regs.sprg7;
-
- for (i = 0;i < 32; i++){
- env->gpr[i] = regs.gpr[i];
- }
-
-}
-
-int kvm_arch_qemu_init_env(CPUState *cenv)
-{
- if (cenv->cpu_index == 0) {
- /* load any registers set in env into
- kvm for the first guest vcpu */
- kvm_load_registers(cenv);
- }
-
- return 0;
-}
-
-int kvm_arch_halt(void *opaque, int vcpu)
-{
- CPUState *env = cpu_single_env;
-
- if (!(env->interrupt_request & CPU_INTERRUPT_HARD)
- && (msr_ee))
- {
- env->halted = 1;
- env->exception_index = EXCP_HLT;
- }
- return 1;
-}
-
-void kvm_arch_pre_kvm_run(void *opaque, CPUState *env)
-{
- return;
-}
-
-void kvm_arch_post_kvm_run(void *opaque, CPUState *env)
-{
- cpu_single_env = env;
-}
-
-int kvm_arch_has_work(CPUState *env)
-{
- if ((env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXIT)) &&
- (msr_ee))
- return 1;
- return 0;
-}
-
-int kvm_arch_try_push_interrupts(void *opaque)
-{
- CPUState *env = cpu_single_env;
- int r;
- unsigned irq;
-
- /* PowerPC Qemu tracks the various core input pins (interrupt, critical
- * interrupt, reset, etc) in PPC-specific env->irq_input_state. */
- if (kvm_is_ready_for_interrupt_injection(kvm_context, env->cpu_index) &&
- (env->irq_input_state & (1<<PPC40x_INPUT_INT)))
- {
- /* For now KVM disregards the 'irq' argument. However, in the
- * future KVM could cache it in-kernel to avoid a heavyweight exit
- * when reading the UIC.
- */
- irq = -1U;
-
- r = kvm_inject_irq(kvm_context, env->cpu_index, irq);
- if (r < 0)
- printf("cpu %d fail inject %x\n", env->cpu_index, irq);
- }
-
- /* We don't know if there are more interrupts pending after this. However,
- * the guest will return to userspace in the course of handling this one
- * anyways, so we will get a chance to deliver the rest. */
- return 0;
-}
-
-void kvm_arch_update_regs_for_sipi(CPUState *env)
-{
- printf("%s: no kvm-powerpc multi processor support yet!\n", __func__);
-}
-
-/* map dcr access to existing qemu dcr emulation */
-int handle_powerpc_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data)
-{
- CPUState *env = cpu_single_env;
- if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0)
- fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn);
-
- return 0; /* XXX ignore failed DCR ops */
-}
-
-int handle_powerpc_dcr_write(int vcpu, uint32_t dcrn, uint32_t data)
-{
- CPUState *env = cpu_single_env;
- if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0)
- fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn);
-
- return 0; /* XXX ignore failed DCR ops */
-}
-
-void kvm_arch_cpu_reset(CPUState *env)
-{
-}
diff --git a/qemu/target-ppc/machine.c b/qemu/target-ppc/machine.c
index ea2257b..be0cbe1 100644
--- a/qemu/target-ppc/machine.c
+++ b/qemu/target-ppc/machine.c
@@ -8,7 +8,6 @@ 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)
--
Hollis Blanchard
IBM Linux Technology Center
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support
[not found] ` <1229470067.19354.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-12-17 9:49 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2008-12-17 9:49 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: kvm-devel, kvm-ppc
Hollis Blanchard wrote:
> PowerPC KVM support was accepted into upstream qemu. To ease the merge
> conflicts, you should apply this patch to remove all traces of PowerPC
> KVM code from kvm-userspace before the next qemu pull.
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support in qemu
@ 2008-12-17 9:49 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2008-12-17 9:49 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: kvm-devel, kvm-ppc
Hollis Blanchard wrote:
> PowerPC KVM support was accepted into upstream qemu. To ease the merge
> conflicts, you should apply this patch to remove all traces of PowerPC
> KVM code from kvm-userspace before the next qemu pull.
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-17 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16 23:27 [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM Hollis Blanchard
2008-12-16 23:27 ` [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support in qemu Hollis Blanchard
[not found] ` <1229470067.19354.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-12-17 9:49 ` [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support Avi Kivity
2008-12-17 9:49 ` [PATCH] avoid kvm-userspace merge conflict with PowerPC KVM support in qemu Avi Kivity
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.