From patchwork Tue Mar 17 03:50:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 12536 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2H3pZdD014488 for ; Tue, 17 Mar 2009 03:51:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762689AbZCQDua (ORCPT ); Mon, 16 Mar 2009 23:50:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762721AbZCQDu1 (ORCPT ); Mon, 16 Mar 2009 23:50:27 -0400 Received: from mga02.intel.com ([134.134.136.20]:36484 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761406AbZCQDuX (ORCPT ); Mon, 16 Mar 2009 23:50:23 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 16 Mar 2009 20:44:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,375,1233561600"; d="scan'208";a="498332764" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by orsmga001.jf.intel.com with ESMTP; 16 Mar 2009 20:49:56 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LjQJl-0007HP-S1; Tue, 17 Mar 2009 11:50:17 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti , Anthony Liguori Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH 04/16] Make device assignment depend on libpci Date: Tue, 17 Mar 2009 11:50:05 +0800 Message-Id: <1237261817-27955-5-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1237261817-27955-1-git-send-email-sheng@linux.intel.com> References: <1237261817-27955-1-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Which is used later for capability detection. Signed-off-by: Sheng Yang --- qemu/Makefile.target | 1 + qemu/configure | 20 ++++++++++++++++++++ qemu/hw/pci.h | 8 ++++++++ 3 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qemu/Makefile.target b/qemu/Makefile.target index 7a6dc98..df2d4d6 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -643,6 +643,7 @@ OBJS += msmouse.o ifeq ($(USE_KVM_DEVICE_ASSIGNMENT), 1) OBJS+= device-assignment.o +LIBS+=-lpci endif ifeq ($(TARGET_BASE_ARCH), i386) diff --git a/qemu/configure b/qemu/configure index 721c97c..35b7b84 100755 --- a/qemu/configure +++ b/qemu/configure @@ -807,6 +807,26 @@ EOF fi fi +# libpci probe for kvm_cap_device_assignment +if test $kvm_cap_device_assignment = "yes" ; then +cat > $TMPC << EOF +#include +#ifndef PCI_VENDOR_ID +#error NO LIBPCI +#endif +int main(void) { return 0; } +EOF + if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then + : + else + echo + echo "Error: libpci check failed" + echo "Disable KVM Device Assignment capability." + echo + kvm_cap_device_assignment="no" + fi +fi + ########################################## # zlib check diff --git a/qemu/hw/pci.h b/qemu/hw/pci.h index 1a8644c..0558821 100644 --- a/qemu/hw/pci.h +++ b/qemu/hw/pci.h @@ -113,9 +113,17 @@ typedef struct PCIIORegion { #define PCI_STATUS_RESERVED1 0x007 #define PCI_STATUS_INT_STATUS 0x008 #define PCI_STATUS_CAPABILITIES 0x010 + +#ifndef PCI_STATUS_66MHZ #define PCI_STATUS_66MHZ 0x020 +#endif + #define PCI_STATUS_RESERVED2 0x040 + +#ifndef PCI_STATUS_FAST_BACK #define PCI_STATUS_FAST_BACK 0x080 +#endif + #define PCI_STATUS_DEVSEL 0x600 #define PCI_STATUS_RESERVED_MASK_LO (PCI_STATUS_RESERVED1 | \