Skip to contentSkip to conversation

PowerPC Embedded KVM qemu enablement patches

PATCH Applied Jerone Young 4 participants 14 messages Jan 28, 2008 2 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PowerPC Embedded KVM qemu enablement patches

This set of patches is to enable PowerPC embedded KVM capablities to be taken advantage of by qemu.

The code currently boots a ungziped uImage of the Linux kernel complied for PowerPC 440 AMCC Bamboo evalution board. We have not fully tested userspace, but fixes will follow as we do. We are also missing networking support, though this will come shortly. Also our current bamboo board model is h ardcoded to have 144MB or RAM (which will get changed shortly also).

What you need:
- A PowerPC 440 based SOC (System-on-Chip)
(we have been testing with a AMCC bamboo & AMCC sequoia boards)
- PowerPC KVM Patches (these have been sent by Hollis Blanchard to the list)
- KVM Kernel source with PowerPC KVM Patches applied
- cross tools with powerpc 440 compiler (this is assuming your not using a power machine)
- version of zlib-1.2.3 or higher compiled for powerpc

Then you compile with userspace. Here is an example of what I use to configure kvm-userspace:

./configure --arch=powerpc --cross-prefix=powerpc-440-linux-gnu- --with-patched-kernel --kerneldir=/home/jerone/work/kvmppc.hg/ --disable-sdl --disable-vnc-tls --disable-gfx-check --disable-gcc-check --qemu-cflags="-I/home/jerone/work/zlib-1.2.3 -I/home/jerone/work/kvmppc.hg/include/" --qemu-ldflags="-L/home/jerone/work/zlib-1.2.3/"

Then you run "make". After which you will have an excutable:
kvm-userspace/qemu/ppcemb-softmmu/qemu-system-ppcemb

To run, boot your compiled KVM PPC enabled kernel and also compile your special none gzipped cuImag e of Linux for the Bamboo board. Then run:

./qemu-system-ppcemb -nographic -M bamboo -kernel cuImage.bambo

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#1 lore raw

PATCH 1/1 Enhnace kvm-userspace configure script for powerpc

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1201488336 21600
# Node ID 4b35e985aaf2021d956b09bd690c72ea5cadb007
# Parent a2740102bf6564a194e55b605c69886c56a37ece
Enhnace kvm-userspace configure script for powerpc

Add qemu option to tell qemu to compile ppcemb-softmmu, if ARCH=powerpc is used.

configure +4 -0
@@ -101,6 +101,10 @@ if [ "$arch" = "ia64" ]; then
     target_exec="ia64-softmmu"
 fi
 
+if [ "$arch" = "powerpc" ]; then
+    target_exec="ppcemb-softmmu"
+fi
+
 #configure user dir
 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
           --arch="$arch" \

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#2 lore raw

PATCH 1/1 Ensure 4kB page alignment for embedded powerpc when using kvm

In reply to Jerone Young

# HG changeset patch
# User Christian Ehrhardt <[email protected]> # Date 1201488336 21600
# Node ID 57f4e5bd23e0da3c493e769e3e2b738e1495f7ef
# Parent 4b35e985aaf2021d956b09bd690c72ea5cadb007
Ensure 4kB page alignment for embedded powerpc when using kvm

Powerpc needs 4kB aligned pages when using qemu together with kvm. Qemu already had a similar issue when CONFIG_USER_ONLY was set so this patch adds just one more condition to the existing ifdef.

qemu/target-ppc/cpu.h +2 -1
@@ -50,9 +50,10 @@ typedef uint32_t ppc_gpr_t;
 /* Specific definitions for PowerPC embedded */
 /* BookE have 36 bits physical address space */
 #define TARGET_PHYS_ADDR_BITS 64
