Skip to content

Commit

Permalink
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Liguori committed Jun 22, 2011
2 parents fdba959 + ca98557 commit d6034a3
Show file tree
Hide file tree
Showing 29 changed files with 2,675 additions and 327 deletions.
4 changes: 1 addition & 3 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif

TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
QEMU_CFLAGS+= -I.. -I../linux-headers -I$(TARGET_PATH) -DNEED_CPU_H

include $(SRC_PATH)/Makefile.objs

Expand All @@ -37,8 +37,6 @@ ifndef CONFIG_HAIKU
LIBS+=-lm
endif

kvm.o kvm-all.o vhost.o vhost_net.o kvmclock.o: QEMU_CFLAGS+=$(KVM_CFLAGS)

config-target.h: config-target.h-timestamp
config-target.h-timestamp: config-target.mak

Expand Down
149 changes: 17 additions & 132 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ curl=""
curses=""
docs=""
fdt=""
kvm=""
kvm_para=""
kvm="yes"
nptl=""
sdl=""
vnc="yes"
Expand All @@ -130,7 +129,7 @@ xen=""
xen_ctrl_version=""
linux_aio=""
attr=""
vhost_net=""
vhost_net="yes"
xfs=""

gprof="no"
Expand Down Expand Up @@ -166,7 +165,6 @@ guest_base=""
uname_release=""
io_thread="no"
mixemu="no"
kerneldir=""
aix="no"
blobs="yes"
pkgversion=""
Expand Down Expand Up @@ -715,8 +713,6 @@ for opt do
;;
--disable-blobs) blobs="no"
;;
--kerneldir=*) kerneldir="$optarg"
;;
--with-pkgversion=*) pkgversion=" ($optarg)"
;;
--disable-docs) docs="no"
Expand Down Expand Up @@ -1005,7 +1001,6 @@ echo " --disable-attr disables attr and xattr support"
echo " --enable-attr enable attr and xattr support"
echo " --enable-io-thread enable IO thread"
echo " --disable-blobs disable installing provided firmware blobs"
echo " --kerneldir=PATH look for kernel includes in PATH"
echo " --enable-docs enable documentation build"
echo " --disable-docs disable documentation build"
echo " --disable-vhost-net disable vhost-net acceleration support"
Expand Down Expand Up @@ -1805,124 +1800,6 @@ EOF
fi
fi

##########################################
# kvm probe
if test "$kvm" != "no" ; then
cat > $TMPC <<EOF
#include <linux/kvm.h>
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
#error Invalid KVM version
#endif
EOF
must_have_caps="KVM_CAP_USER_MEMORY \
KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
KVM_CAP_COALESCED_MMIO \
KVM_CAP_SYNC_MMU \
"
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
must_have_caps="$caps \
KVM_CAP_SET_TSS_ADDR \
KVM_CAP_EXT_CPUID \
KVM_CAP_CLOCKSOURCE \
KVM_CAP_NOP_IO_DELAY \
KVM_CAP_PV_MMU \
KVM_CAP_MP_STATE \
KVM_CAP_USER_NMI \
"
fi
for c in $must_have_caps ; do
cat >> $TMPC <<EOF
#if !defined($c)
#error Missing KVM capability $c
#endif
EOF
done
cat >> $TMPC <<EOF
int main(void) { return 0; }
EOF
if test "$kerneldir" != "" ; then
kvm_cflags=-I"$kerneldir"/include
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
-a -d "$kerneldir/arch/x86/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
elif test -d "$kerneldir/arch/$cpu/include" ; then
kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
fi
else
kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
fi
if compile_prog "$kvm_cflags" "" ; then
kvm=yes
cat > $TMPC <<EOF
#include <linux/kvm_para.h>
int main(void) { return 0; }
EOF
if compile_prog "$kvm_cflags" "" ; then
kvm_para=yes
fi
else
if test "$kvm" = "yes" ; then
if has awk && has grep; then
kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
| grep "error: " \
| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
if test "$kvmerr" != "" ; then
echo -e "${kvmerr}\n\
NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
recent kvm-kmod from http://sourceforge.net/projects/kvm."
fi
fi
feature_not_found "kvm"
fi
kvm=no
fi
fi

##########################################
# test for ppc kvm pvr setting

if test "$kvm" = "yes" && test "$cpu" = "ppc" -o "$cpu" = "ppc64"; then
cat > $TMPC <<EOF
#include <asm/kvm.h>
int main(void) { struct kvm_sregs s; s.pvr = 0; return 0; }
EOF
if compile_prog "$kvm_cflags" "" ; then
kvm_ppc_pvr=yes
else
kvm_ppc_pvr=no
fi
fi

##########################################
# test for vhost net

if test "$vhost_net" != "no"; then
if test "$kvm" != "no"; then
cat > $TMPC <<EOF
#include <linux/vhost.h>
int main(void) { return 0; }
EOF
if compile_prog "$kvm_cflags" "" ; then
vhost_net=yes
else
if test "$vhost_net" = "yes" ; then
feature_not_found "vhost-net"
fi
vhost_net=no
fi
else
if test "$vhost_net" = "yes" ; then
echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
feature_not_found "vhost-net"
fi
vhost_net=no
fi
fi

