From patchwork Thu Sep 13 20:12:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 183720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5610B2C0089 for ; Fri, 14 Sep 2012 06:54:47 +1000 (EST) Received: from localhost ([::1]:57274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCGQv-0000Of-Gb for incoming@patchwork.ozlabs.org; Thu, 13 Sep 2012 16:54:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCGQk-0000O8-ND for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:54:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCGQj-00036o-Bh for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:54:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCGQj-00036X-3H for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:54:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8DKsVp9016684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Sep 2012 16:54:31 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8DKCZHQ026809; Thu, 13 Sep 2012 16:12:35 -0400 Date: Thu, 13 Sep 2012 16:12:35 -0400 From: Jason Baron To: qemu-devel@nongnu.org Message-Id: <3fb71c250e0567e01d63c6c1965ebbeef54e9e7f.1347561356.git.jbaron@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, alex.williamson@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, agraf@suse.de, armbru@redhat.com, yamahata@valinux.co.jp, juzhang@redhat.com, kevin@koconnor.net, avi@redhat.com, mkletzan@redhat.com, lcapitulino@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 01/25] pci: pci capability must be in PCI space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Isaku Yamahata pci capability must be in PCI space. It can't lay in PCIe extended config space. Signed-off-by: Isaku Yamahata Signed-off-by: Jason Baron --- hw/pci.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 4d95984..b348596 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1626,12 +1626,11 @@ 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)