-#if defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_USER_ONLY) || defined(USE_KVM)
 /* It looks like a lot of Linux programs assume page size
  * is 4kB long. This is evil, but we have to deal with it...
+ * Also kvm for embedded powerpc needs (atm) 4kB aligned pages
  */
 #define TARGET_PAGE_BITS 12
 #else /* defined(CONFIG_USER_ONLY) */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#3 lore raw

PATCH 1/1 Chnage so that Powerpc & IA64 do not have KVM_EXTRA_PAGES set

In reply to Jerone Young

# HG changeset patch
# User Christian Ehrhardt <[email protected]> # Date 1201488336 21600
# Node ID 7c535acfd618f41aa6f49efa25e3fd6e1f75b633
# Parent 57f4e5bd23e0da3c493e769e3e2b738e1495f7ef
Chnage so that Powerpc & IA64 do not have KVM_EXTRA_PAGES set

IA64 already had an exclusion and so does ppc. This patch switches the default to no extra pages and lets I386 and X86_64 get it's 3 extra pages as needed.

qemu/vl.c +3 -3
@@ -9313,10 +9313,10 @@ int main(int argc, char **argv)
 
 #if USE_KVM
     /* Initialize kvm */
-#ifdef TARGET_IA64
+#if defined(TARGET_I386) || defined(TARGET_X86_64)
+#define KVM_EXTRA_PAGES 3
+#else
 #define KVM_EXTRA_PAGES 0
