From: Jerone Young Subject: Re: [RFC] Qemu powerpc work around Date: Wed, 13 Feb 2008 11:39:36 -0600 Message-ID: <1202924376.6744.5.camel@thinkpad.austin.ibm.com> References: <1202852254.16861.6.camel@thinkpad.austin.ibm.com> <47B29C6F.3090503@qumranet.com> Reply-To: jyoung5@us.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , hollisb To: Avi Kivity Return-path: In-Reply-To: <47B29C6F.3090503@qumranet.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org 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 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 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 +#include +#include +#include +#include + +#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/