From patchwork Tue Oct 9 03:30:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 190179 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 BC5F32C0341 for ; Tue, 9 Oct 2012 14:30:46 +1100 (EST) Received: from localhost ([::1]:47740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLQWq-0000fU-IN for incoming@patchwork.ozlabs.org; Mon, 08 Oct 2012 23:30:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLQWd-0000f2-8g for qemu-devel@nongnu.org; Mon, 08 Oct 2012 23:30:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLQWb-0001nK-KJ for qemu-devel@nongnu.org; Mon, 08 Oct 2012 23:30:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLQWb-0001lo-Bm for qemu-devel@nongnu.org; Mon, 08 Oct 2012 23:30:29 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q993UQ2R010691 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Oct 2012 23:30:26 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q993UPJn006895; Mon, 8 Oct 2012 23:30:26 -0400 Date: Mon, 8 Oct 2012 23:30:25 -0400 From: Jason Baron To: qemu-devel@nongnu.org Message-Id: <267c819bbf776d4938d67545c9bdef6b4f03bcb0.1349749915.git.jbaron@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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, 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 Subject: [Qemu-devel] [PATCH v2 03/21] 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 Reviewed-by: Paolo Bonzini --- hw/pci.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index f855cf3..85ebef6 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)