From patchwork Thu Mar 12 13:36:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 11376 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 n2CDc9BB026123 for ; Thu, 12 Mar 2009 13:38:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756798AbZCLNhk (ORCPT ); Thu, 12 Mar 2009 09:37:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756062AbZCLNhj (ORCPT ); Thu, 12 Mar 2009 09:37:39 -0400 Received: from mga14.intel.com ([143.182.124.37]:46505 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755872AbZCLNhF (ORCPT ); Thu, 12 Mar 2009 09:37:05 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 12 Mar 2009 06:37:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,350,1233561600"; d="scan'208";a="119545706" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.189]) by azsmga001.ch.intel.com with ESMTP; 12 Mar 2009 06:37:01 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1Lhl5o-0007ta-6B; Thu, 12 Mar 2009 21:37:00 +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: Thu, 12 Mar 2009 21:36:47 +0800 Message-Id: <1236865019-30321-5-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1236865019-30321-1-git-send-email-sheng@linux.intel.com> References: <1236865019-30321-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 460a3a8..21432e1 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 88d3988..c0d61fc 100755 --- a/qemu/configure +++ b/qemu/configure @@ -806,6 +806,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 543c87a..2327215 100644 --- a/qemu/hw/pci.h +++ b/qemu/hw/pci.h @@ -173,9 +173,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 | \