From patchwork Tue Jun 21 17:07:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 101324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2E5BEB6F7B for ; Wed, 22 Jun 2011 03:34:44 +1000 (EST) Received: from localhost ([::1]:57552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4qX-0005cK-7C for incoming@patchwork.ozlabs.org; Tue, 21 Jun 2011 13:34:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4Rp-00071p-HT for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ4Ri-0000yj-Ov for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ4Rh-0000xY-8i for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:09:01 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5LH90q0019095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jun 2011 13:09:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5LH90FW015995; Tue, 21 Jun 2011 13:09:00 -0400 Received: from amt.cnet (vpn-9-196.rdu.redhat.com [10.11.9.196]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p5LH8wwu020388; Tue, 21 Jun 2011 13:08:59 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 9207666E06C; Tue, 21 Jun 2011 14:08:23 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id p5LH8LXj006979; Tue, 21 Jun 2011 14:08:21 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Tue, 21 Jun 2011 14:07:53 -0300 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Alexander Graf Subject: [Qemu-devel] [PATCH 04/15] Switch build system to accompanied kernel headers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka This helps reducing our build-time checks for feature support in the available Linux kernel headers. And it helps users that do not have sufficiently recent headers installed on their build machine. Consequently, the patch removes and build-time checks for kvm and vhost in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are supposed to be provided by QEMU only. s390 needs some extra love as it carries redefinitions from kernel headers. CC: Alexander Graf Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- Makefile.target | 4 +- configure | 151 ++++++---------------------------------------- target-s390x/cpu.h | 10 --- target-s390x/op_helper.c | 1 + 4 files changed, 21 insertions(+), 145 deletions(-) diff --git a/Makefile.target b/Makefile.target index b1a0f6d..db2fa6e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -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 @@ -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 diff --git a/configure b/configure index 44c092a..8df6485 100755 --- a/configure +++ b/configure @@ -113,8 +113,7 @@ curl="" curses="" docs="" fdt="" -kvm="" -kvm_para="" +kvm="yes" nptl="" sdl="" vnc="yes" @@ -130,7 +129,7 @@ xen="" xen_ctrl_version="" linux_aio="" attr="" -vhost_net="" +vhost_net="yes" xfs="" gprof="no" @@ -166,7 +165,6 @@ guest_base="" uname_release="" io_thread="no" mixemu="no" -kerneldir="" aix="no" blobs="yes" pkgversion="" @@ -715,8 +713,6 @@ for opt do ;; --disable-blobs) blobs="no" ;; - --kerneldir=*) kerneldir="$optarg" - ;; --with-pkgversion=*) pkgversion=" ($optarg)" ;; --disable-docs) docs="no" @@ -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" @@ -1779,124 +1774,6 @@ EOF fi ########################################## -# kvm probe -if test "$kvm" != "no" ; then - cat > $TMPC < -#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 <> $TMPC </dev/null` - fi - if compile_prog "$kvm_cflags" "" ; then - kvm=yes - cat > $TMPC < -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 < - 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 < - 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" @@ -3346,16 +3223,11 @@ 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 + echo "CONFIG_KVM_PARA=y" >> $config_target_mak 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 + echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak fi esac if test "$target_bigendian" = "yes" ; then @@ -3546,6 +3418,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 diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 4e5c391..b5e587f 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -313,16 +313,6 @@ CPUState *s390_cpu_addr2state(uint16_t cpu_addr); /* from s390-virtio-bus */ extern const target_phys_addr_t virtio_size; -#ifndef KVM_S390_SIGP_STOP -#define KVM_S390_SIGP_STOP 0 -#define KVM_S390_PROGRAM_INT 0 -#define KVM_S390_SIGP_SET_PREFIX 0 -#define KVM_S390_RESTART 0 -#define KVM_S390_INT_VIRTIO 0 -#define KVM_S390_INT_SERVICE 0 -#define KVM_S390_INT_EMERGENCY 0 -#endif - #endif void cpu_lock(void); void cpu_unlock(void); diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c index db03a79..9429698 100644 --- a/target-s390x/op_helper.c +++ b/target-s390x/op_helper.c @@ -23,6 +23,7 @@ #include "helpers.h" #include #include "kvm.h" +#include #include "qemu-timer.h" /*****************************************************************************/