From 29bde902c893fef936dc61a5d6fe7062e6776570 Mon Sep 17 00:00:00 2001 From: Sheng Yang <sheng@linux.intel.com> Date: Thu, 21 May 2009 17:08:41 -0700 Subject: [PATCH 03/25] kvm: qemu: Make device assignment depend on libpci Which is used later for capability detection. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com> (cherry picked from commit 9d6541529a99c2cf0d474df2524b41f2b1e92c99) Signed-off-by: Chris Wright <chrisw@redhat.com> Bugzilla: 498085 Message-Id: <1242950943-30180-4-git-send-email-chrisw@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: applied Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Don Dutile <ddutile@redhat.com> --- 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 984c8b8..de7ecac 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -707,6 +707,7 @@ OBJS += pci-hotplug.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 a9fba9b..83a9ebb 100755 --- a/qemu/configure +++ b/qemu/configure @@ -793,6 +793,26 @@ EOF fi fi +# libpci probe for kvm_cap_device_assignment +if test $kvm_cap_device_assignment = "yes" ; then +cat > $TMPC << EOF +#include <pci/pci.h> +#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 c28f4aa..73ee1dc 100644 --- a/qemu/hw/pci.h +++ b/qemu/hw/pci.h @@ -65,9 +65,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 | \ -- 1.6.3.rc4.29.g8146