Qemu powerpc work around
RFC 1/1 Qemu powerpc work around
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a fake-exec.c that stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fix qemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.
configure +1 -1
@@ -102,7 +102,7 @@ fi fi if [ "$arch" = "powerpc" ]; then - target_exec="ppcemb-softmmu" + target_exec="ppcemb_kvm-softmmu" fi #configure user dir
qemu/Makefile.target +27 -13
@@ -21,6 +21,9 @@ TARGET_BASE_ARCH:=ppc TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), ppcemb) +TARGET_BASE_ARCH:=ppc +endif +ifeq ($(TARGET_ARCH), ppcemb_kvm) TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), sparc64)
@@ -179,22 +182,26 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o\ + host-utils.o + +CPPFLAGS+=-I$(SRC_PATH) + +ifeq ($(USE_KVM), 1) +LIBOBJS+=qemu-kvm.o +endif +ifdef CONFIG_SOFTFLOAT +LIBOBJS+=fpu/softfloat.o +else +LIBOBJS+=fpu/softfloat-native.o +endif +CPPFLAGS+=-I$(SRC_PATH)/fpu + +ifeq ($(TARGET_ARCH), i386) # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) -ifeq ($(USE_KVM), 1) -LIBOBJS+=qemu-kvm.o -endif -ifdef CONFIG_SOFTFLOAT -LIBOBJS+=fpu/softfloat.o -else -LIBOBJS+=fpu/softfloat-native.o -endif -CPPFLAGS+=-I$(SRC_PATH)/fpu - -ifeq ($(TARGET_ARCH), i386) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
@@ -203,6 +210,10 @@ endif endif ifeq ($(TARGET_ARCH), x86_64) +# TCG code generator +LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o +CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
@@ -214,6 +225,9 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +LIBOBJS+= fake-exec.o +else +LIBOBJS+=translate-all.o op.o translate.o endif endif
qemu/configure +8 -1
@@ -547,7 +547,7 @@ if test -z "$target_list" ; then if test -z "$target_list" ; then # these targets are portable if [ "$softmmu" = "yes" ] ; then - target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu" + target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu ppcemb_kvm-softmmu" fi # the following are Linux specific if [ "$linux_user" = "yes" ] ; then
@@ -1027,6 +1027,7 @@ target_bigendian="no" [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes +[ "$target_cpu" = "ppcemb_kvm" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes [ "$target_cpu" = "mips" ] && target_bigendian=yes
@@ -1149,6 +1150,12 @@ 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 +elif test "$target_cpu" = "ppcemb_kvm"; then + echo "TARGET_ARCH=ppcemb_kvm" >> $config_mak + echo "TARGET_ABI_DIR=ppc" >> $config_mak + echo "#define TARGET_ARCH \"ppcemb\" " >> $config_mak + 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
qemu/exec.c +4 -0
@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if defined(TARGET_i386) || defined(TARGET_X86_64 )#include "tcg-target.h" +#endif +#include "qemu-kvm.h" #if defined(CONFIG_USER_ONLY )#include <qemu.h>
qemu/fake-exec.c new file +62 -0
62 lines not on this page · raw message
-------------------------------------------------------------------------
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/
Quoted 133 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.Signed-off-by Jerone Young <[email protected]>configure +1
-1@@ -102,7 +102,7 @@ fi fi if [ "$arch" = "powerpc" ]; then - target_exec="ppcemb-softmmu" + target_exec="ppcemb_kvm-softmmu" fi #configure user dirqemu/Makefile.target +27
-13@@ -21,6 +21,9 @@ TARGET_BASE_ARCH:=ppc TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), ppcemb) +TARGET_BASE_ARCH:=ppc +endif +ifeq ($(TARGET_ARCH), ppcemb_kvm) TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), sparc64)@@ -179,22 +182,26 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o\ + host-utils.o + +CPPFLAGS+=-I$(SRC_PATH) + +ifeq ($(USE_KVM), 1) +LIBOBJS+=qemu-kvm.o +endif +ifdef CONFIG_SOFTFLOAT +LIBOBJS+=fpu/softfloat.o +else +LIBOBJS+=fpu/softfloat-native.o +endif +CPPFLAGS+=-I$(SRC_PATH)/fpu + +ifeq ($(TARGET_ARCH), i386) # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) -ifeq ($(USE_KVM), 1) -LIBOBJS+=qemu-kvm.o -endif -ifdef CONFIG_SOFTFLOAT -LIBOBJS+=fpu/softfloat.o -else -LIBOBJS+=fpu/softfloat-native.o -endif -CPPFLAGS+=-I$(SRC_PATH)/fpu - -ifeq ($(TARGET_ARCH), i386) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o@@ -203,6 +210,10 @@ endif endif ifeq ($(TARGET_ARCH), x86_64) +# TCG code generator +LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o +CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o@@ -214,6 +225,9 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +LIBOBJS+= fake-exec.o +else +LIBOBJS+=translate-all.o op.o translate.o endif endifqemu/configure +8
-1@@ -547,7 +547,7 @@ if test -z "$target_list" ; then if test -z "$target_list" ; then # these targets are portable if [ "$softmmu" = "yes" ] ; then - target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu" + target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu ppcemb_kvm-softmmu" fi # the following are Linux specific if [ "$linux_user" = "yes" ] ; then@@ -1027,6 +1027,7 @@ target_bigendian="no" [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes +[ "$target_cpu" = "ppcemb_kvm" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes [ "$target_cpu" = "mips" ] && target_bigendian=yes@@ -1149,6 +1150,12 @@ 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 +elif test "$target_cpu" = "ppcemb_kvm"; then + echo "TARGET_ARCH=ppcemb_kvm" >> $config_mak + echo "TARGET_ABI_DIR=ppc" >> $config_mak + echo "#define TARGET_ARCH \"ppcemb\" " >> $config_mak + 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
qemu/exec.c line 42
Quoted 8 lines
qemu/exec.c +3
-0@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if defined(TARGET_i386) || defined(TARGET_X86_64 )#include "tcg-target.h" +#endif
This is wrong and will break QEMU.
You need to change the #define TARGET_PPCEMB to be something else like TARGET_PPCEMB_KVM. Then you can change the above to
#if !defined(TARGET_PPCEMB_KVM)
You can still generate a #define TARGET_PPCEMB too to keep other things working.
Likewise, the same is true in the Makefile. You can't conditionally link against TCG if it's x86_64, you need to conditionally link if it's anything but PPCEMB_KVM.
Regards,
Anthony Liguori
-------------------------------------------------------------------------
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/
Quoted 145 lines · Anthony Liguori
Quoted 133 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.Signed-off-by Jerone Young <[email protected]>configure +1
-1@@ -102,7 +102,7 @@ fi fi if [ "$arch" = "powerpc" ]; then - target_exec="ppcemb-softmmu" + target_exec="ppcemb_kvm-softmmu" fi #configure user dirqemu/Makefile.target +27
-13@@ -21,6 +21,9 @@ TARGET_BASE_ARCH:=ppc TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), ppcemb) +TARGET_BASE_ARCH:=ppc +endif +ifeq ($(TARGET_ARCH), ppcemb_kvm) TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), sparc64)@@ -179,22 +182,26 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o\ + host-utils.o + +CPPFLAGS+=-I$(SRC_PATH) + +ifeq ($(USE_KVM), 1) +LIBOBJS+=qemu-kvm.o +endif +ifdef CONFIG_SOFTFLOAT +LIBOBJS+=fpu/softfloat.o +else +LIBOBJS+=fpu/softfloat-native.o +endif +CPPFLAGS+=-I$(SRC_PATH)/fpu + +ifeq ($(TARGET_ARCH), i386) # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) -ifeq ($(USE_KVM), 1) -LIBOBJS+=qemu-kvm.o -endif -ifdef CONFIG_SOFTFLOAT -LIBOBJS+=fpu/softfloat.o -else -LIBOBJS+=fpu/softfloat-native.o -endif -CPPFLAGS+=-I$(SRC_PATH)/fpu - -ifeq ($(TARGET_ARCH), i386) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o@@ -203,6 +210,10 @@ endif endif ifeq ($(TARGET_ARCH), x86_64) +# TCG code generator +LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o +CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +LIBOBJS+=translate-all.o op.o translate.o LIBOBJS+=helper.o helper2.o ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o@@ -214,6 +225,9 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +LIBOBJS+= fake-exec.o +else +LIBOBJS+=translate-all.o op.o translate.o endif endifqemu/configure +8
-1@@ -547,7 +547,7 @@ if test -z "$target_list" ; then if test -z "$target_list" ; then # these targets are portable if [ "$softmmu" = "yes" ] ; then - target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu" + target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu ppcemb_kvm-softmmu" fi # the following are Linux specific if [ "$linux_user" = "yes" ] ; then@@ -1027,6 +1027,7 @@ target_bigendian="no" [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes +[ "$target_cpu" = "ppcemb_kvm" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes [ "$target_cpu" = "mips" ] && target_bigendian=yes@@ -1149,6 +1150,12 @@ 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 +elif test "$target_cpu" = "ppcemb_kvm"; then + echo "TARGET_ARCH=ppcemb_kvm" >> $config_mak + echo "TARGET_ABI_DIR=ppc" >> $config_mak + echo "#define TARGET_ARCH \"ppcemb\" " >> $config_mak + 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_makqemu/exec.c line 42
Quoted 8 lines
qemu/exec.c +3
-0@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if defined(TARGET_i386) || defined(TARGET_X86_64 )#include "tcg-target.h" +#endif This is wrong and will break QEMU.
Quoted 6 lines
You need to change the #define
TARGET_PPCEMBto be something else likeTARGET_PPCEMB_KVM. Then you can change the above to
#if !defined(TARGET_PPCEMB_KVM)You can still generate a #define
TARGET_PPCEMBtoo to keep other things working.
I'll do this. But the issue here in upstream qemu this header is only defined under tcg/i386 & tcg/x86_64. So everyone else is out of luck.
Quoted 4 lines
Likewise, the same is true in the
Makefile. You can't conditionally link against TCG if it'sx86_64, you need to conditionally link if it's anything butPPCEMB_KVM.
The issue here is TCG is only for x86-64 & i386. No one else can use it. Is everyone else supposed to work then?
Quoted 5 lines
Regards,
Anthony Liguori
-------------------------------------------------------------------------
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/
Quoted 8 lines · Jerone Young
Quoted 3 lines
You can still generate a #define
TARGET_PPCEMBtoo to keep other things working.I'll do this. But the issue here in upstream qemu this header is only defined under tcg/i386 & tcg/x86_64. So everyone else is out of luck.
Quoted 8 lines
Quoted 4 lines
Likewise, the same is true in the
Makefile. You can't conditionally link against TCG if it'sx86_64, you need to conditionally link if it's anything butPPCEMB_KVM.The issue here is TCG is only for x86-64 & i386. No one else can use it. Is everyone else supposed to work then?
But your "solution" doesn't fix anyone else. It just causes a broken build for them :-)
Regards,
Anthony Liguori
Quoted 7 lines
Quoted 5 lines
Regards,
Anthony Liguori
-------------------------------------------------------------------------
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/
So here is another respin .. not so broken for everyone this time ;-)
configure +1 -1
@@ -102,7 +102,7 @@ fi fi if [ "$arch" = "powerpc" ]; then - target_exec="ppcemb-softmmu" + target_exec="ppcemb_kvm-softmmu" fi #configure user dir
qemu/Makefile.target +11 -2
@@ -21,6 +21,9 @@ TARGET_BASE_ARCH:=ppc TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), ppcemb) +TARGET_BASE_ARCH:=ppc +endif +ifeq ($(TARGET_ARCH), ppcemb_kvm) TARGET_BASE_ARCH:=ppc endif ifeq ($(TARGET_ARCH), sparc64)
@@ -179,11 +182,16 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o\ + host-utils.o + +ifneq ($(NO_TCG), 1) # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +LIBOBJS+=translate-all.o op.o translate.o +endif + ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm.o endif
@@ -214,6 +222,7 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +LIBOBJS+= fake-exec.o endif endif
qemu/configure +11 -1
@@ -547,7 +547,7 @@ if test -z "$target_list" ; then if test -z "$target_list" ; then # these targets are portable if [ "$softmmu" = "yes" ] ; then - target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu" + target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu ppcemb_kvm-softmmu" fi # the following are Linux specific if [ "$linux_user" = "yes" ] ; then
@@ -1027,6 +1027,7 @@ target_bigendian="no" [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes [ "$target_cpu" = "ppc" ] && target_bigendian=yes [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes +[ "$target_cpu" = "ppcemb_kvm" ] && target_bigendian=yes [ "$target_cpu" = "ppc64" ] && target_bigendian=yes [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes [ "$target_cpu" = "mips" ] && target_bigendian=yes
@@ -1149,6 +1150,15 @@ 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 +elif test "$target_cpu" = "ppcemb_kvm"; then + echo "TARGET_ARCH=ppcemb_kvm" >> $config_mak + echo "TARGET_ABI_DIR=ppc" >> $config_mak + echo "#define TARGET_ARCH \"ppcemb\" " >> $config_h + echo "#define TARGET_PPC 1" >> $config_h + echo "#define TARGET_PPCEMB 1" >> $config_h + echo "#define TARGET_PPCEMB_KVM 1" >> $config_h + echo "#define NO_TCG 1" >> $config_h + echo "NO_TCG=1" >> $config_mak configure_kvm elif test "$target_cpu" = "ppc64" ; then echo "TARGET_ARCH=ppc64" >> $config_mak
qemu/exec.c +4 -0
@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#ifndef NO_TCG #include "tcg-target.h" +#endif +#include "qemu-kvm.h" #if defined(CONFIG_USER_ONLY )#include <qemu.h>
qemu/fake-exec.c new file +62 -0
62 lines not on this page · raw message
-------------------------------------------------------------------------
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/
Quoted 2 lines · Jerone Young
So here is another respin .. not so broken for everyone this time ;-)
Just a few small comments...
qemu/Makefile.target LIBOBJS+= op_helper.o helper.o · line 228
Quoted 11 lines
ifeq ($(USE_KVM), 1)
LIBOBJS+=qemu-kvm.o
endifqemu/Makefile.target +1
-0@@ -214,6 +222,7 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +LIBOBJS+= fake-exec.o endif endif
Could you move this out of the USE_KVM and PPC checks and simply put it in a ifeq ($(NO_TCG), 1) check? Also, can you move the file into target-ppc? This way, it will be much easier to implement something similar for ia64 and x86.
qemu/fake-exec.c
Quoted 6 lines
qemu/fake-exec.c new file +0
-0@@ -0,0 +1,62 @@
Please add a copyright to this file.
Regards,
Anthony Liguori
-------------------------------------------------------------------------
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/
Quoted 9 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.
Since a target in qemu is a cpu type, how the instructions are executed (kvm, kqemu, dyngen, or tcg) shouldn't come into it. Instead we can have a --without-cpu-emulation or --no-tcg which would simply disable those parts.
Signature · 7 lines
Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- 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/
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.
Quoted 4 lines
Since a target in qemu is a cpu type, how the instructions are executed (kvm, kqemu, dyngen, or tcg) shouldn't come into it. Instead we can have a --without-cpu-emulation or --no-tcg which would simply disable those parts.
Actually this much much more sensible solution. So I took some time and implemented it.
So on the qemu command line you use "--disable-cpu-emulation"
qemu/Makefile.target +8 -2
@@ -179,11 +179,17 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o + +ifneq ($(NO_CPU_EMULATION), 1) +LIBOBJS+= translate-all.o translate.o op.o # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +else +LIBOBJS+= fake-exec.o +endif + ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm.o endif
qemu/configure +12 -0
@@ -110,6 +110,7 @@ darwin_user="no" darwin_user="no" build_docs="no" uname_release="" +cpu_emulation="yes" # OS specific targetos=`uname -s`
@@ -339,6 +340,8 @@ for opt do ;; --disable-werror) werror="no" ;; + --disable-cpu-emulation) cpu_emulation="no" + ;; *) echo "ERROR: unknown option $opt"; exit 1 ;; esac
@@ -770,6 +773,7 @@ fi fi echo "kqemu support $kqemu" echo "kvm support $kvm" +echo "CPU emulation $cpu_emulation" echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \ echo "uname -r $uname_release"
@@ -1094,12 +1098,20 @@ interp_prefix1=`echo "$interp_prefix" | interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h +disable_cpu_emulation() { + if test $cpu_emulation = "no"; then + echo "#define NO_CPU_EMULATION 1" >> $config_h + echo "NO_CPU_EMULATION=1" >> $config_mak + fi +} + configure_kvm() { if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \ \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then echo "#define USE_KVM 1" >> $config_h echo "USE_KVM=1" >> $config_mak echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak + disable_cpu_emulation fi }
qemu/exec.c +4 -0
@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if !defined(NO_CPU_EMULATION )#include "tcg-target.h" +#endif +#include "qemu-kvm.h" #if defined(CONFIG_USER_ONLY )#include <qemu.h>
qemu/fake-exec.c new file +62 -0
62 lines not on this page · raw message
-------------------------------------------------------------------------
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/
Quoted 14 lines · Jerone Young
Quoted 12 lines · Avi Kivity
Quoted 10 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.
Quoted 9 lines
Quoted 5 lines
Since a target in qemu is a cpu type, how the instructions are executed (kvm, kqemu, dyngen, or tcg) shouldn't come into it. Instead we can have a --without-cpu-emulation or --no-tcg which would simply disable those parts.
Actually this much much more sensible solution. So I took some time and implemented it.
Funny enough, I was thinking the same thing last night :-)
Please move fake-exec.c to target-ppc/fake-exec.c as it contains PPC specific code. Otherwise, this patch is much better!
Regards,
Anthony Liguori
-------------------------------------------------------------------------
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/
PATCH 1/1 Qemu powerpc work around
Ok taking everybodys suggestions. This patch adds a --disable-cpu-emulation option to qemu. This way powerpc has the ability to compile, and also gives other archs the ability to easily add the ability to compile without the tcg code.
qemu/Makefile.target +9 -2
@@ -179,11 +179,15 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o + +ifneq ($(NO_CPU_EMULATION), 1) +LIBOBJS+= translate-all.o translate.o op.o # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +endif + ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm.o endif
@@ -214,6 +218,9 @@ LIBOBJS+= op_helper.o helper.o LIBOBJS+= op_helper.o helper.o ifeq ($(USE_KVM), 1) LIBOBJS+= qemu-kvm-powerpc.o +endif +ifeq ($(NO_CPU_EMULATION), 1) +LIBOBJS+=fake-exec-ppc.o endif endif
qemu/configure +12 -0
@@ -110,6 +110,7 @@ darwin_user="no" darwin_user="no" build_docs="no" uname_release="" +cpu_emulation="yes" # OS specific targetos=`uname -s`
@@ -339,6 +340,8 @@ for opt do ;; --disable-werror) werror="no" ;; + --disable-cpu-emulation) cpu_emulation="no" + ;; *) echo "ERROR: unknown option $opt"; exit 1 ;; esac
@@ -770,6 +773,7 @@ fi fi echo "kqemu support $kqemu" echo "kvm support $kvm" +echo "CPU emulation $cpu_emulation" echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \ echo "uname -r $uname_release"
@@ -1094,12 +1098,20 @@ interp_prefix1=`echo "$interp_prefix" | interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h +disable_cpu_emulation() { + if test $cpu_emulation = "no"; then + echo "#define NO_CPU_EMULATION 1" >> $config_h + echo "NO_CPU_EMULATION=1" >> $config_mak + fi +} + configure_kvm() { if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \ \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then echo "#define USE_KVM 1" >> $config_h echo "USE_KVM=1" >> $config_mak echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak + disable_cpu_emulation fi }
qemu/exec.c +4 -0
@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if !defined(NO_CPU_EMULATION )#include "tcg-target.h" +#endif +#include "qemu-kvm.h" #if defined(CONFIG_USER_ONLY )#include <qemu.h>
qemu/fake-exec-ppc.c new file +75 -0
75 lines not on this page · raw message
-------------------------------------------------------------------------
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/
Hi Jerone,
Quoted 7 lines · Jerone Young
Ok taking everybodys suggestions. This patch adds a --disable-cpu-emulation option to qemu. This way powerpc has the ability to compile, and also gives other archs the ability to easily add the ability to compile without the tcg code.
Signed-off-by Jerone Young <[email protected]>
Can you try out this version of the patch on PPC? This version also supports --disable-cpu-emulation on x86. It also eliminates -no-kvm when using --disable-cpu-emulation and exit's if KVM can not be initialized.
This should be useful on x86 where people cannot easily get their hands on gcc-3 and only wish to run KVM.
Regards,
Anthony Liguori
qemu/Makefile.target +8 -2
@@ -179,11 +179,17 @@ all: $(PROGS) ######################################################### # cpu emulator library -LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ - translate.o op.o host-utils.o +LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o + +ifeq ($(NO_CPU_EMULATION), 1) +LIBOBJS+=fake-exec.o +else +LIBOBJS+= translate-all.o translate.o op.o # TCG code generator LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) +endif + ifeq ($(USE_KVM), 1) LIBOBJS+=qemu-kvm.o endif
qemu/configure +12 -0
@@ -110,6 +110,7 @@ linux_user="no" darwin_user="no" build_docs="no" uname_release="" +cpu_emulation="yes" # OS specific targetos=`uname -s`
@@ -339,6 +340,8 @@ for opt do ;; --disable-werror) werror="no" ;; + --disable-cpu-emulation) cpu_emulation="no" + ;; *) echo "ERROR: unknown option $opt"; exit 1 ;; esac
@@ -770,6 +773,7 @@ if test -n "$sparc_cpu"; then fi echo "kqemu support $kqemu" echo "kvm support $kvm" +echo "CPU emulation $cpu_emulation" echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \ echo "uname -r $uname_release"
@@ -1094,12 +1098,20 @@ elfload32="no" interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h +disable_cpu_emulation() { + if test $cpu_emulation = "no"; then + echo "#define NO_CPU_EMULATION 1" >> $config_h + echo "NO_CPU_EMULATION=1" >> $config_mak + fi +} + configure_kvm() { if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \ \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then echo "#define USE_KVM 1" >> $config_h echo "USE_KVM=1" >> $config_mak echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak + disable_cpu_emulation fi }
qemu/exec.c +4 -0
@@ -35,7 +35,11 @@#include "cpu.h" #include "exec-all.h" + +#if !defined(NO_CPU_EMULATION )#include "tcg-target.h" +#endif +#include "qemu-kvm.h" #if defined(CONFIG_USER_ONLY )#include <qemu.h>
qemu/target-i386/fake-exec.c new file +54 -0
54 lines not on this page · raw message
qemu/target-ppc/fake-exec.c new file +75 -0
75 lines not on this page · raw message
qemu/vl.c +8 -0
@@ -8050,7 +8050,9 @@ static void help(int exitcode) "-no-kqemu disable KQEMU kernel module usage\n"#endif #ifdef USE_KVM +#ifndef NO_CPU_EMULATION "-no-kvm disable KVM hardware virtualization\n" +#endif "-no-kvm-irqchip disable KVM kernel mode PIC/IOAPIC/LAPIC\n"#endif #ifdef TARGET_I386
@@ -8250,7 +8252,9 @@ const QEMUOption qemu_options[] = { { "kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu }, #endif #ifdef USE_KVM +#ifndef NO_CPU_EMULATION { "no-kvm", 0, QEMU_OPTION_no_kvm }, +#endif { "no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip }, #endif #if defined(TARGET_PPC) || defined(TARGET_SPARC)
@@ -9266,6 +9270,10 @@ int main(int argc, char **argv)if (kvm_qemu_init () <0 ) {extern int kvm_allowed;fprintf (stderr,"Could not initialize KVM, will disable KVM support\n" ); +#ifdef NO_CPU_EMULATION +fprintf (stderr,"Compiled with --disable-cpu-emulation, exiting.\n" ); +exit (1 ); +#endif kvm_allowed =0 ; } }
-------------------------------------------------------------------------
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 works better. Not sure why but when I had fake-exec in target-ppc, the build system was complaining that it could not find fake-exec.d. So then I just decided to move it to fake-exec-ppc.c.
This patch works fine for powerpc.
Quoted 35 lines · Anthony Liguori
Quoted 14 lines · Jerone Young
Quoted 12 lines · Avi Kivity
Quoted 10 lines · Jerone Young
So the recent code in qemu cvs has problem powerpc. So what I have done is mainly work around this in the build system, by creating ppcemb_kvm-sofmmu target. Along with this is a
fake-exec.cthat stubs out the functions that are no longer defined (something done by Anthony Liguori attempting to fixqemu_cvs). What do folks think about this approach, for us all we really need is a qemu that is not built with tcg dependency.Quoted 9 lines
Quoted 5 lines
Since a target in qemu is a cpu type, how the instructions are executed (kvm, kqemu, dyngen, or tcg) shouldn't come into it. Instead we can have a --without-cpu-emulation or --no-tcg which would simply disable those parts.
Actually this much much more sensible solution. So I took some time and implemented it.
Funny enough, I was thinking the same thing last night :-)
Please move
fake-exec.ctotarget-ppc/fake-exec.cas it contains PPC specific code. Otherwise, this patch is much better!Regards,
Anthony Liguori
Quoted 8 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/
Avi Kivity
AppliedQuoted 6 lines · Jerone Young
This works better. Not sure why but when I had fake-exec in target-ppc, the build system was complaining that it could not find fake-exec.d. So then I just decided to move it to
fake-exec-ppc.c.This patch works fine for powerpc.
Applied; thanks.
Signature · 7 lines
Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- 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/