From patchwork Tue Aug 23 17:32:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 1089192 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7NHXMAS001902 for ; Tue, 23 Aug 2011 17:33:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755754Ab1HWRdT (ORCPT ); Tue, 23 Aug 2011 13:33:19 -0400 Received: from david.siemens.de ([192.35.17.14]:31131 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755651Ab1HWRdJ (ORCPT ); Tue, 23 Aug 2011 13:33:09 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id p7NHX5eI015204; Tue, 23 Aug 2011 19:33:05 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p7NHX4tN016941; Tue, 23 Aug 2011 19:33:04 +0200 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Alex Williamson Subject: [PATCH v3 3/7] pci-assign: Drop libpci header dependency Date: Tue, 23 Aug 2011 19:32:59 +0200 Message-Id: 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 (demeter2.kernel.org [140.211.167.43]); Tue, 23 Aug 2011 17:33:22 +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 f5bb5a4..ee215a8 100755 --- a/configure +++ b/configure @@ -1891,27 +1891,6 @@ else 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="-pthread -lpthread -lpthreadGC2" diff --git a/hw/device-assignment.c b/hw/device-assignment.c index de0048d..ca13e76 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" #define MSIX_PAGE_SIZE 0x1000 @@ -1140,7 +1139,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 */ @@ -1233,7 +1232,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); @@ -1245,7 +1244,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; @@ -1381,15 +1380,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