From patchwork Mon Jun 27 18:19:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 922022 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 p5RILTDb021783 for ; Mon, 27 Jun 2011 18:21:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753348Ab1F0SUu (ORCPT ); Mon, 27 Jun 2011 14:20:50 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:60906 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753315Ab1F0SUn (ORCPT ); Mon, 27 Jun 2011 14:20:43 -0400 Received: from smtp03.web.de ( [172.20.0.65]) by fmmailgate02.web.de (Postfix) with ESMTP id F0DAC1A3A738B; Mon, 27 Jun 2011 20:20:37 +0200 (CEST) Received: from [2.204.233.154] (helo=localhost.localdomain) by smtp03.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1QbGQH-0007wf-00; Mon, 27 Jun 2011 20:20:37 +0200 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Alex Williamson Subject: [PATCH 09/13] pci-assign: Drop libpci header dependency Date: Mon, 27 Jun 2011 20:19:52 +0200 Message-Id: <024201273ad645b45f3b4fd5eb8a2cb7361ecf79.1309198794.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX1/jDiPeWy0UD7AJtYLhCcdMEDS0+dz5jWrpjUJR WJhBzuQnUMPaY+1ZWJ/DZqOhRqhx7CRIHpOu0Oe+JOnuwaM876 4Q5u/OXEo= 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]); Mon, 27 Jun 2011 18:21:56 +0000 (UTC) From: Jan Kiszka 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 15db2a3..3b4b894 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