-#else
-#define KVM_EXTRA_PAGES 3
 #endif
     if (kvm_allowed) {
 	    phys_ram_size += KVM_EXTRA_PAGES * TARGET_PAGE_SIZE;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#4 lore raw

PATCH 1/1 Add vcpu to arguments of powerpc libkvm callbacks

In reply to Jerone Young

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1201488336 21600
# Node ID 3aa131f9bc863af5d029740b1579e747d3703c7e
# Parent 7c535acfd618f41aa6f49efa25e3fd6e1f75b633
Add vcpu to arguments of powerpc libkvm callbacks

This patch adds vcpu as an argmunent for powerpc specific callbacks:
powerpc_dcr_read
powerpc_dcr_write

libkvm/libkvm-powerpc.c +6 -4
@@ -26,15 +26,17 @@
 #include <errno.h>
 #include <stdio.h>
 
-int handle_dcr(struct kvm_run *run,  kvm_context_t kvm)
+int handle_dcr(struct kvm_run *run,  kvm_context_t kvm, int vcpu)
 {
 	int ret = 0;
 
 	if (run->dcr.is_write)
-		ret = kvm->callbacks->powerpc_dcr_write(run->dcr.dcrn,
+		ret = kvm->callbacks->powerpc_dcr_write(vcpu,
+							run->dcr.dcrn,
 							run->dcr.data);
 	else
-		ret = kvm->callbacks->powerpc_dcr_read(run->dcr.dcrn,
+		ret = kvm->callbacks->powerpc_dcr_read(vcpu,
+							run->dcr.dcrn,
 							&(run->dcr.data));
 
 	return ret;
@@ -102,7 +104,7 @@ int kvm_arch_run(struct kvm_run *run, kv
 
 	switch (run->exit_reason){
 	case KVM_EXIT_DCR:
-		ret = handle_dcr(run, kvm);
+		ret = handle_dcr(run, kvm, vcpu);
 		break;
 	default:
 		ret = 1;
libkvm/libkvm.h +2 -2
@@ -66,8 +66,8 @@ struct kvm_callbacks {
     int (*pre_kvm_run)(void *opaque, int vcpu);
     int (*tpr_access)(void *opaque, int vcpu, uint64_t rip, int is_write);
 #if defined(__powerpc__)
-    int (*powerpc_dcr_read)(uint32_t dcrn, uint32_t *data);
-    int (*powerpc_dcr_write)(uint32_t dcrn, uint32_t data);
+    int (*powerpc_dcr_read)(int vcpu, uint32_t dcrn, uint32_t *data);
+    int (*powerpc_dcr_write)(int vcpu, uint32_t dcrn, uint32_t data);
 #endif
 };
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#5 lore raw

PATCH 1/1 Add qemu powerpc build support

In reply to Jerone Young

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1201488336 21600
# Node ID 391b6488213008a4502b1753c26e8bd5200bd3c6
# Parent 3aa131f9bc863af5d029740b1579e747d3703c7e
Add qemu powerpc build support

This patch adds build support required to build ppcemb with KVM support for powerpc.

qemu/Makefile.target +10 -1
@@ -299,7 +299,7 @@ OBJS+= libqemu.a
 
 # cpu emulator library
 LIBOBJS=exec.o kqemu.o qemu-kvm.o translate-op.o translate-all.o cpu-exec.o\
-        translate.o op.o host-utils.o qemu-kvm-helper.o
+        translate.o op.o host-utils.o
 ifdef CONFIG_SOFTFLOAT
 LIBOBJS+=fpu/softfloat.o
 else
@@ -310,15 +310,18 @@ ifeq ($(TARGET_ARCH), i386)
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
+LIBOBJS+=qemu-kvm-helper.o
 endif
 
 ifeq ($(TARGET_ARCH), x86_64)
 LIBOBJS+=helper.o helper2.o
 LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
+LIBOBJS+=qemu-kvm-helper.o
 endif
 
 ifeq ($(TARGET_BASE_ARCH), ppc)
 LIBOBJS+= op_helper.o helper.o
+LIBOBJS+= qemu-kvm-powerpc.o
 endif
 
 ifeq ($(TARGET_BASE_ARCH), mips)
@@ -486,6 +489,7 @@ CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOI
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 # shared objects
 VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
+VL_OBJS+= cirrus_vga.o
 # PREP target
 VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
 VL_OBJS+= prep_pci.o ppc_prep.o
@@ -497,6 +501,7 @@ VL_OBJS+= unin_pci.o ppc_chrp.o
 VL_OBJS+= unin_pci.o ppc_chrp.o
 # PowerPC 4xx boards
 VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
+VL_OBJS+= ppc440.o ppc440_bamboo.o
 endif
 ifeq ($(TARGET_BASE_ARCH), mips)
 VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
@@ -656,6 +661,10 @@ firmware.o: firmware.c
 	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 endif
 
+ifeq ($(TARGET_ARCH), ppc)
+qemu-kvm-powerpc.o: qemu-kvm-powerpc.c qemu-kvm.h
+endif
+
 cpu-exec.o: cpu-exec.c
 	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
qemu/configure +5 -1
@@ -199,6 +199,9 @@ if [ "$cpu" = "ia64" ] ; then
      kvm="yes"
      gdbstub="no"
      slirp="no"
+fi
+if [ "$cpu" = "powerpc" ]; then
+     kvm="yes"
 fi
 ;;
 esac
@@ -1067,7 +1070,7 @@ echo "#define CONFIG_QEMU_PREFIX \"$inte
 
 configure_kvm() {
   if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
-          \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" \); then
+          \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
     echo "#define USE_KVM 1" >> $config_h
     echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
   fi
@@ -1118,6 +1121,7 @@ elif test "$target_cpu" = "ppcemb" ; the
   echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
   echo "#define TARGET_PPC 1" >> $config_h
   echo "#define TARGET_PPCEMB 1" >> $config_h
+  configure_kvm
 elif test "$target_cpu" = "ppc64" ; then
   echo "TARGET_ARCH=ppc64" >> $config_mak
   echo "TARGET_ABI_DIR=ppc" >> $config_mak

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#6 lore raw

PATCH 1/1 Add powerpc KVM support to qemu

In reply to Jerone Young

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1201490017 21600
# Node ID bf22e220977099e60b57be9e16d7d96487defdc1
# Parent 391b6488213008a4502b1753c26e8bd5200bd3c6
Add powerpc KVM support to qemu.

This patch adds needed files and other modifications for supporting of powerpc KVM within qemu.

qemu/qemu-kvm-powerpc.c new file +198 -0
new file mode 100644
@@ -0,0 +1,198 @@
+
+#include "config.h"
+#include "config-host.h"
+
+extern int kvm_allowed;
+extern int kvm_irqchip;
+
+#ifdef USE_KVM
+
+#include <string.h>
+#include "hw/hw.h"
+#include "sysemu.h"
+#include "cpu.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;
+extern __thread CPUState *vcpu_env;
+
+void cpu_reset(CPUState *env)
+{
+	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, &regs);
+    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 = ppc_load_xer(env);
+    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];
+        regs.fpr[i] = env->fpr[i];
+    }
+
+    rc = kvm_set_regs(kvm_context, env->cpu_index, &regs);
+    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, &regs);
+    if (rc == -1)
+        perror("kvm_get_regs FAILED");
+
+    env->ctr =regs.ctr;
+    env->lr = regs.lr;
+    ppc_store_xer(env,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];
+        env->fpr[i] = regs.fpr[i];
+    }
+
+}
+
+int kvm_arch_qemu_init_env(CPUState *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, int vcpu)
+{
+	return;
+}
+
+void kvm_arch_post_kvm_run(void *opaque, int vcpu)
+{  
+    CPUState *env = qemu_kvm_cpu_env(vcpu);
+    cpu_single_env = env;
+    env->ready_for_interrupt_injection = \
+	kvm_is_ready_for_interrupt_injection(kvm_context, vcpu);
+}
+
+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;
+
+    if (env->ready_for_interrupt_injection &&
+        (env->interrupt_request & CPU_INTERRUPT_HARD))
+       { 
+            env->interrupt_request &= ~CPU_INTERRUPT_HARD;
+
+            /* 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);
+    }
+
+    return (env->interrupt_request & CPU_INTERRUPT_HARD) != 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 = qemu_kvm_cpu_env(vcpu);
+    ppc_dcr_read(env->dcr_env, dcrn, data);
+    return 0; /* XXX ignore failed DCR ops */
+}
+
+int handle_powerpc_dcr_write(int vcpu, uint32_t dcrn, uint32_t data)
+{
+    CPUState *env = qemu_kvm_cpu_env(vcpu);
+    ppc_dcr_write(env->dcr_env, dcrn, data);
+    return 0; /* XXX ignore failed DCR ops */
+}
+
+#endif
qemu/qemu-kvm.h +2 -2
@@ -55,8 +55,8 @@ int handle_tpr_access(void *opaque, int 
 			     uint64_t rip, int is_write);
 
 #ifdef TARGET_PPC
-int handle_powerpc_dcr_read(uint32_t dcrn, uint32_t *data);
-int handle_powerpc_dcr_write(uint32_t dcrn, uint32_t data);
+int handle_powerpc_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data);
+int handle_powerpc_dcr_write(int vcpu,uint32_t dcrn, uint32_t data);
 #endif
 
 #define ALIGN(x, y)  (((x)+(y)-1) & ~((y)-1))
qemu/target-ppc/cpu.h +11 -0
@@ -573,6 +573,10 @@ struct CPUPPCState {
     target_ulong msr;
     /* temporary general purpose registers */
     ppc_gpr_t tgpr[4]; /* Used to speed-up TLB assist handlers */
+	
+#ifdef USE_KVM
+    uint8_t ready_for_interrupt_injection;
+#endif
 
     /* Floating point execution context */
     /* temporary float registers */
@@ -1421,4 +1425,11 @@ enum {
 
 /*****************************************************************************/
 
+/* hidden flags (hflags) - used internally by qemu to represent additional
+ * cpu states.
+ */
+#define HF_HALTED_SHIFT 1
+
+#define HF_HALTED_MASK 1<<HF_HALTED_SHIFT
+
 #endif /* !defined (__CPU_PPC_H__) */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#7 lore raw

PATCH 1/1 Add Powerpc 440 board model "bamboo" to take advantage of Powerpc KVM

In reply to Jerone Young

# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1201490062 21600
# Node ID 39f4363836421bc1f78f83c69ad10d76c58a678a
# Parent bf22e220977099e60b57be9e16d7d96487defdc1
Add Powerpc 440 board model "bamboo" to take advantage of Powerpc KVM.

This patch adds the bamboo board model to Qemu. The Bamboo is a PowerPC 440 SOC (System-on-chip) reference platform. This code takes advantage of PowerPC KVM capabilities.

qemu/hw/boards.h +1 -0
@@ -32,6 +32,7 @@ extern QEMUMachine heathrow_machine;
 extern QEMUMachine heathrow_machine;
 extern QEMUMachine ref405ep_machine;
 extern QEMUMachine taihu_machine;
+extern QEMUMachine bamboo_machine;
 
 /* mips_r4k.c */
 extern QEMUMachine mips_machine;
qemu/hw/ppc440.c new file +56 -0

56 lines not on this page · raw message

qemu/hw/ppc440.h new file +29 -0
new file mode 100644
@@ -0,0 +1,29 @@
+/*
+ * Qemu PowerPC 440 board emualtion
+ *
+ * Copyright 2007 IBM Corporation.
+ * Authors: Jerone Young <jyoung5-r/[email protected]>
+ *          
+ * This work is licensed under the GNU LGPL license, version 2.
+ *
+ */
+
+#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"
+
+void ppc440_init(CPUState *env,
+		target_phys_addr_t ram_bases[2],
+		target_phys_addr_t ram_sizes[2],
+		qemu_irq **picp,
+		int do_init);
+
+#endif
qemu/hw/ppc440_bamboo.c new file +124 -0

124 lines not on this page · raw message

qemu/vl.c +1 -0
@@ -8318,6 +8318,7 @@ static void register_machines(void)
     qemu_register_machine(&prep_machine);
     qemu_register_machine(&ref405ep_machine);
     qemu_register_machine(&taihu_machine);
+    qemu_register_machine(&bamboo_machine);
 #elif defined(TARGET_MIPS)
     qemu_register_machine(&mips_machine);
     qemu_register_machine(&mips_malta_machine);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#8 lore raw
In reply to Jerone Young
Quoted 17 lines · Jerone Young

This set of patches is to enable PowerPC embedded KVM capablities to be taken advantage of by qemu.

The code currently boots a ungziped uImage of the Linux kernel complied for PowerPC 440 AMCC Bamboo evalution board. We have not fully tested userspace, but fixes will follow as we do. We are also missing networking support, though this will come shortly. Also our current bamboo board model is h ardcoded to have 144MB or RAM (which will get changed shortly also).

What you need:
- A PowerPC 440 based SOC (System-on-Chip)
(we have been testing with a AMCC bamboo & AMCC sequoia boards)
- PowerPC KVM Patches (these have been sent by Hollis Blanchard to the list)
- KVM Kernel source with PowerPC KVM Patches applied
- cross tools with powerpc 440 compiler (this is assuming your not using a power machine)
- version of zlib-1.2.3 or higher compiled for powerpc

Then you compile with userspace. Here is an example of what I use to configure kvm-userspace:

./configure --arch=powerpc --cross-prefix=powerpc-440-linux-gnu- --with-patched-kernel --kerneldir=/home/jerone/work/kvmppc.hg/ --disable-sdl --disable-vnc-tls --disable-gfx-check --disable-gcc-check --qemu-cflags="-I/home/jerone/work/zlib-1.2.3 -I/home/jerone/work/kvmppc.hg/include/" --qemu-ldflags="-L/home/jerone/work/zlib-1.2.3/"

Quoted 8 lines

Then you run "make". After which you will have an excutable:
kvm-userspace/qemu/ppcemb-softmmu/qemu-system-ppcemb

To run, boot your compiled KVM PPC enabled kernel and also compile your special none gzipped cuImag e of Linux for the Bamboo board. Then run:

./qemu-system-ppcemb -nographic -M bamboo -kernel cuImage.bambo

Since you're just adding a new machine type to the existing ppcemb, it may be worth while to split out the KVM logic and submit the machine type directly to qemu-devel.

Does the code work with -no-kvm?

Regards,

Anthony Liguori

Quoted 11 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Applied
#15 lore raw
In reply to Jerone Young
Quoted 6 lines · Jerone Young

This set of patches is to enable PowerPC embedded KVM capablities to be taken advantage of by qemu.

The code currently boots a ungziped uImage of the Linux kernel complied for PowerPC 440 AMCC Bamboo evalution board. We have not fully tested userspace, but fixes will follow as we do. We are also missing networking support, though this will come shortly. Also our current bamboo board model is h ardcoded to have 144MB or RAM (which will get changed shortly also).

Applied all, thanks.

Please submit the non kvm specific parts (bamboo) to qemu as well.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#10 lore raw
In reply to a message not in the archive

The issue here is that qemu does not support u-boot firmware. What we are doing is actually loading a u-boot image and booting Linux directly with a pre made device tree (which is something normally u-boot firmware would provide Linux). So this code wouldn't fit into plain qemu just yet.

Quoted 31 lines · Anthony Liguori
Quoted 17 lines · Jerone Young

This set of patches is to enable PowerPC embedded KVM capablities to be taken advantage of by qemu.

The code currently boots a ungziped uImage of the Linux kernel complied for PowerPC 440 AMCC Bamboo evalution board. We have not fully tested userspace, but fixes will follow as we do. We are also missing networking support, though this will come shortly. Also our current bamboo board model is h ardcoded to have 144MB or RAM (which will get changed shortly also).

What you need:
- A PowerPC 440 based SOC (System-on-Chip)
(we have been testing with a AMCC bamboo & AMCC sequoia boards)
- PowerPC KVM Patches (these have been sent by Hollis Blanchard to the list)
- KVM Kernel source with PowerPC KVM Patches applied
- cross tools with powerpc 440 compiler (this is assuming your not using a power machine)
- version of zlib-1.2.3 or higher compiled for powerpc

Then you compile with userspace. Here is an example of what I use to configure kvm-userspace:

./configure --arch=powerpc --cross-prefix=powerpc-440-linux-gnu- --with-patched-kernel --kerneldir=/home/jerone/work/kvmppc.hg/ --disable-sdl --disable-vnc-tls --disable-gfx-check --disable-gcc-check --qemu-cflags="-I/home/jerone/work/zlib-1.2.3 -I/home/jerone/work/kvmppc.hg/include/" --qemu-ldflags="-L/home/jerone/work/zlib-1.2.3/"

Quoted 8 lines

Then you run "make". After which you will have an excutable:
kvm-userspace/qemu/ppcemb-softmmu/qemu-system-ppcemb

To run, boot your compiled KVM PPC enabled kernel and also compile your special none gzipped cuImag e of Linux for the Bamboo board. Then run:

./qemu-system-ppcemb -nographic -M bamboo -kernel cuImage.bambo

Since you're just adding a new machine type to the existing ppcemb, it may be worth while to split out the KVM logic and submit the machine type directly to qemu-devel.

Quoted 18 lines

Does the code work with -no-kvm?

Regards,

Anthony Liguori

Quoted 11 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#11 lore raw
Quoted 6 lines · Jerone Young

The issue here is that qemu does not support u-boot firmware. What we are doing is actually loading a u-boot image and booting Linux directly with a pre made device tree (which is something normally u-boot firmware would provide Linux). So this code wouldn't fit into plain qemu just yet.

In theory, it would still work with QEMU though right? It just requires a custom guest kernel.

Regards,

Anthony Liguori

Quoted 43 lines · Anthony Liguori
Quoted 42 lines
Quoted 17 lines · Jerone Young

This set of patches is to enable PowerPC embedded KVM capablities to be taken advantage of by qemu.

The code currently boots a ungziped uImage of the Linux kernel complied for PowerPC 440 AMCC Bamboo evalution board. We have not fully tested userspace, but fixes will follow as we do. We are also missing networking support, though this will come shortly. Also our current bamboo board model is h ardcoded to have 144MB or RAM (which will get changed shortly also).

What you need:
- A PowerPC 440 based SOC (System-on-Chip)
(we have been testing with a AMCC bamboo & AMCC sequoia boards)
- PowerPC KVM Patches (these have been sent by Hollis Blanchard to the list)
- KVM Kernel source with PowerPC KVM Patches applied
- cross tools with powerpc 440 compiler (this is assuming your not using a power machine)
- version of zlib-1.2.3 or higher compiled for powerpc

Then you compile with userspace. Here is an example of what I use to configure kvm-userspace:

./configure --arch=powerpc --cross-prefix=powerpc-440-linux-gnu- --with-patched-kernel --kerneldir=/home/jerone/work/kvmppc.hg/ --disable-sdl --disable-vnc-tls --disable-gfx-check --disable-gcc-check --qemu-cflags="-I/home/jerone/work/zlib-1.2.3 -I/home/jerone/work/kvmppc.hg/include/" --qemu-ldflags="-L/home/jerone/work/zlib-1.2.3/"

Quoted 9 lines

Then you run "make". After which you will have an excutable:
kvm-userspace/qemu/ppcemb-softmmu/qemu-system-ppcemb

To run, boot your compiled KVM PPC enabled kernel and also compile your special none gzipped cuImag e of Linux for the Bamboo board. Then run:

./qemu-system-ppcemb -nographic -M bamboo -kernel cuImage.bambo

Since you're just adding a new machine type to the existing ppcemb, it may be worth while to split out the KVM logic and submit the machine type directly to qemu-devel.

Does the code work with -no-kvm?

Regards,

Anthony Liguori

Quoted 2 lines
Quoted 12 lines
Quoted 10 lines
Quoted 10 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#13 lore raw
In reply to a message not in the archive

This is true (you got me there). I'll test it out and submit it to qemu-devel.

Quoted 20 lines · Anthony Liguori

From:
Anthony Liguori
<[email protected]>

                               To: 
jyoung5-r/[email protected]
                               Cc: 

[email protected], [email protected]
Subject:
Re: [kvm-devel] [PATCH 0 of 7]
PowerPC Embedded KVM qemu
enablement patches
Date:
Mon, 28 Jan 2008 10:17:45 -0600

Quoted 1 line · Jerone Young

The issue here is that qemu does not support u-boot firmware. What

we

Quoted 1 line

are doing is actually loading a u-boot image and booting Linux

Quoted 8 lines

directly

Quoted 1 line

with a pre made device tree (which is something normally u-boot

firmware

Quoted 3 lines

would provide Linux). So this code wouldn't fit into plain qemu just yet.

In theory,

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#14 lore raw
In reply to a message not in the archive
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Jerone Young

The issue here is that qemu does not support u-boot firmware. What we are doing is actually loading a u-boot image and booting Linux directly with a pre made device tree (which is something normally u-boot firmware would provide Linux). So this code wouldn't fit into plain qemu just yet.

In theory, it would still work with QEMU though right? It just requires a custom guest kernel.

Qemu does not emulate the 440 core, but that's what our KVM code supports. Bamboo is a 440EP reference board, so the Bamboo setup will be useless to qemu until they get 440 support.

That said, there are only 2 places that we make KVM-specific calls in this code, and those can easily be protected with "kvm_allowed" checks in the future.

Signature · 8 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/