Skip to content

Commit

Permalink
Unbreak large mem support by removing kqemu
Browse files Browse the repository at this point in the history
kqemu introduces a number of restrictions on the i386 target.  The worst is that
it prevents large memory from working in the default build.

Furthermore, kqemu is fundamentally flawed in a number of ways.  It relies on
the TSC as a time source which will not be reliable on a multiple processor
system in userspace.  Since most modern processors are multicore, this severely
limits the utility of kqemu.

kvm is a viable alternative for people looking to accelerate qemu and has the
benefit of being supported by the upstream Linux kernel.  If someone can
implement work arounds to remove the restrictions introduced by kqemu, I'm
happy to avoid and/or revert this patch.

N.B. kqemu will still function in the 0.11 series but this patch removes it from
the 0.12 series.

Paul, please Ack or Nack this patch.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Anthony Liguori committed Aug 24, 2009
1 parent 0953a80 commit 4a1418e
Show file tree
Hide file tree
Showing 24 changed files with 8 additions and 1,722 deletions.
1 change: 0 additions & 1 deletion MAINTAINERS
Expand Up @@ -70,7 +70,6 @@ Generic Subsystems:
Dynamic translator Fabrice Bellard
Main loop Fabrice Bellard (new maintainer needed)
TCG Fabrice Bellard
kqemu interface Fabrice Bellard
IDE device ?
SCSI device Paul Brook
PCI layer ?
Expand Down
1 change: 0 additions & 1 deletion Makefile.target
Expand Up @@ -36,7 +36,6 @@ all: $(PROGS)
#########################################################
# cpu emulator library
libobj-y = exec.o translate-all.o cpu-exec.o translate.o
libobj-$(CONFIG_KQEMU) += kqemu.o
libobj-y += tcg/tcg.o tcg/tcg-runtime.o
libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
Expand Down
27 changes: 0 additions & 27 deletions configure
Expand Up @@ -185,7 +185,6 @@ vnc_sasl="yes"
bsd="no"
linux="no"
solaris="no"
kqemu="no"
profiler="no"
cocoa="no"
softmmu="yes"
Expand Down Expand Up @@ -238,25 +237,16 @@ MINGW32*)
GNU/kFreeBSD)
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
;;
FreeBSD)
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
;;
DragonFly)
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
aio="no"
;;
NetBSD)
Expand Down Expand Up @@ -320,9 +310,6 @@ SunOS)
exit 1
fi
fi
if test "$solarisrev" -ge 9 ; then
kqemu="yes"
fi
fi
if test -f /usr/include/sys/soundcard.h ; then
audio_drv_list="oss"
Expand All @@ -343,7 +330,6 @@ AIX)
usb="linux"
kvm="yes"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
audio_possible_drivers="$audio_possible_drivers fmod"
fi
;;
Expand All @@ -358,9 +344,6 @@ if [ "$bsd" = "yes" ] ; then
fi

if test "$mingw32" = "yes" ; then
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
fi
EXESUF=".exe"
QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
Expand Down Expand Up @@ -450,8 +433,6 @@ for opt do
;;
--disable-vde) vde="no"
;;
--disable-kqemu) kqemu="no"
;;
--disable-xen) xen="no"
;;
--disable-brlapi) brlapi="no"
Expand Down Expand Up @@ -597,9 +578,6 @@ echo " --interp-prefix=PREFIX where to find shared libraries, etc."
echo " use %M for cpu name [$interp_prefix]"
echo " --target-list=LIST set target list [$target_list]"
echo ""
echo "kqemu kernel acceleration support:"
echo " --disable-kqemu disable kqemu support"
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
Expand Down Expand Up @@ -1534,7 +1512,6 @@ fi
if test -n "$sparc_cpu"; then
echo "Target Sparc Arch $sparc_cpu"
fi
echo "kqemu support $kqemu"
echo "xen support $xen"
echo "brlapi support $brlapi"
echo "Documentation $build_docs"
Expand Down Expand Up @@ -2019,10 +1996,6 @@ case "$target_arch2" in
if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
echo "CONFIG_XEN=y" >> $config_mak
fi
if test $kqemu = "yes" -a "$target_softmmu" = "yes"
then
echo "CONFIG_KQEMU=y" >> $config_mak
fi
esac
case "$target_arch2" in
i386|x86_64|ppcemb|ppc|ppc64)
Expand Down
6 changes: 0 additions & 6 deletions cpu-all.h
Expand Up @@ -873,7 +873,6 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr,

#define VGA_DIRTY_FLAG 0x01
#define CODE_DIRTY_FLAG 0x02
#define KQEMU_DIRTY_FLAG 0x04
#define MIGRATION_DIRTY_FLAG 0x08

