From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPJPq-0004Wc-72 for qemu-devel@nongnu.org; Fri, 19 Oct 2012 16:43:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPJPn-0006Qu-1Q for qemu-devel@nongnu.org; Fri, 19 Oct 2012 16:43:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPJPm-0006QT-QM for qemu-devel@nongnu.org; Fri, 19 Oct 2012 16:43:30 -0400 Date: Fri, 19 Oct 2012 16:43:28 -0400 From: Jason Baron Message-Id: <403b897354aed55caff4704662baacec5cd0b802.1350677361.git.jbaron@redhat.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH v3 03/26] pci: pci capability must be in PCI space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, juzhang@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, armbru@redhat.com, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, kevin@koconnor.net, avi@redhat.com, mkletzan@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de, kraxel@redhat.com From: Isaku Yamahata pci capability must be in PCI space. It can't lay in PCIe extended config space. Reviewed-by: Paolo Bonzini Signed-off-by: Isaku Yamahata Signed-off-by: Jason Baron --- hw/pci.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 2ca6ff6..b1b105d 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1644,16 +1644,16 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) return pci_create_simple_multifunction(bus, devfn, false, name); } -static int pci_find_space(PCIDevice *pdev, uint8_t size) +static uint8_t pci_find_space(PCIDevice *pdev, uint8_t size) { - int config_size = pci_config_size(pdev); int offset = PCI_CONFIG_HEADER_SIZE; int i; - for (i = PCI_CONFIG_HEADER_SIZE; i < config_size; ++i) + for (i = PCI_CONFIG_HEADER_SIZE; i < PCI_CONFIG_SPACE_SIZE; ++i) { if (pdev->used[i]) offset = i + 1; else if (i - offset + 1 == size) return offset; + } return 0; } -- 1.7.1