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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,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 C9870CA9EBE for ; Mon, 28 Oct 2019 10:20:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7B3B208C0 for ; Mon, 28 Oct 2019 10:20:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728069AbfJ1KU4 (ORCPT ); Mon, 28 Oct 2019 06:20:56 -0400 Received: from foss.arm.com ([217.140.110.172]:38208 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732186AbfJ1KUz (ORCPT ); Mon, 28 Oct 2019 06:20:55 -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 D73621F1; Mon, 28 Oct 2019 03:20:54 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9EE973F71E; Mon, 28 Oct 2019 03:20:53 -0700 (PDT) Date: Mon, 28 Oct 2019 10:20:48 +0000 From: Lorenzo Pieralisi To: Yoshihiro Shimoda Cc: "marek.vasut@gmail.com" , "linux-pci@vger.kernel.org" , Marek Vasut , Andrew Murray , Simon Horman , Geert Uytterhoeven , Wolfram Sang , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH V4 2/2] PCI: rcar: Recalculate inbound range alignment for each controller entry Message-ID: <20191028102048.GA4414@e121166-lin.cambridge.arm.com> References: <20191026182659.2390-1-marek.vasut@gmail.com> <20191026182659.2390-2-marek.vasut@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Mon, Oct 28, 2019 at 08:35:32AM +0000, Yoshihiro Shimoda wrote: > Hi Marek-san. > > > From: Marek Vasut, Sent: Sunday, October 27, 2019 3:27 AM > > > > Due to hardware constraints, the size of each inbound range entry > > populated into the controller cannot be larger than the alignment > > of the entry's start address. Currently, the alignment for each > > "dma-ranges" inbound range is calculated only once for each range > > and the increment for programming the controller is also derived > > from it only once. Thus, a "dma-ranges" entry describing a memory > > at 0x48000000 and size 0x38000000 would lead to multiple controller > > entries, each 0x08000000 long. > > I added a debug code [1] and I confirmed that each entry is not 0x08000000 long [2]. > > After fixed the commit log above, So what does this mean in practice ? Does it mean that the commit log is wrong or that the issue is not present as described, in the mainline code ? Please clarify and send a v5 accordingly. Thanks, Lorenzo > Reviewed-by: Yoshihiro Shimoda > > And I tested on r8a7795-salvator-xs with my debug code. So, > > Tested-by: Yoshihiro Shimoda > > Best regards, > Yoshihiro Shimoda > > --- > [1] Based on next-20191025 with this patch series: > diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > index fde6ec1..9bdd39e 100644 > --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi > +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi > @@ -2684,7 +2684,7 @@ > 0x02000000 0 0x30000000 0 0x30000000 0 0x08000000 > 0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>; > /* Map all possible DDR as inbound ranges */ > - dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x40000000>; > + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0 0x38000000>; > interrupts = , > , > ; > diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c > index 0dadccb..54ad977 100644 > --- a/drivers/pci/controller/pcie-rcar.c > +++ b/drivers/pci/controller/pcie-rcar.c > @@ -11,6 +11,8 @@ > * Author: Phil Edworthy > */ > > +#define DEBUG > + > #include > #include > #include > @@ -1054,6 +1056,8 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie, > mask = roundup_pow_of_two(size) - 1; > mask &= ~0xf; > > + dev_dbg(pcie->dev, "idx%d: 0x%016llx..0x%016llx -> 0x%016llx\n", > + idx, cpu_addr, size, pci_addr); > /* > * Set up 64-bit inbound regions as the range parser doesn't > * distinguish between 32 and 64-bit types. > --- > [2] > [ 0.374771] rcar-pcie fe000000.pcie: idx0: 0x0000000048000000..0x0000000008000000 -> 0x0000000048000000 > [ 0.374777] rcar-pcie fe000000.pcie: idx2: 0x0000000050000000..0x0000000010000000 -> 0x0000000050000000 > [ 0.374782] rcar-pcie fe000000.pcie: idx4: 0x0000000060000000..0x0000000020000000 -> 0x0000000060000000 > --- >