From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A076C4320D for ; Wed, 25 Sep 2019 10:24:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECEBE21D7A for ; Wed, 25 Sep 2019 10:24:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389535AbfIYKY0 (ORCPT ); Wed, 25 Sep 2019 06:24:26 -0400 Received: from foss.arm.com ([217.140.110.172]:46020 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389530AbfIYKY0 (ORCPT ); Wed, 25 Sep 2019 06:24:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA9F31570; Wed, 25 Sep 2019 03:24:25 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 421EE3F694; Wed, 25 Sep 2019 03:24:25 -0700 (PDT) Date: Wed, 25 Sep 2019 11:24:23 +0100 From: Andrew Murray To: Rob Herring Cc: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Ley Foon Tan , rfi@lists.rocketboards.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 02/11] PCI: altera: Use pci_parse_request_of_pci_ranges() Message-ID: <20190925102423.GR9720@e119886-lin.cambridge.arm.com> References: <20190924214630.12817-1-robh@kernel.org> <20190924214630.12817-3-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190924214630.12817-3-robh@kernel.org> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Sep 24, 2019 at 04:46:21PM -0500, Rob Herring wrote: > Convert altera host bridge to use the common > pci_parse_request_of_pci_ranges(). > > Cc: Ley Foon Tan > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: rfi@lists.rocketboards.org > Signed-off-by: Rob Herring > --- > drivers/pci/controller/pcie-altera.c | 38 ++-------------------------- > 1 file changed, 2 insertions(+), 36 deletions(-) > > diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c > index d2497ca43828..2ed00babff5a 100644 > --- a/drivers/pci/controller/pcie-altera.c > +++ b/drivers/pci/controller/pcie-altera.c > @@ -670,39 +670,6 @@ static void altera_pcie_isr(struct irq_desc *desc) > chained_irq_exit(chip, desc); > } > > -static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie) > -{ > - int err, res_valid = 0; > - struct device *dev = &pcie->pdev->dev; > - struct resource_entry *win; > - > - err = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, > - &pcie->resources, NULL); > - if (err) > - return err; > - > - err = devm_request_pci_bus_resources(dev, &pcie->resources); > - if (err) > - goto out_release_res; > - > - resource_list_for_each_entry(win, &pcie->resources) { > - struct resource *res = win->res; > - > - if (resource_type(res) == IORESOURCE_MEM) > - res_valid |= !(res->flags & IORESOURCE_PREFETCH); > - } > - > - if (res_valid) > - return 0; > - > - dev_err(dev, "non-prefetchable memory resource required\n"); > - err = -EINVAL; > - > -out_release_res: > - pci_free_resource_list(&pcie->resources); > - return err; > -} > - > static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) > { > struct device *dev = &pcie->pdev->dev; > @@ -833,9 +800,8 @@ static int altera_pcie_probe(struct platform_device *pdev) > return ret; > } > > - INIT_LIST_HEAD(&pcie->resources); > - > - ret = altera_pcie_parse_request_of_pci_ranges(pcie); > + ret = pci_parse_request_of_pci_ranges(dev, &pcie->resources, Does it matter that we now map any given IO ranges whereas we didn't previously? As far as I can tell there are no users that pass an IO range, if they did then with the existing code the probe would fail and they'd get a "I/O range found for %pOF. Please provide an io_base pointer...". However with the new code if any IO range was given (which would probably represent a misconfiguration), then we'd proceed to map the IO range. When that IO is used, who knows what would happen. I wonder if there is a better way for a host driver to indicate that it doesn't support IO? Thanks, Andrew Murray > + NULL); > if (ret) { > dev_err(dev, "Failed add resources\n"); > return ret; > -- > 2.20.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel