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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 94A49C4320A for ; Fri, 23 Jul 2021 15:54: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 65C9860EBD for ; Fri, 23 Jul 2021 15:54:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 65C9860EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=AZyXH2eWabJdJSOrW8lRfRgNjy4JFKSvYs4rTPm6aWI=; b=doaauOc+qeqTyS tFZ2LmyB1E4UNK25+T/zwWMsnfF0noLiE1xrmIYijyBmrJMGgRk7NGrN6KuGIvoxYFtOQK3pZ211q y6y1VAL1mWJs7Dt74/NaiAov9Vcv0YoY2R56Hi37mcgXR6LF9xpS1876vHTuVqXt+mVp9VKLOcRf8 VsVSKopQRGf/RAdUU5wtDSr+MMxA+1J43TyqMSYNte8v01KWGV3lorVpakYxPHVYgiE1gNpnNMVNP AQjZISyfUJxB+lSNmeEynP2iZ91wuA32iC4PvQIQiwzbq7fNf9hXgHK09R3WC9GiUT/sSUfzzLsdZ 5fXAHRQjG+/wpVg2gy2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6xTw-005FuB-JY; Fri, 23 Jul 2021 15:53:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6xTq-005Frm-C1 for linux-arm-kernel@lists.infradead.org; Fri, 23 Jul 2021 15:52:57 +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 7067F11B3; Fri, 23 Jul 2021 08:52:51 -0700 (PDT) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BA76C3F73D; Fri, 23 Jul 2021 08:52:49 -0700 (PDT) Date: Fri, 23 Jul 2021 16:52:47 +0100 From: Lorenzo Pieralisi To: Pali =?iso-8859-1?Q?Roh=E1r?= , robh@kernel.org Cc: Gregory CLEMENT , Thomas Petazzoni , Bjorn Helgaas , Marek =?iso-8859-1?Q?Beh=FAn?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , Marc Zyngier , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] arm64: dts: marvell: armada-37xx: Extend PCIe MEM space Message-ID: <20210723155247.GB4103@lpieralisi> References: <20210624215546.4015-1-pali@kernel.org> <20210624215546.4015-3-pali@kernel.org> <87pmv919bq.fsf@BL-laptop> <20210723141204.waiipazikhzzloj7@pali> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210723141204.waiipazikhzzloj7@pali> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210723_085254_545375_DD0DB241 X-CRM114-Status: GOOD ( 40.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jul 23, 2021 at 04:12:04PM +0200, Pali Roh=E1r wrote: > On Friday 23 July 2021 14:52:25 Gregory CLEMENT wrote: > > Hello Pali, > > = > > > Current PCIe MEM space of size 16 MB is not enough for some combinati= on > > > of PCIe cards (e.g. NVMe disk together with ath11k wifi card). ARM Tr= usted > > > Firmware for Armada 3700 platform already assigns 128 MB for PCIe win= dow, > > > so extend PCIe MEM space to the end of 128 MB PCIe window which allow= s to > > > allocate more PCIe BARs for more PCIe cards. > > > > > > Without this change some combination of PCIe cards cannot be used and > > > kernel show error messages in dmesg during initialization: > > > > > > pci 0000:00:00.0: BAR 8: no space for [mem size 0x01800000] > > > pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x01800000] > > > pci 0000:00:00.0: BAR 6: assigned [mem 0xe8000000-0xe80007ff pref] > > > pci 0000:01:00.0: BAR 8: no space for [mem size 0x01800000] > > > pci 0000:01:00.0: BAR 8: failed to assign [mem size 0x01800000] > > > pci 0000:02:03.0: BAR 8: no space for [mem size 0x01000000] > > > pci 0000:02:03.0: BAR 8: failed to assign [mem size 0x01000000] > > > pci 0000:02:07.0: BAR 8: no space for [mem size 0x00100000] > > > pci 0000:02:07.0: BAR 8: failed to assign [mem size 0x00100000] > > > pci 0000:03:00.0: BAR 0: no space for [mem size 0x01000000 64bit] > > > pci 0000:03:00.0: BAR 0: failed to assign [mem size 0x01000000 64= bit] > > > > > > Due to bugs in U-Boot port for Turris Mox, the second range in Turris= Mox > > > kernel DTS file for PCIe must start at 16 MB offset. Otherwise U-Boot > > > crashes during loading of kernel DTB file. This bug is present only in > > > U-Boot code for Turris Mox and therefore other Armada 3700 devices ar= e not > > > affected by this bug. Bug is fixed in U-Boot version 2021.07. > > > > > > To not break booting new kernels on existing versions of U-Boot on Tu= rris > > > Mox, use first 16 MB range for IO and second range with rest of PCIe = window > > > for MEM. > > = > > Is there any depencey with the firs patch of this series ? > > = > > What happend if this patch is applied without the other ? > = > First patch is fixing reading and setting ranges configuration from DTS. > Without first patch memory windows stays as they were in bootloader or > in its default configuration. Which is that all 128 MB are transparently > mapped to PCIe MEM space. > = > Therefore this second DTS patch does not fixes issue with IO space > (kernel still crashes when accessing it). But allows to use all PCIe MEM > space (due to bootloader / default configuration) and therefore allows > to use more PCIe cards (which needs more PCIe MEM space). So, the two patches are decoupled then ? We are not taking dts changes through the PCI tree. Besides: these dts patches are a nightmare for backward compatibility, hopefully Rob can shed some light on whether what you are doing here is advisable and how to sync the changes with kernel changes. Lorenzo > > Could you test it to see if any regression occure ? > > = > > Thanks, > > = > > Gr=E9gory > > = > > > > > > Signed-off-by: Pali Roh=E1r > > > Fixes: 76f6386b25cc ("arm64: dts: marvell: Add Aardvark PCIe support = for Armada 3700") > > > --- > > > .../boot/dts/marvell/armada-3720-turris-mox.dts | 17 +++++++++++++++= ++ > > > arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 11 +++++++++-- > > > 2 files changed, 26 insertions(+), 2 deletions(-) > > > > > > diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b= /arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > > > index 53e817c5f6f3..86b3025f174b 100644 > > > --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > > > +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > > > @@ -134,6 +134,23 @@ > > > pinctrl-0 =3D <&pcie_reset_pins &pcie_clkreq_pins>; > > > status =3D "okay"; > > > reset-gpios =3D <&gpiosb 3 GPIO_ACTIVE_LOW>; > > > + /* > > > + * U-Boot port for Turris Mox has a bug which always expects that "= ranges" DT property > > > + * contains exactly 2 ranges with 3 (child) address cells, 2 (paren= t) address cells and > > > + * 2 size cells and also expects that the second range starts at 16= MB offset. If these > > > + * conditions are not met then U-Boot crashes during loading kernel= DTB file. PCIe address > > > + * space is 128 MB long, so the best split between MEM and IO is to= use fixed 16 MB window > > > + * for IO and the rest 112 MB (64+32+16) for MEM, despite that maxi= mal IO size is just 64 kB. > > > + * This bug is not present in U-Boot ports for other Armada 3700 de= vices and is fixed in > > > + * U-Boot version 2021.07. See relevant U-Boot commits (the last on= e contains fix): > > > + * https://source.denx.de/u-boot/u-boot/-/commit/cb2ddb291ee6fcbddd= 6d8f4ff49089dfe580f5d7 > > > + * https://source.denx.de/u-boot/u-boot/-/commit/c64ac3b3185aeb3846= 297ad7391fc6df8ecd73bf > > > + * https://source.denx.de/u-boot/u-boot/-/commit/4a82fca8e330157081= fc132a591ebd99ba02ee33 > > > + */ > > > + #address-cells =3D <3>; > > > + #size-cells =3D <2>; > > > + ranges =3D <0x81000000 0 0xe8000000 0 0xe8000000 0 0x01000000 = /* Port 0 IO */ > > > + 0x82000000 0 0xe9000000 0 0xe9000000 0 0x07000000>; /* Port = 0 MEM */ > > > = > > > /* enabled by U-Boot if PCIe module is present */ > > > status =3D "disabled"; > > > diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm6= 4/boot/dts/marvell/armada-37xx.dtsi > > > index 7a2df148c6a3..dac3007f2ac1 100644 > > > --- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi > > > +++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi > > > @@ -488,8 +488,15 @@ > > > #interrupt-cells =3D <1>; > > > msi-parent =3D <&pcie0>; > > > msi-controller; > > > - ranges =3D <0x82000000 0 0xe8000000 0 0xe8000000 0 0x1000000 /*= Port 0 MEM */ > > > - 0x81000000 0 0xe9000000 0 0xe9000000 0 0x10000>; /* Port 0 I= O*/ > > > + /* > > > + * The 128 MiB address range [0xe8000000-0xf0000000] is > > > + * dedicated for PCIe and can be assigned to 8 windows > > > + * with size a power of two. Use one 64 KiB window for > > > + * IO at the end and the remaining seven windows > > > + * (totaling 127 MiB) for MEM. > > > + */ > > > + ranges =3D <0x82000000 0 0xe8000000 0 0xe8000000 0 0x07f00000= /* Port 0 MEM */ > > > + 0x81000000 0 0xefff0000 0 0xefff0000 0 0x00010000>; /* Por= t 0 IO */ > > > interrupt-map-mask =3D <0 0 0 7>; > > > interrupt-map =3D <0 0 0 1 &pcie_intc 0>, > > > <0 0 0 2 &pcie_intc 1>, > > > -- = > > > 2.20.1 > > > > > = > > -- = > > Gregory Clement, Bootlin > > Embedded Linux and Kernel engineering > > http://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel