From patchwork Tue Jun 21 14:26:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 9190719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C4AC601C0 for ; Tue, 21 Jun 2016 14:28:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B91328173 for ; Tue, 21 Jun 2016 14:28:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FE092818B; Tue, 21 Jun 2016 14:28:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2197728173 for ; Tue, 21 Jun 2016 14:28:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFMdw-0002r4-1c; Tue, 21 Jun 2016 14:27:08 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFMdb-0002kh-Sr for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2016 14:26:48 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 949E720138; Tue, 21 Jun 2016 14:26:26 +0000 (UTC) Received: from localhost (unknown [69.71.1.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F2E920114; Tue, 21 Jun 2016 14:26:25 +0000 (UTC) Date: Tue, 21 Jun 2016 09:26:23 -0500 From: Bjorn Helgaas To: Geert Uytterhoeven Subject: Re: [PATCH v1 19/25] PCI: rcar Gen2: Request host bridge window resources Message-ID: <20160621142623.GA29966@localhost> References: <20160606225630.20936.77349.stgit@bhelgaas-glaptop2.roam.corp.google.com> <20160606230706.20936.13086.stgit@bhelgaas-glaptop2.roam.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160621_072647_970980_F07FC1C4 X-CRM114-Status: GOOD ( 23.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, rfi@lists.rocketboards.org, Bjorn Helgaas , Thierry Reding , Tanmay Inamdar , Pratyush Anand , Michal Simek , Valentine Barshak , linux-arm-kernel@lists.infradead.org, Jason Cooper , Jon Mason , Ray Jui , Simon Horman , linux-tegra@vger.kernel.org, =?iso-8859-1?Q?S=F6ren?= Brinkmann , Thomas Petazzoni , Scott Branden , Jingoo Han , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Ley Foon Tan Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP [+cc Valentine] Hi Geert, Thanks a lot for testing this, and sorry for the breakage. On Tue, Jun 21, 2016 at 12:41:31PM +0200, Geert Uytterhoeven wrote: > On Tue, Jun 7, 2016 at 1:07 AM, Bjorn Helgaas wrote: > > Request host bridge window resources so they appear in ioport_resource and > > iomem_resource and are reflected in /proc/ioports and /proc/iomem. > > > > Signed-off-by: Bjorn Helgaas > > --- > > drivers/pci/host/pci-rcar-gen2.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c > > index 9980a4b..617a6b2 100644 > > --- a/drivers/pci/host/pci-rcar-gen2.c > > +++ b/drivers/pci/host/pci-rcar-gen2.c > > @@ -194,6 +194,7 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys) > > struct rcar_pci_priv *priv = sys->private_data; > > void __iomem *reg = priv->reg; > > u32 val; > > + int ret; > > > > pm_runtime_enable(priv->dev); > > pm_runtime_get_sync(priv->dev); > > @@ -275,6 +276,9 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys) > > /* Add PCI resources */ > > pci_add_resource(&sys->resources, &priv->io_res); > > pci_add_resource(&sys->resources, &priv->mem_res); > > + ret = devm_request_pci_bus_resources(priv->dev, &sys->resources); > > + if (ret < 0) > > + return ret; > > > > /* Setup bus number based on platform device id / of bus-range */ > > sys->busnr = priv->busnr; > > This patch (commit 1bd019707b7c9249d34c5d348f1ef75eb4d83e89 in pci/next) > broke PCI on r8a7791/koelsch. Dmesg differences are: > > pci-rcar-gen2 ee090000.pci: PCI: bus0 revision 11 > -pci-rcar-gen2 ee090000.pci: PCI host bridge to bus 0000:00 > -pci_bus 0000:00: root bus resource [io 0xee080000-0xee0810ff] > -pci_bus 0000:00: root bus resource [mem 0xee080000-0xee0810ff] This is probably a result of this code in drivers/pci/host/pci-rcar-gen2.c: /* * The controller does not support/use port I/O, * so setup a dummy port I/O region here. */ priv->io_res.start = priv->mem_res.start; priv->io_res.end = priv->mem_res.end; priv->io_res.flags = IORESOURCE_IO; We try to avoid adding dummy regions like this, but maybe we missed this one. I haven't found any email discussion about it yet, so I don't know what the reason for this one is. Valentine, do you remember? Can you try the patch below (apply it before the 1bd019707b7c patch that broke things)? commit b64dc28f5f2b3afe47ee4a42fb79db84ec4227f8 Author: Bjorn Helgaas Date: Tue Jun 21 09:19:34 2016 -0500 PCI: rcar: Drop gen2 dummy I/O port region Previously we added a dummy I/O port region even though the R-Car controller doesn't support PCI port I/O. This resulted in bogus root bus resources like this: pci_bus 0000:00: root bus resource [io 0xee080000-0xee0810ff] pci_bus 0000:00: root bus resource [mem 0xee080000-0xee0810ff] Drop the unused dummy I/O port region. Signed-off-by: Bjorn Helgaas diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index 9980a4b..53ae619 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -97,7 +97,6 @@ struct rcar_pci_priv { struct device *dev; void __iomem *reg; - struct resource io_res; struct resource mem_res; struct resource *cfg_res; unsigned busnr; @@ -273,7 +272,6 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys) rcar_pci_setup_errirq(priv); /* Add PCI resources */ - pci_add_resource(&sys->resources, &priv->io_res); pci_add_resource(&sys->resources, &priv->mem_res); /* Setup bus number based on platform device id / of bus-range */ @@ -371,14 +369,6 @@ static int rcar_pci_probe(struct platform_device *pdev) return -ENOMEM; priv->mem_res = *mem_res; - /* - * The controller does not support/use port I/O, - * so setup a dummy port I/O region here. - */ - priv->io_res.start = priv->mem_res.start; - priv->io_res.end = priv->mem_res.end; - priv->io_res.flags = IORESOURCE_IO; - priv->cfg_res = cfg_res; priv->irq = platform_get_irq(pdev, 0);