Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp862777ybh; Wed, 22 Jul 2020 15:32:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE5flgPbJaogxHsgV3LSaqkWh/sMWwfaVXy45ZErIgJ8HVLnx4Ue2qH0hvgH5JAPAu+QdT X-Received: by 2002:a17:906:8417:: with SMTP id n23mr1655693ejx.192.1595457171200; Wed, 22 Jul 2020 15:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595457171; cv=none; d=google.com; s=arc-20160816; b=btQwKxGuV32wPJjQXSIdWdswhVRU5dm57ODAV4sffZqUchdnyCLSYIPcxNYhBiEGQ6 dhooiip/dKlnSrJolg0ZbZvwCu08Ru+FkW4nTWpZfWr8nANMeib/bqDDHfSDTuqRheRe n69zOeEIFPcnQjd7GJBBzkdBquWbwjPqd/FI3RD6BckjYQdGJF+N5iWMJSqW1iO2fkXh 3po3G02y6TiYKsbwyhpMdVM0vpD0IeIMGiAiQa812iWAAvP3XQCCVuALBtsnZziXno+I 8i6K0etYnEmmaRRd8AoQY69oaWNANoZUmQYu2NaurcPFtiMcmjBJc+DWiU3Dx/Y/lZWO /yXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=63AvJsb+9RuZr4Oec7m64sfHxj8R+XnFS1WcPj0/7Lg=; b=inZ+fEbPkTtS6LOOMedwzH674mCO7lAFfnq57dpvXOmSUL/BAFpjf8X79VacxEZ/mn ReVJgHGy3R3qVOS4nw6/p1vWwmU/iRkqtCttchk8e33cllwyYRQaOWVHsFumVO6TShTj Iq98NrWYGNm0viQ90qNXePugHsOLhXoVblXqcMMe3jATdA6PFtQHLofuBjgMC3mxHOqS n993phG/6gjF/cS7KGj+Y27M2VJ00sqhejQdYulE1DARqdXIBmqMxxQsH1njaGb8rHS5 bjdl7ZSv8mkO9Cmti2a1OQb+TVqNzeCZeEGKpepKJWYvI73V5U/f2c/k8BkwthuzLpmE AuOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FAbkgy6s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si781871edm.294.2020.07.22.15.32.29; Wed, 22 Jul 2020 15:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FAbkgy6s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732919AbgGVWaV (ORCPT + 99 others); Wed, 22 Jul 2020 18:30:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:45176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728607AbgGVWaU (ORCPT ); Wed, 22 Jul 2020 18:30:20 -0400 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB74622B47; Wed, 22 Jul 2020 22:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595457020; bh=I7/YIfdAMV3E37NnGmsLOOWx8Y9KsMdASXp+fIuCB6Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FAbkgy6sdytJTU9IpGYQFy7pAkblb4fmUS8GeRdQobkppbe5HQIrBbeJzJayZak5C d7sO+DFy+vfJNPDZJhdWaE1DKWIxJqRg1CQ/PT5Baxx5rBP3ke+h7YVK9UPNCBXc1Z 1sEZPtWHIJ9knZnQWkIXTh2Zerhysm6OmYirf0Wk= Received: by mail-oi1-f171.google.com with SMTP id k22so3324389oib.0; Wed, 22 Jul 2020 15:30:19 -0700 (PDT) X-Gm-Message-State: AOAM532NU+ZpvnrhEuQQ/3xJmGCYq7s7PicredcoK5cIHNqmLZzNUfM1 DrZ9OrfvhLI6f20KIZDoFDGGcsofydUy/rGK5w== X-Received: by 2002:aca:4844:: with SMTP id v65mr1605683oia.152.1595457019133; Wed, 22 Jul 2020 15:30:19 -0700 (PDT) MIME-Version: 1.0 References: <20200722110317.4744-1-kishon@ti.com> <20200722110317.4744-2-kishon@ti.com> In-Reply-To: <20200722110317.4744-2-kishon@ti.com> From: Rob Herring Date: Wed, 22 Jul 2020 16:30:07 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 01/15] PCI: cadence: Use "dma-ranges" instead of "cdns,no-bar-match-nbits" property To: Kishon Vijay Abraham I Cc: Tom Joseph , Bjorn Helgaas , Lorenzo Pieralisi , Arnd Bergmann , Greg Kroah-Hartman , PCI , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , linux-omap , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 22, 2020 at 5:03 AM Kishon Vijay Abraham I wrote: > > Cadence PCIe core driver (host mode) uses "cdns,no-bar-match-nbits" > property to configure the number of bits passed through from PCIe > address to internal address in Inbound Address Translation register. > This only used the NO MATCH BAR. > > However standard PCI dt-binding already defines "dma-ranges" to > describe the address ranges accessible by PCIe controller. Add support > in Cadence PCIe host driver to parse dma-ranges and configure the > inbound regions for BAR0, BAR1 and NO MATCH BAR. Cadence IP specifies > maximum size for BAR0 as 256GB, maximum size for BAR1 as 2 GB. > > This adds support to take the next biggest region in "dma-ranges" and > find the smallest BAR that each of the regions fit in and if there is > no BAR big enough to hold the region, split the region to see if it can > be fitted using multiple BARs. > > "dma-ranges" of J721E will be > dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>; > Since there is no BAR which can hold 2^48 size, NO_MATCH_BAR will be > used here. > > Legacy device tree binding compatibility is maintained by retaining > support for "cdns,no-bar-match-nbits". > > Signed-off-by: Kishon Vijay Abraham I > --- > Changes from [1] > 1) Use list_sort() for sorting the address ranges by size > 2) Clear CDNS_PCIE_LM_RC_BAR_CFG register before configuring them > > [1] -> http://lore.kernel.org/r/20200521080153.5902-1-kishon@ti.com > .../controller/cadence/pcie-cadence-host.c | 251 +++++++++++++++++- > drivers/pci/controller/cadence/pcie-cadence.h | 28 +- > 2 files changed, 262 insertions(+), 17 deletions(-) Reviewed-by: Rob Herring