From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerone Young Subject: Re: Latest qemu tcg breakage Date: Mon, 09 Jun 2008 15:51:46 -0500 Message-ID: <1213044706.29739.12.camel@thinkpadL> References: <1213019621.6792.7.camel@thinkpadL> <484D5BBF.6030904@codemonkey.ws> Reply-To: jyoung5@us.ibm.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-pHwZtGbhUJA1LP3bcoo8" Cc: kvm , kvm-ppc-devel To: Anthony Liguori Return-path: Received: from e33.co.us.ibm.com ([32.97.110.151]:40027 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235AbYFIUvw (ORCPT ); Mon, 9 Jun 2008 16:51:52 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m59KppQ6008996 for ; Mon, 9 Jun 2008 16:51:51 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m59KpkfZ070130 for ; Mon, 9 Jun 2008 14:51:48 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m59KpkVB007436 for ; Mon, 9 Jun 2008 14:51:46 -0600 In-Reply-To: <484D5BBF.6030904@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: --=-pHwZtGbhUJA1LP3bcoo8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Actually I was mistaken. While upstream qemu does compile, after doing a clean on my local directory of kvm-userspace. I'm finding that after removing cpu-emulation stuff I get a error when building exec.c In file included from /home/jerone/work/kvm-userspace/qemu/tcg/tcg.h:50, from /home/jerone/work/kvm-userspace/qemu/exec.c:40: /home/jerone/work/kvm-userspace/qemu/tcg/tcg-opc.h:25:24: dyngen-opc.h: No such file or directory Now removing CONFIG_DYNGEN from configure yields more errors ;-). This is removed for x86 & ia64. So lets not remove it till can git this sorted out. But here is a patch attached to play with :-L On Mon, 2008-06-09 at 11:35 -0500, Anthony Liguori wrote: > Jerone Young wrote: > > So upstream qemu is being pervasive about changes with TCG, starting to > > place tcg only functions in exec.c . I've spun a quick patch that fixes > > things for PowerPC when building qemu. But we need to try and isolate > > TCG in upstream qemu as it is starting to leak, and I'm not sure of a > > good way to fix it as there is no CONFIG defined for tcg currently. > > > > Just something to keep in mind. > > > > Now that TCG supports PPC, shouldn't ya'll be able to drop > --disable-cpu-emulation. I believe that will simultaneously fix your > problem and reduce the difference between upstream QEMU. > > Regards, > > Anthony Liguori > > > Signed-off-by: Jerone Young > > > > diff --git a/qemu/Makefile.target b/qemu/Makefile.target > > --- a/qemu/Makefile.target > > +++ b/qemu/Makefile.target > > @@ -196,7 +196,6 @@ LIBOBJS+=fake-exec.o > > LIBOBJS+=fake-exec.o > > else > > LIBOBJS+= translate-all.o translate.o > > -endif > > ifdef CONFIG_DYNGEN_OP > > LIBOBJS+=op.o > > endif > > @@ -205,6 +204,7 @@ CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH > > CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) > > ifeq ($(ARCH),sparc64) > > CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc > > +endif > > endif > > > > ifeq ($(USE_KVM), 1) > > diff --git a/qemu/exec.c b/qemu/exec.c > > --- a/qemu/exec.c > > +++ b/qemu/exec.c > > @@ -37,8 +37,11 @@ > > #include "exec-all.h" > > #include "qemu-common.h" > > > > +#ifdef USE_KVM > > +#include "qemu-kvm.h" > > +#else > > #include "tcg.h" > > -#include "qemu-kvm.h" > > +#endif > > > > #if defined(CONFIG_USER_ONLY) > > #include > > @@ -3197,7 +3200,9 @@ void dump_exec_info(FILE *f, > > cpu_fprintf(f, "TB flush count %d\n", tb_flush_count); > > cpu_fprintf(f, "TB invalidate count %d\n", > > tb_phys_invalidate_count); > > cpu_fprintf(f, "TLB flush count %d\n", tlb_flush_count); > > +#if !defined(USE_KVM) > > tcg_dump_info(f, cpu_fprintf); > > +#endif > > } > > > > #if !defined(CONFIG_USER_ONLY) > > > > > > -- > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --=-pHwZtGbhUJA1LP3bcoo8 Content-Disposition: attachment; filename=remove_cpu_emulation Content-Type: text/plain; name=remove_cpu_emulation; charset=utf-8 Content-Transfer-Encoding: 7bit Remove qemu files and entries associated with --disable-cpu-emulation configure argument. Signed-off-by: Jerone Young diff --git a/qemu/Makefile.target b/qemu/Makefile.target --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -192,11 +192,7 @@ all: $(PROGS) # cpu emulator library 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 -endif ifdef CONFIG_DYNGEN_OP LIBOBJS+=op.o endif diff --git a/qemu/configure b/qemu/configure --- a/qemu/configure +++ b/qemu/configure @@ -116,7 +116,6 @@ uname_release="" uname_release="" curses="yes" nptl="yes" -cpu_emulation="yes" device_tree_support="" # OS specific @@ -353,8 +352,6 @@ for opt do ;; --disable-nptl) nptl="no" ;; - --disable-cpu-emulation) cpu_emulation="no" - ;; --disable-libfdt) device_tree_support="no" ;; *) echo "ERROR: unknown option $opt"; exit 1 @@ -463,7 +460,6 @@ echo " --fmod-inc path to echo " --fmod-inc path to FMOD includes" echo " --enable-uname-release=R Return R for uname -r in usermode emulation" echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" -echo " --disable-cpu-emulation disables use of qemu cpu emulation code" echo " --disable-libfdt disables use of libfdt support for device tree" echo "" echo "NOTE: The object files are built at the place where configure is launched" @@ -926,7 +922,6 @@ fi fi echo "kqemu support $kqemu" echo "kvm support $kvm" -echo "CPU emulation $cpu_emulation" if test $cpu = "powerpc"; then echo "libfdt support $device_tree_support" fi @@ -1291,13 +1286,6 @@ 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 @@ -1308,7 +1296,6 @@ configure_kvm() { echo "USE_KVM_PIT=1" >> $config_mak echo "#define USE_KVM_PIT 1" >> $config_h fi - disable_cpu_emulation fi } diff --git a/qemu/target-i386/fake-exec.c b/qemu/target-i386/fake-exec.c deleted file mode 100644 --- a/qemu/target-i386/fake-exec.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * 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-ia64/fake-exec.c b/qemu/target-ia64/fake-exec.c deleted file mode 100644 --- a/qemu/target-ia64/fake-exec.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * fake-exec.c for ia64. - * - * 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 - * - * Copyright 2008 Intel Corporation. - * Added by Xiantao Zhang - * - * This work is licensed under the GNU GPL licence version 2 or later. - * - */ -#include "exec.h" -#include "cpu.h" - -int code_copy_enabled = 0; - -void cpu_gen_init(void) -{ -} - -unsigned long code_gen_max_block_size(void) -{ - return 32; -} - -int cpu_ia64_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) -{ - return 0; -} - -void flush_icache_range(unsigned long start, unsigned long stop) -{ - while (start < stop) { - asm volatile ("fc %0" :: "r"(start)); - start += 32; - } - asm volatile (";;sync.i;;srlz.i;;"); -} - diff --git a/qemu/target-ppc/fake-exec.c b/qemu/target-ppc/fake-exec.c deleted file mode 100644 --- a/qemu/target-ppc/fake-exec.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 - * This work is licensed under the GNU GPL licence version 2 or later. - * - */ - -#include -#include -#include -#include -#include - -#include "cpu.h" -#include "exec-all.h" - - -struct ppc_def_t { - const unsigned char *name; - uint32_t pvr; - uint32_t svr; - uint64_t insns_flags; - uint64_t msr_mask; - powerpc_mmu_t mmu_model; - powerpc_excp_t excp_model; - powerpc_input_t bus_model; - uint32_t flags; - int bfd_mach; - void (*init_proc)(CPUPPCState *env); - int (*check_pow)(CPUPPCState *env); -}; - -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; -} - -void init_proc_ppc440ep_kvm(CPUPPCState *env) -{ - ppc40x_irq_init(env); -} - -static ppc_def_t ppc440ep_kvm = { - .name = "440EP KVM", - .mmu_model = POWERPC_MMU_SOFT_4xx, /*XXX needed for GDB stub */ - .init_proc = init_proc_ppc440ep_kvm, -}; - -const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name) -{ - return &ppc440ep_kvm; -} - -int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) -{ - env->mmu_model = def->mmu_model; - (*def->init_proc)(env); - return 0; -} - -void flush_icache_range(unsigned long start, unsigned long stop) -{ -} diff --git a/qemu/vl.c b/qemu/vl.c --- a/qemu/vl.c +++ b/qemu/vl.c @@ -7786,9 +7786,7 @@ 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" "-no-kvm-pit disable KVM kernel mode PIT\n" #endif @@ -7997,9 +7995,7 @@ 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 }, { "no-kvm-pit", 0, QEMU_OPTION_no_kvm_pit }, #endif @@ -9083,10 +9079,6 @@ 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; } } --=-pHwZtGbhUJA1LP3bcoo8--