[PATCH] Remove --disable-cpu-emulation (v2 -- sort of)

Anthony Liguori
2008-07-22T19:39:02Z

This option was meant to be temporary until TCG was fixed on PowerPC hosts. It
has been so let's get rid of it. The only issue this would introduce is that
GCC 4 could no longer be used to build KVM for PowerPC. Hollis has switched to
GCC 3.x for other reasons though so this is not a big deal.

This moves us closer to QEMU and gets rid of a bit of a wart.

I've compile tested this with powerpc and x86.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/configure b/configure
index 58908e4..07d0d46 100755
--- a/configure
+++ b/configure
@@ -12,6 +12,7 @@ qemu_opts=
cross_prefix=
arch=`uname -m`
target_exec=
+no_gcc_check=

# find source path, adapted from QEMU's configure
source_path=`dirname "$0"`
@@ -95,10 +96,12 @@ fi
if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
target_exec="x86_64-softmmu"
qemu_cflags="$qemu_cflags -DCONFIG_X86"
+ no_gcc_check="yes"
fi

if [ "$arch" = "ia64" ]; then
target_exec="ia64-softmmu"
+ no_gcc_check="yes"
fi

if [ "$arch" = "powerpc" ]; then
@@ -134,7 +137,7 @@ libkvm_kerneldir=$(readlink -f kernel)
#configure qemu
(cd qemu; "$source_path"/qemu/configure --target-list=$target_exec \
--disable-kqemu \
- --disable-gcc-check \
+ ${no_gcc_check:+"--disable-gcc-check"} \
--extra-cflags="-I $source_path/libkvm $qemu_cflags" \
--extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
--kernel-path="$libkvm_kerneldir" \
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 54480e4..ccf45d0 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -191,14 +191,10 @@ 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
+LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
+ translate.o host-utils.o
ifdef CONFIG_DYNGEN_OP
+exec.o: dyngen-opc.h
LIBOBJS+=op.o
endif
# TCG code generator
diff --git a/qemu/configure b/qemu/configure
index 60e8493..ae07342 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -110,7 +110,6 @@ uname_release=""
curses="yes"
nptl="yes"
mixemu="no"
-cpu_emulation="yes"
device_tree_support=""

# OS specific
@@ -351,8 +350,6 @@ for opt do
;;
--enable-mixemu) mixemu="yes"
;;
- --disable-cpu-emulation) cpu_emulation="no"
- ;;
--disable-libfdt) device_tree_support="no"
;;
*) echo "ERROR: unknown option $opt"; exit 1
@@ -458,7 +455,6 @@ echo " --fmod-lib path to FMOD library"
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"
@@ -1286,13 +1282,6 @@ target_nptl="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
@@ -1303,7 +1292,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
index 737286d..0000000
--- 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 <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
deleted file mode 100644
index 259e06d..0000000
--- 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 <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"
-
-
-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
index d9b7db2..01b7bde 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -7948,9 +7948,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
@@ -8160,9 +8158,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
@@ -9234,10 +9230,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;
}
}