/* read dirty bit (return 0 or 1) */
Expand Down Expand Up @@ -1056,14 +1055,9 @@ static inline int64_t profile_getclock(void)
return cpu_get_real_ticks();
}

extern int64_t kqemu_time, kqemu_time_start;
extern int64_t qemu_time, qemu_time_start;
extern int64_t tlb_flush_time;
extern int64_t kqemu_exec_count;
extern int64_t dev_time;
extern int64_t kqemu_ret_int_count;
extern int64_t kqemu_ret_excp_count;
extern int64_t kqemu_ret_intr_count;
#endif

void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
Expand Down
5 changes: 0 additions & 5 deletions cpu-common.h
Expand Up @@ -10,12 +10,7 @@
#include "bswap.h"

/* address in the RAM (different from a physical address) */
#ifdef CONFIG_KQEMU
/* FIXME: This is wrong. */
typedef uint32_t ram_addr_t;
#else
typedef unsigned long ram_addr_t;
#endif

/* memory API */

Expand Down
38 changes: 1 addition & 37 deletions cpu-exec.c
Expand Up @@ -321,31 +321,6 @@ int cpu_exec(CPUState *env1)
}
env->exception_index = -1;
}
#ifdef CONFIG_KQEMU
if (kqemu_is_ok(env) && env->interrupt_request == 0 && env->exit_request == 0) {
int ret;
env->eflags = env->eflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK);
ret = kqemu_cpu_exec(env);
/* put eflags in CPU temporary format */
CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
DF = 1 - (2 * ((env->eflags >> 10) & 1));
CC_OP = CC_OP_EFLAGS;
env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
if (ret == 1) {
/* exception */
longjmp(env->jmp_env, 1);
} else if (ret == 2) {
/* softmmu execution needed */
} else {
if (env->interrupt_request != 0 || env->exit_request != 0) {
/* hardware interrupt will be executed just after */
} else {
/* otherwise, we restart */
longjmp(env->jmp_env, 1);
}
}
}
#endif

if (kvm_enabled()) {
kvm_cpu_exec(env);
Expand Down Expand Up @@ -620,11 +595,7 @@ int cpu_exec(CPUState *env1)
spans two pages, we cannot safely do a direct
jump. */
{
if (next_tb != 0 &&
#ifdef CONFIG_KQEMU
(env->kqemu_enabled != 2) &&
#endif
tb->page_addr[1] == -1) {
if (next_tb != 0 && tb->page_addr[1] == -1) {
tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb);
}
}
Expand Down Expand Up @@ -678,13 +649,6 @@ int cpu_exec(CPUState *env1)
}
/* reset soft MMU for next block (it can currently
only be set by a memory fault) */
#if defined(CONFIG_KQEMU)
#define MIN_CYCLE_BEFORE_SWITCH (100 * 1000)
if (kqemu_is_ok(env) &&
(cpu_get_time_fast() - env->last_io_time) >= MIN_CYCLE_BEFORE_SWITCH) {
cpu_loop_exit();
}
#endif
} /* for(;;) */
} else {
env_to_regs();
Expand Down
35 changes: 0 additions & 35 deletions exec-all.h
Expand Up @@ -348,41 +348,6 @@ static inline int can_do_io(CPUState *env)
}
#endif

#ifdef CONFIG_KQEMU
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))

#define MSR_QPI_COMMBASE 0xfabe0010

int kqemu_init(CPUState *env);
int kqemu_cpu_exec(CPUState *env);
void kqemu_flush_page(CPUState *env, target_ulong addr);
void kqemu_flush(CPUState *env, int global);
void kqemu_set_notdirty(CPUState *env, ram_addr_t ram_addr);
void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr);
void kqemu_set_phys_mem(uint64_t start_addr, ram_addr_t size,
ram_addr_t phys_offset);
void kqemu_cpu_interrupt(CPUState *env);
void kqemu_record_dump(void);

extern uint32_t kqemu_comm_base;

extern ram_addr_t kqemu_phys_ram_size;
extern uint8_t *kqemu_phys_ram_base;

static inline int kqemu_is_ok(CPUState *env)
{
return(env->kqemu_enabled &&
(env->cr[0] & CR0_PE_MASK) &&
!(env->hflags & HF_INHIBIT_IRQ_MASK) &&
(env->eflags & IF_MASK) &&
!(env->eflags & VM_MASK) &&
(env->kqemu_enabled == 2 ||
((env->hflags & HF_CPL_MASK) == 3 &&
(env->eflags & IOPL_MASK) != IOPL_MASK)));
}

#endif

typedef void (CPUDebugExcpHandler)(CPUState *env);

CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
Expand Down

0 comments on commit 4a1418e

Please sign in to comment.