##########################################
# pthread probe
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
Expand Down Expand Up @@ -3373,16 +3250,9 @@ case "$target_arch2" in
\( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
\( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
echo "CONFIG_KVM=y" >> $config_target_mak
echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
if test "$kvm_para" = "yes"; then
echo "CONFIG_KVM_PARA=y" >> $config_target_mak
fi
if test $vhost_net = "yes" ; then
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
fi
if test "$kvm_ppc_pvr" = "yes" ; then
echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
fi
fi
esac
if test "$target_bigendian" = "yes" ; then
Expand Down Expand Up @@ -3573,6 +3443,21 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
esac
fi

# use included Linux headers
includes="-I\$(SRC_PATH)/linux-headers $includes"
mkdir -p linux-headers
case "$cpu" in
i386|x86_64)
symlink $source_path/linux-headers/asm-x86 linux-headers/asm
;;
ppcemb|ppc|ppc64)
symlink $source_path/linux-headers/asm-x86 linux-headers/asm
;;
s390x)
symlink $source_path/linux-headers/asm-s390 linux-headers/asm
;;
esac

echo "LDFLAGS+=$ldflags" >> $config_target_mak
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
Expand Down
1 change: 0 additions & 1 deletion cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "exec.h"
#include "disas.h"
#include "tcg.h"
#include "kvm.h"
#include "qemu-barrier.h"

#if defined(__sparc__) && !defined(CONFIG_SOLARIS)
Expand Down
9 changes: 0 additions & 9 deletions hw/kvmclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "kvm.h"
#include "kvmclock.h"

#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ADJUST_CLOCK)

#include <linux/kvm.h>
#include <linux/kvm_para.h>

Expand Down Expand Up @@ -120,10 +118,3 @@ static void kvmclock_register_device(void)
}

device_init(kvmclock_register_device);

#else /* !(CONFIG_KVM_PARA && KVM_CAP_ADJUST_CLOCK) */

void kvmclock_create(void)
{
}
#endif /* !(CONFIG_KVM_PARA && KVM_CAP_ADJUST_CLOCK) */
13 changes: 0 additions & 13 deletions kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,35 +757,26 @@ int kvm_init(void)
s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);

s->broken_set_mem_region = 1;
#ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS
ret = kvm_check_extension(s, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS);
if (ret > 0) {
s->broken_set_mem_region = 0;
}
#endif

s->vcpu_events = 0;
#ifdef KVM_CAP_VCPU_EVENTS
s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
#endif

s->robust_singlestep = 0;
#ifdef KVM_CAP_X86_ROBUST_SINGLESTEP
s->robust_singlestep =
kvm_check_extension(s, KVM_CAP_X86_ROBUST_SINGLESTEP);
#endif

s->debugregs = 0;
#ifdef KVM_CAP_DEBUGREGS
s->debugregs = kvm_check_extension(s, KVM_CAP_DEBUGREGS);
#endif

s->xsave = 0;
#ifdef KVM_CAP_XSAVE
s->xsave = kvm_check_extension(s, KVM_CAP_XSAVE);
#endif

s->xcrs = 0;
#ifdef KVM_CAP_XCRS
s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
#endif
Expand Down Expand Up @@ -855,7 +846,6 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
}
}

#ifdef KVM_CAP_INTERNAL_ERROR_DATA
static int kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
{
fprintf(stderr, "KVM internal error.");
Expand All @@ -882,7 +872,6 @@ static int kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
*/
return -1;
}
#endif

void kvm_flush_coalesced_mmio_buffer(void)
{
Expand Down Expand Up @@ -1013,11 +1002,9 @@ int kvm_cpu_exec(CPUState *env)
(uint64_t)run->hw.hardware_exit_reason);
ret = -1;
break;
#ifdef KVM_CAP_INTERNAL_ERROR_DATA
case KVM_EXIT_INTERNAL_ERROR:
ret = kvm_handle_internal_error(env, run);
break;
#endif
default:
DPRINTF("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(env, run);
Expand Down
18 changes: 1 addition & 17 deletions kvm-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)
return -ENOSYS;
}

int kvm_check_extension(KVMState *s, unsigned int extension)
{
return 0;
}

int kvm_init(void)
{
return -ENOSYS;
Expand Down Expand Up @@ -78,16 +73,6 @@ int kvm_has_sync_mmu(void)
return 0;
}

int kvm_has_vcpu_events(void)
{
return 0;
}

int kvm_has_robust_singlestep(void)
{
return 0;
}

int kvm_has_many_ioeventfds(void)
{
return 0;
Expand All @@ -99,8 +84,7 @@ void kvm_setup_guest_memory(void *start, size_t size)

int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)
{
tb_flush(env);
return 0;
return -ENOSYS;
}

int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
Expand Down
2 changes: 1 addition & 1 deletion kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool kvm_arch_stop_on_emulation_error(CPUState *env);

int kvm_check_extension(KVMState *s, unsigned int extension);

uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
uint32_t index, int reg);
void kvm_cpu_synchronize_state(CPUState *env);
void kvm_cpu_synchronize_post_reset(CPUState *env);
Expand Down
Loading

0 comments on commit d6034a3

Please sign in to comment.