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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 4A75AC432C2 for ; Thu, 26 Sep 2019 08:43:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1857F222BF for ; Thu, 26 Sep 2019 08:43:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ox3rXAFL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1857F222BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vL0v6tvNMx6ODziXU31ssFIwIs+DHKEVCLAqqnHWEN4=; b=Ox3rXAFLzHxqc1 XWVpuub675sSURKxzvuNYsDne/ChP9Meu8qxU+k1HH6De7ykig9SJG5JYHQ0Vc/xM3C1+lppeitvV 4zD9jeniGcivEWVqDwoUjduxez17/Km550Jjo6g5vVjMi9daeibr0fTA79QK+yPT9W/Oyyczv3Fuf OkKG6V0o4OaI2x/0WmTVO+qbeRe/I7stg+ETDWd8E/RtO1HLu50bkSy8bLw5CPE1YHFGRh93kNlj7 afYHuRsVgoaVbIMFNddOH6x9bb9kxO9BhMQ1MCDSOCdWBBwUpdsF6HZby7ZC1g8KeuTptle1hGrVI Kj3iNkjBqqeY3UZ3fVeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDPN7-0007kx-Eg; Thu, 26 Sep 2019 08:43:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDPJV-0005eS-RP for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2019 08:39:52 +0000 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 42ECF1000; Thu, 26 Sep 2019 01:39:49 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B583B3F836; Thu, 26 Sep 2019 01:39:48 -0700 (PDT) Date: Thu, 26 Sep 2019 09:39:47 +0100 From: Andrew Murray To: Rob Herring Subject: Re: [PATCH 10/11] PCI: iproc: Use inbound resources for setup Message-ID: <20190926083946.GZ9720@e119886-lin.cambridge.arm.com> References: <20190924214630.12817-1-robh@kernel.org> <20190924214630.12817-11-robh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190924214630.12817-11-robh@kernel.org> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190926_013950_213931_305E84A7 X-CRM114-Status: GOOD ( 18.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Scott Branden , linux-pci@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Ray Jui , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 24, 2019 at 04:46:29PM -0500, Rob Herring wrote: > Now that the helpers provide the inbound resources in the host bridge > 'dma_ranges' resource list, convert Broadcom iProc host bridge to use > the resource list to setup the inbound addresses. > > Cc: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: Ray Jui > Cc: Scott Branden > Cc: bcm-kernel-feedback-list@broadcom.com > Signed-off-by: Rob Herring Reviewed-by: Andrew Murray > --- > drivers/pci/controller/pcie-iproc.c | 63 ++++------------------------- > 1 file changed, 8 insertions(+), 55 deletions(-) > > diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c > index 2d457bfdaf66..9ed181050308 100644 > --- a/drivers/pci/controller/pcie-iproc.c > +++ b/drivers/pci/controller/pcie-iproc.c > @@ -1122,15 +1122,15 @@ static int iproc_pcie_ib_write(struct iproc_pcie *pcie, int region_idx, > } > > static int iproc_pcie_setup_ib(struct iproc_pcie *pcie, > - struct of_pci_range *range, > + struct resource_entry *entry, > enum iproc_pcie_ib_map_type type) > { > struct device *dev = pcie->dev; > struct iproc_pcie_ib *ib = &pcie->ib; > int ret; > unsigned int region_idx, size_idx; > - u64 axi_addr = range->cpu_addr, pci_addr = range->pci_addr; > - resource_size_t size = range->size; > + u64 axi_addr = entry->res->start, pci_addr = entry->res->start - entry->offset; > + resource_size_t size = resource_size(entry->res); > > /* iterate through all IARR mapping regions */ > for (region_idx = 0; region_idx < ib->nr_regions; region_idx++) { > @@ -1182,66 +1182,19 @@ static int iproc_pcie_setup_ib(struct iproc_pcie *pcie, > return ret; > } > > -static int iproc_pcie_add_dma_range(struct device *dev, > - struct list_head *resources, > - struct of_pci_range *range) > -{ > - struct resource *res; > - struct resource_entry *entry, *tmp; > - struct list_head *head = resources; > - > - res = devm_kzalloc(dev, sizeof(struct resource), GFP_KERNEL); > - if (!res) > - return -ENOMEM; > - > - resource_list_for_each_entry(tmp, resources) { > - if (tmp->res->start < range->cpu_addr) > - head = &tmp->node; > - } > - > - res->start = range->cpu_addr; > - res->end = res->start + range->size - 1; > - > - entry = resource_list_create_entry(res, 0); > - if (!entry) > - return -ENOMEM; > - > - entry->offset = res->start - range->cpu_addr; > - resource_list_add(entry, head); > - > - return 0; > -} > - > static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie) > { > struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); > - struct of_pci_range range; > - struct of_pci_range_parser parser; > - int ret; > - LIST_HEAD(resources); > + struct resource_entry *entry; > + int ret = 0; > > - /* Get the dma-ranges from DT */ > - ret = of_pci_dma_range_parser_init(&parser, pcie->dev->of_node); > - if (ret) > - return ret; > - > - for_each_of_pci_range(&parser, &range) { > - ret = iproc_pcie_add_dma_range(pcie->dev, > - &resources, > - &range); > - if (ret) > - goto out; > + resource_list_for_each_entry(entry, &host->dma_ranges) { > /* Each range entry corresponds to an inbound mapping region */ > - ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_MEM); > + ret = iproc_pcie_setup_ib(pcie, entry, IPROC_PCIE_IB_MAP_MEM); > if (ret) > - goto out; > + break; > } > > - list_splice_init(&resources, &host->dma_ranges); > - > - return 0; > -out: > - pci_free_resource_list(&resources); > 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