From patchwork Wed Mar 4 22:24:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 5941011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8334FBF440 for ; Wed, 4 Mar 2015 22:28:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDD7320353 for ; Wed, 4 Mar 2015 22:28:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDA68201BC for ; Wed, 4 Mar 2015 22:28:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTHjx-00007S-2Y; Wed, 04 Mar 2015 22:26:05 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YTHiq-0006fO-AA for linux-arm-kernel@lists.infradead.org; Wed, 04 Mar 2015 22:24:57 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t24MOTJS028052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 4 Mar 2015 17:24:29 -0500 Received: from deneb.redhat.com (ovpn-113-181.phx2.redhat.com [10.3.113.181]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t24MOSVG011767; Wed, 4 Mar 2015 17:24:28 -0500 From: Mark Salter To: Tanmay Inamdar Subject: [PATCH] PCI: xgene: fix breakage from generic config usage Date: Wed, 4 Mar 2015 17:24:24 -0500 Message-Id: <1425507864-22055-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150304_142456_434183_F48F5A8D X-CRM114-Status: GOOD ( 11.72 ) X-Spam-Score: -5.0 (-----) Cc: Rob Herring , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Salter , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 350f8be5bb402 ("PCI: xgene: Convert to use generic config accessors") breaks PCI on the X-Gene platform. It creates two problems with the xgene_pcie_map_bus() function. First, it returns an int but should return a void __iomem *, but that's just a compile-time warning. The breakage is caused by the offset not being added to the base of the config map. So all config reads and writes operate on the first four bytes of config space. This patch fixes both issues. Signed-off-by: Mark Salter Acked-by: Feng Kan --- drivers/pci/host/pci-xgene.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 52bb25c..b87f80b 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c @@ -129,17 +129,21 @@ static bool xgene_pcie_hide_rc_bars(struct pci_bus *bus, int offset) return false; } -static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, - int offset) +static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, + int offset) { struct xgene_pcie_port *port = bus->sysdata; + void __iomem *base; if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up || xgene_pcie_hide_rc_bars(bus, offset)) return NULL; xgene_pcie_set_rtdid_reg(bus, devfn); - return xgene_pcie_get_cfg_base(bus); + base = xgene_pcie_get_cfg_base(bus); + if (base) + base += offset; + return base; } static struct pci_ops xgene_pcie_ops = {