From patchwork Wed Sep 8 00:25:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wright X-Patchwork-Id: 64083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 27B40B6F01 for ; Wed, 8 Sep 2010 10:27:23 +1000 (EST) Received: from localhost ([127.0.0.1]:42752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot8VU-00011u-9c for incoming@patchwork.ozlabs.org; Tue, 07 Sep 2010 20:27:20 -0400 Received: from [140.186.70.92] (port=54232 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot8UC-0000bI-SO for qemu-devel@nongnu.org; Tue, 07 Sep 2010 20:26:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ot8U9-0002Kg-7L for qemu-devel@nongnu.org; Tue, 07 Sep 2010 20:26:00 -0400 Received: from sous-sol.org ([216.99.217.87]:36315 helo=sequoia.sous-sol.org) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ot8U8-0002I2-SF for qemu-devel@nongnu.org; Tue, 07 Sep 2010 20:25:57 -0400 Received: from sequoia.sous-sol.org (sequoia.sous-sol.org [127.0.0.1]) by sequoia.sous-sol.org (8.14.3/8.14.3) with ESMTP id o880PL3P021594; Tue, 7 Sep 2010 17:25:21 -0700 Received: (from chrisw@localhost) by sequoia.sous-sol.org (8.14.3/8.14.3/Submit) id o880PKEG021593; Tue, 7 Sep 2010 17:25:20 -0700 Date: Tue, 7 Sep 2010 17:25:20 -0700 From: Chris Wright To: Cam Macdonell Message-ID: <20100908002520.GM30129@sequoia.sous-sol.org> References: <4C83CA5A.7030404@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-08-17) X-Virus-Scanned: clamav-milter 0.95.3 at sequoia.sous-sol.org X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Chris Wright , linux-pci@vger.kernel.org, linux-kernel , Jesse Barnes , "qemu-devel@nongnu.org Developers" , Avi Kivity Subject: [Qemu-devel] [PATCH] pci: fix pci_resource_alignment prototype X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Cam Macdonell * Cam Macdonell (cam@cs.ualberta.ca) wrote: > It seems it was the alignment value being passed back from > pci_resource_alignment(). The return type is an int, which was > causing value of 2GB to be sign extended to to 0xffffffff80000000. > Changing the return type to resource_size_t allows BAR values >= 2GB > to be successfully assigned. > -static inline int pci_resource_alignment(struct pci_dev *dev, > +static inline resource_size_t pci_resource_alignment(struct pci_dev *dev, > struct resource *res) Yes, that's my mistake. Thanks for debugging the issue Cam. This fixes the prototype for both pci_resource_alignment() and pci_sriov_resource_alignment(). Patch started as debugging effort from Cam Macdonell. Cc: Cam Macdonell Cc: Avi Kivity Cc: Jesse Barnes [chrisw: add iov bits] Signed-off-by: Chris Wright --- drivers/pci/iov.c | 2 +- drivers/pci/pci.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index ce6a366..553d8ee 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -608,7 +608,7 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno, * the VF BAR size multiplied by the number of VFs. The alignment * is just the VF BAR size. */ -int pci_sriov_resource_alignment(struct pci_dev *dev, int resno) +resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) { struct resource tmp; enum pci_bar_type type; diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 679c39d..5d0aeb1 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -262,7 +262,8 @@ extern int pci_iov_init(struct pci_dev *dev); extern void pci_iov_release(struct pci_dev *dev); extern int pci_iov_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type); -extern int pci_sriov_resource_alignment(struct pci_dev *dev, int resno); +extern resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, + int resno); extern void pci_restore_iov_state(struct pci_dev *dev); extern int pci_iov_bus_range(struct pci_bus *bus); @@ -318,7 +319,7 @@ static inline int pci_ats_enabled(struct pci_dev *dev) } #endif /* CONFIG_PCI_IOV */ -static inline int pci_resource_alignment(struct pci_dev *dev, +static inline resource_size_t pci_resource_alignment(struct pci_dev *dev, struct resource *res) { #ifdef CONFIG_PCI_IOV