* [RFC] Qemu powerpc work around
@ 2008-02-12 21:37 Jerone Young
2008-02-12 21:44 ` Anthony Liguori
2008-02-13 7:29 ` Avi Kivity
0 siblings, 2 replies; 13+ messages in thread
From: Jerone Young @ 2008-02-12 21:37 UTC (permalink / raw)
To: kvm-devel; +Cc: hollisb
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.
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -102,7 +102,7 @@ fi
fi
if [ "$arch" = "powerpc" ]; then
- target_exec="ppcemb-softmmu"
+ target_exec="ppcemb_kvm-softmmu"
fi
#configure user dir
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -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
diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -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
diff --git a/qemu/exec.c b/qemu/exec.c
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -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>
diff --git a/qemu/fake-exec.c b/qemu/fake-exec.c
new file mode 100644
--- /dev/null
+++ b/qemu/fake-exec.c
@@ -0,0 +1,62 @@
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 21:37 [RFC] Qemu powerpc work around Jerone Young
@ 2008-02-12 21:44 ` Anthony Liguori
2008-02-12 21:53 ` Jerone Young
2008-02-13 7:29 ` Avi Kivity
1 sibling, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2008-02-12 21:44 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb
Jerone Young wrote:
> 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.
>
> Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
>
> diff --git a/configure b/configure
> --- a/configure
> +++ b/configure
> @@ -102,7 +102,7 @@ fi
> fi
>
> if [ "$arch" = "powerpc" ]; then
> - target_exec="ppcemb-softmmu"
> + target_exec="ppcemb_kvm-softmmu"
> fi
>
> #configure user dir
> diff --git a/qemu/Makefile.target b/qemu/Makefile.target
> --- a/qemu/Makefile.target
> +++ b/qemu/Makefile.target
> @@ -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
>
> diff --git a/qemu/configure b/qemu/configure
> --- a/qemu/configure
> +++ b/qemu/configure
> @@ -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
> diff --git a/qemu/exec.c b/qemu/exec.c
> --- a/qemu/exec.c
> +++ b/qemu/exec.c
> @@ -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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 21:44 ` Anthony Liguori
@ 2008-02-12 21:53 ` Jerone Young
2008-02-12 22:03 ` Anthony Liguori
0 siblings, 1 reply; 13+ messages in thread
From: Jerone Young @ 2008-02-12 21:53 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel, hollisb
On Tue, 2008-02-12 at 15:44 -0600, Anthony Liguori wrote:
> Jerone Young wrote:
> > 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.
> >
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> >
> > diff --git a/configure b/configure
> > --- a/configure
> > +++ b/configure
> > @@ -102,7 +102,7 @@ fi
> > fi
> >
> > if [ "$arch" = "powerpc" ]; then
> > - target_exec="ppcemb-softmmu"
> > + target_exec="ppcemb_kvm-softmmu"
> > fi
> >
> > #configure user dir
> > diff --git a/qemu/Makefile.target b/qemu/Makefile.target
> > --- a/qemu/Makefile.target
> > +++ b/qemu/Makefile.target
> > @@ -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
> >
> > diff --git a/qemu/configure b/qemu/configure
> > --- a/qemu/configure
> > +++ b/qemu/configure
> > @@ -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
> > diff --git a/qemu/exec.c b/qemu/exec.c
> > --- a/qemu/exec.c
> > +++ b/qemu/exec.c
> > @@ -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.
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.
>
> 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.
The issue here is TCG is only for x86-64 & i386. No one else can use it.
Is everyone else supposed to work then?
>
> 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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 21:53 ` Jerone Young
@ 2008-02-12 22:03 ` Anthony Liguori
2008-02-12 22:50 ` Jerone Young
0 siblings, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2008-02-12 22:03 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb
Jerone Young wrote:
>> You can still generate a #define TARGET_PPCEMB too 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.
>
>
>> 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.
>>
>
> 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
>> 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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 22:03 ` Anthony Liguori
@ 2008-02-12 22:50 ` Jerone Young
2008-02-13 0:47 ` Anthony Liguori
0 siblings, 1 reply; 13+ messages in thread
From: Jerone Young @ 2008-02-12 22:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel, hollisb
So here is another respin .. not so broken for everyone this time ;-)
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -102,7 +102,7 @@ fi
fi
if [ "$arch" = "powerpc" ]; then
- target_exec="ppcemb-softmmu"
+ target_exec="ppcemb_kvm-softmmu"
fi
#configure user dir
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -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
diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -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
diff --git a/qemu/exec.c b/qemu/exec.c
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -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>
diff --git a/qemu/fake-exec.c b/qemu/fake-exec.c
new file mode 100644
--- /dev/null
+++ b/qemu/fake-exec.c
@@ -0,0 +1,62 @@
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 22:50 ` Jerone Young
@ 2008-02-13 0:47 ` Anthony Liguori
0 siblings, 0 replies; 13+ messages in thread
From: Anthony Liguori @ 2008-02-13 0:47 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb
Jerone Young wrote:
> So here is another respin .. not so broken for everyone this time ;-)
>
Just a few small comments...
> 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
>
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.
> diff --git a/qemu/fake-exec.c b/qemu/fake-exec.c
> new file mode 100644
> --- /dev/null
> +++ b/qemu/fake-exec.c
> @@ -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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-12 21:37 [RFC] Qemu powerpc work around Jerone Young
2008-02-12 21:44 ` Anthony Liguori
@ 2008-02-13 7:29 ` Avi Kivity
2008-02-13 17:39 ` Jerone Young
1 sibling, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2008-02-13 7:29 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb
Jerone Young wrote:
> 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.
>
>
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.
--
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-13 7:29 ` Avi Kivity
@ 2008-02-13 17:39 ` Jerone Young
2008-02-13 18:55 ` Anthony Liguori
0 siblings, 1 reply; 13+ messages in thread
From: Jerone Young @ 2008-02-13 17:39 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, hollisb
On Wed, 2008-02-13 at 09:29 +0200, Avi Kivity wrote:
> Jerone Young wrote:
> > 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.
> >
> >
>
> 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"
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -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
diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -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
}
diff --git a/qemu/exec.c b/qemu/exec.c
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -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>
diff --git a/qemu/fake-exec.c b/qemu/fake-exec.c
new file mode 100644
--- /dev/null
+++ b/qemu/fake-exec.c
@@ -0,0 +1,62 @@
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-13 17:39 ` Jerone Young
@ 2008-02-13 18:55 ` Anthony Liguori
2008-02-13 19:27 ` [PATCH] " Jerone Young
2008-02-13 20:29 ` [RFC] " Jerone Young
0 siblings, 2 replies; 13+ messages in thread
From: Anthony Liguori @ 2008-02-13 18:55 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb, Avi Kivity
Jerone Young wrote:
> On Wed, 2008-02-13 at 09:29 +0200, Avi Kivity wrote:
>
>> Jerone Young wrote:
>>
>>> 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.
>>>
>>>
>>>
>> 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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] Qemu powerpc work around
2008-02-13 18:55 ` Anthony Liguori
@ 2008-02-13 19:27 ` Jerone Young
2008-02-13 20:20 ` Anthony Liguori
2008-02-13 20:29 ` [RFC] " Jerone Young
1 sibling, 1 reply; 13+ messages in thread
From: Jerone Young @ 2008-02-13 19:27 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel, hollisb, Avi Kivity
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 <jyoung5@us.ibm.com>
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -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
diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -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
}
diff --git a/qemu/exec.c b/qemu/exec.c
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -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>
diff --git a/qemu/fake-exec-ppc.c b/qemu/fake-exec-ppc.c
new file mode 100644
--- /dev/null
+++ b/qemu/fake-exec-ppc.c
@@ -0,0 +1,75 @@
+/*
+ * fake-exec.c
+ *
+ * This is a file for stub functions so that compilation is possible
+ * when TCG CPU emulation is disabled during compilation.
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * This work is licensed under the GNU GPL licence version 2 or later.
+ *
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Qemu powerpc work around
2008-02-13 19:27 ` [PATCH] " Jerone Young
@ 2008-02-13 20:20 ` Anthony Liguori
0 siblings, 0 replies; 13+ messages in thread
From: Anthony Liguori @ 2008-02-13 20:20 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb, Avi Kivity
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
Hi Jerone,
Jerone Young wrote:
> 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 <jyoung5@us.ibm.com>
>
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
[-- Attachment #2: qemu_no_emulation.patch --]
[-- Type: text/x-patch, Size: 6603 bytes --]
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 49b81df..8b0436b 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -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
diff --git a/qemu/configure b/qemu/configure
index 92299b9..bc42665 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -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
}
diff --git a/qemu/exec.c b/qemu/exec.c
index 050b150..960adcd 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -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>
diff --git a/qemu/target-i386/fake-exec.c b/qemu/target-i386/fake-exec.c
new file mode 100644
index 0000000..737286d
--- /dev/null
+++ b/qemu/target-i386/fake-exec.c
@@ -0,0 +1,54 @@
+/*
+ * fake-exec.c
+ *
+ * This is a file for stub functions so that compilation is possible
+ * when TCG CPU emulation is disabled during compilation.
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * This work is licensed under the GNU GPL licence version 2 or later.
+ *
+ */
+#include "exec.h"
+#include "cpu.h"
+
+int code_copy_enabled = 0;
+
+CCTable cc_table[CC_OP_NB];
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_x86_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
+
+void optimize_flags_init(void)
+{
+}
diff --git a/qemu/target-ppc/fake-exec.c b/qemu/target-ppc/fake-exec.c
new file mode 100644
index 0000000..b042f58
--- /dev/null
+++ b/qemu/target-ppc/fake-exec.c
@@ -0,0 +1,75 @@
+/*
+ * fake-exec.c
+ *
+ * This is a file for stub functions so that compilation is possible
+ * when TCG CPU emulation is disabled during compilation.
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * This work is licensed under the GNU GPL licence version 2 or later.
+ *
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
diff --git a/qemu/vl.c b/qemu/vl.c
index 5e14c1a..3528bbf 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -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;
}
}
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-13 18:55 ` Anthony Liguori
2008-02-13 19:27 ` [PATCH] " Jerone Young
@ 2008-02-13 20:29 ` Jerone Young
2008-02-14 9:33 ` Avi Kivity
1 sibling, 1 reply; 13+ messages in thread
From: Jerone Young @ 2008-02-13 20:29 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel, hollisb, Avi Kivity
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.
On Wed, 2008-02-13 at 12:55 -0600, Anthony Liguori wrote:
> Jerone Young wrote:
> > On Wed, 2008-02-13 at 09:29 +0200, Avi Kivity wrote:
> >
> >> Jerone Young wrote:
> >>
> >>> 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.
> >>>
> >>>
> >>>
> >> 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/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> 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/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] Qemu powerpc work around
2008-02-13 20:29 ` [RFC] " Jerone Young
@ 2008-02-14 9:33 ` Avi Kivity
0 siblings, 0 replies; 13+ messages in thread
From: Avi Kivity @ 2008-02-14 9:33 UTC (permalink / raw)
To: jyoung5; +Cc: kvm-devel, hollisb
Jerone Young wrote:
> 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.
--
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/
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-02-14 9:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-12 21:37 [RFC] Qemu powerpc work around Jerone Young
2008-02-12 21:44 ` Anthony Liguori
2008-02-12 21:53 ` Jerone Young
2008-02-12 22:03 ` Anthony Liguori
2008-02-12 22:50 ` Jerone Young
2008-02-13 0:47 ` Anthony Liguori
2008-02-13 7:29 ` Avi Kivity
2008-02-13 17:39 ` Jerone Young
2008-02-13 18:55 ` Anthony Liguori
2008-02-13 19:27 ` [PATCH] " Jerone Young
2008-02-13 20:20 ` Anthony Liguori
2008-02-13 20:29 ` [RFC] " Jerone Young
2008-02-14 9:33 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox