From patchwork Thu Jul 21 18:14:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 996432 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6LIEseE002893 for ; Thu, 21 Jul 2011 18:15:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753154Ab1GUSOu (ORCPT ); Thu, 21 Jul 2011 14:14:50 -0400 Received: from goliath.siemens.de ([192.35.17.28]:26943 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770Ab1GUSOq (ORCPT ); Thu, 21 Jul 2011 14:14:46 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id p6LIEgqU024561; Thu, 21 Jul 2011 20:14:42 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p6LIEft0006280; Thu, 21 Jul 2011 20:14:42 +0200 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Alex Williamson Subject: [PATCH v2 3/7] pci-assign: Drop libpci header dependency Date: Thu, 21 Jul 2011 20:14:37 +0200 Message-Id: <4d9fba13fb848f8edaed0d2d4842e2415358388a.1311272078.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Jul 2011 18:15:02 +0000 (UTC) All constants are now available through QEMU. Also drop the upstream diff of pci_regs.h, it cannot clash with libpci anymore. Signed-off-by: Jan Kiszka --- configure | 21 --------------------- hw/device-assignment.c | 13 ++++++------- hw/pci_regs.h | 7 ------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/configure b/configure index 0321146..bf41215 100755 --- a/configure +++ b/configure @@ -1838,27 +1838,6 @@ EOF fi ########################################## -########################################## -# libpci header 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 HEADER -#endif -int main(void) { return 0; } -EOF - if compile_prog "" "" ; then - kvm_cap_device_assignment=yes - else - echo - echo "Error: libpci header check failed" - echo "Disable KVM Device Assignment capability." - echo - kvm_cap_device_assignment=no - fi -fi - # pthread probe PTHREADLIBS_LIST="-lpthread -lpthreadGC2" diff --git a/hw/device-assignment.c b/hw/device-assignment.c index a88d4fc..b341fd9 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -39,7 +39,6 @@ #include "loader.h" #include "monitor.h" #include "range.h" -#include #include "sysemu.h" /* From linux/ioport.h */ @@ -1150,7 +1149,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev) pos = pci_find_capability(pci_dev, PCI_CAP_ID_MSIX); entries_max_nr = *(uint16_t *)(pci_dev->config + pos + 2); - entries_max_nr &= PCI_MSIX_TABSIZE; + entries_max_nr &= PCI_MSIX_FLAGS_QSIZE; entries_max_nr += 1; /* Get the usable entry number for allocating */ @@ -1243,7 +1242,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev, unsigned int ctrl_pos) * try to catch this by only deassigning irqs if the guest is using * MSIX or intends to start. */ if ((assigned_dev->irq_requested_type & KVM_DEV_IRQ_GUEST_MSIX) || - (*ctrl_word & PCI_MSIX_ENABLE)) { + (*ctrl_word & PCI_MSIX_FLAGS_ENABLE)) { assigned_irq_data.flags = assigned_dev->irq_requested_type; free_dev_irq_entries(assigned_dev); @@ -1255,7 +1254,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev, unsigned int ctrl_pos) assigned_dev->irq_requested_type = 0; } - if (*ctrl_word & PCI_MSIX_ENABLE) { + if (*ctrl_word & PCI_MSIX_FLAGS_ENABLE) { assigned_irq_data.flags = KVM_DEV_IRQ_HOST_MSIX | KVM_DEV_IRQ_GUEST_MSIX; @@ -1389,15 +1388,15 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) & - PCI_MSIX_TABSIZE); + PCI_MSIX_FLAGS_QSIZE); /* Only enable and function mask bits are writable */ pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS, PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL); msix_table_entry = pci_get_long(pci_dev->config + pos + PCI_MSIX_TABLE); - bar_nr = msix_table_entry & PCI_MSIX_BIR; - msix_table_entry &= ~PCI_MSIX_BIR; + bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK; + msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK; dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry; } diff --git a/hw/pci_regs.h b/hw/pci_regs.h index 9836d35..e884096 100644 --- a/hw/pci_regs.h +++ b/hw/pci_regs.h @@ -44,16 +44,9 @@ #define PCI_STATUS 0x06 /* 16 bits */ #define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */ #define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ - -#ifndef PCI_STATUS_66MHZ #define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ -#endif - #define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ -#ifndef PCI_STATUS_FAST_BACK #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ -#endif - #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ #define PCI_STATUS_DEVSEL_FAST 0x000