Skip to contentSkip to conversation

[6065] target-ppc: Enable KVM for ppcemb.

Qemu-devel Aurelien Jarno 1 participant 1 message Dec 16, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 6065

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6065
Author:   aurel32
Date:     2008-12-16 10:43:58 +0000 (Tue, 16 Dec 2008)

Log Message:
-----------
target-ppc: Enable KVM for ppcemb.

Implement hooks called by generic KVM code.

Also add code that will copy the host's CPU and timebase frequencies to the guest, which is necessary on KVM because the guest can directly access the timebase.

Modified Paths:
--------------
trunk/Makefile.target
trunk/configure
trunk/target-ppc/helper.c

Added Paths:
-----------
trunk/target-ppc/kvm.c
trunk/target-ppc/kvm_ppc.c
trunk/target-ppc/kvm_ppc.h

Modified: trunk/Makefile.target
===================================================================

Makefile.target +3 -0
@@ -659,6 +659,9 @@
 OBJS+= device_tree.o
 LIBS+= $(FDT_LIBS)
 endif
+ifdef CONFIG_KVM
+OBJS+= kvm_ppc.o
+endif
 # virtio support
 OBJS+= virtio.o virtio-blk.o virtio-balloon.o
 endif

Modified: trunk/configure
===================================================================

configure +6 -0
@@ -1491,6 +1491,7 @@
 
 # Make sure the target and host cpus are compatible
 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
+  \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
   \( "$target_cpu" = "x86_64" -a "$cpu" = "i386"   \) -o \
   \( "$target_cpu" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
   kvm="no"
@@ -1585,6 +1586,11 @@
     echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPCEMB 1" >> $config_h
+    if test "$kvm" = "yes" ; then
+      echo "CONFIG_KVM=yes" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
   ;;
   ppc64)
     echo "TARGET_ARCH=ppc64" >> $config_mak

Modified: trunk/target-ppc/helper.c
===================================================================

target-ppc/helper.c +5 -0
@@ -29,6 +29,7 @@
 #include "exec-all.h"
 #include "helper_regs.h"
 #include "qemu-common.h"
+#include "kvm.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_BATS
@@ -2920,6 +2921,10 @@
     env->cpu_model_str = cpu_model;
     cpu_ppc_register_internal(env, def);
     cpu_ppc_reset(env);
+
+    if (kvm_enabled())
+        kvm_init_vcpu(env);
+
     return env;
 }
 

Added: trunk/target-ppc/kvm.c
===================================================================

target-ppc/kvm.c +204 -0

204 lines not on this page · raw message

Added: trunk/target-ppc/kvm_ppc.c
===================================================================

target-ppc/kvm_ppc.c +110 -0

110 lines not on this page · raw message

Added: trunk/target-ppc/kvm_ppc.h
===================================================================

target-ppc/kvm_ppc.h +15 -0
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2008 IBM Corporation.
+ * Authors: Hollis Blanchard <[email protected]>
+ *
+ * This work is licensed under the GNU GPL license version 2 or later.
+ *
+ */
+
+#ifndef __KVM_PPC_H__
+#define __KVM_PPC_H__
+
+void kvmppc_init(void);
+void kvmppc_fdt_update(void *fdt);
+
+#endif /* __KVM_PPC_H__ */