Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2346214rdh; Sun, 29 Oct 2023 11:37:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF28U4lNSYC70tJekGEM6uw1Fpd2MW+Bs6Oyoy2penKktyIIIRZLvCvjS6jYnMkACIzQLto X-Received: by 2002:a05:6a20:8e10:b0:17a:e941:b0a3 with SMTP id y16-20020a056a208e1000b0017ae941b0a3mr10727247pzj.39.1698604632149; Sun, 29 Oct 2023 11:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698604632; cv=none; d=google.com; s=arc-20160816; b=i5+uvPhHmKVZSyAYqkaiU/FTRTorqxUDBbj3bRm1xwhdiRYmn1mYS+b3mbXvu4PjAs JlysJDG+HpTYJFWof9tTYc2eFrbhdKcHwoavcka4MAP4hjg0ssPQQ8O87hlyusY8bR+g GAJEm5CWA2ohoSxpGSanotiVpDYATINmtnWDm2W5iuE38sHIr1nctHwdwT3wSo8n3/cH i7pwpDVdvG5Px1ikJTJDZraTZ7R8/1LcQJuF9yYm+Izt0bl4tQZshoDHZ28GHQtAxTGg eyOyHNIwPagCuBwoKiDMP3PWdFHUjvdFk9HWeSUUfVVC1/w9rI7AerdG9qd7kHP9u3Iz 1HGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GzMGu35xyfC7Z+Ts/F/Zrka9AWLhYbUKFwPcZiwOZbg=; fh=ytqwOOx0XIGFFH1JLFbgzdEqUMwEqUz7924YYzdpehI=; b=zkKWgpMXQXoLV7fJLDePzuw/1UnXA9RkEKaLzvvfBjKFW/d/OrZa6KD69XUu5nAwmC oELEMMUYxsi5hGmaRMY/JrYSwrwVzv9j69rQnsPyItdEaeODlyRDP+7zkGxX2Z9Mw6bS PAaDGJfByoqEaaEwAlCzNwdKXjDTsrePyZBBqNq5UgQt0EKwzUk9oK6dq1Q4Vqbg69Il n1gMSTTVjS9LWx4x9AcZ03MOoXs09wEXR8vkWwL33GCLsmOTp71y0kGJ2jOe/sriOzPB ENjp0jA1dWht30l7TWO0n//Z/S93d18NHsJt0hpVsRMe1a2NRm5ZYPt19Yjt3n3nW2/1 3dlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=xCEHKitO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x2-20020aa79402000000b006bf53d8c758si3853972pfo.363.2023.10.29.11.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 11:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=xCEHKitO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B470B80784D3; Sun, 29 Oct 2023 11:36:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbjJ2SgJ (ORCPT + 99 others); Sun, 29 Oct 2023 14:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjJ2SgI (ORCPT ); Sun, 29 Oct 2023 14:36:08 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70077BA; Sun, 29 Oct 2023 11:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=GzMGu35xyfC7Z+Ts/F/Zrka9AWLhYbUKFwPcZiwOZbg=; b=xCEHKitOSU6kliyAFp290mh36S QpvEMSvva6z8wSEULh/sNw20ERKEwt14pvcwElHOycX3MfrPD93mhqMfE1hxc7FCPMo5aK+/Jxa3i kF18CdqHynNDGJaI+tC+2uC5WvnAUs3FBaArrJYaqi7a/+UmVkpHTsNn/nqdJBaT5AL4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qxAdL-000SPf-2P; Sun, 29 Oct 2023 19:35:35 +0100 Date: Sun, 29 Oct 2023 19:35:35 +0100 From: Andrew Lunn To: Cristian Ciocaltea Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Emil Renner Berthing , Samin Guo , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Giuseppe Cavallaro , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, Emil Renner Berthing Subject: Re: [PATCH v2 08/12] riscv: dts: starfive: Add pool for coherent DMA memory on JH7100 boards Message-ID: <9b8c9846-20be-4cfa-aff5-f9ae8ac2aba4@lunn.ch> References: <20231029042712.520010-1-cristian.ciocaltea@collabora.com> <20231029042712.520010-9-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231029042712.520010-9-cristian.ciocaltea@collabora.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 11:36:38 -0700 (PDT) On Sun, Oct 29, 2023 at 06:27:08AM +0200, Cristian Ciocaltea wrote: > From: Emil Renner Berthing > > The StarFive JH7100 SoC has non-coherent device DMAs, but most drivers > expect to be able to allocate coherent memory for DMA descriptors and > such. However on the JH7100 DDR memory appears twice in the physical > memory map, once cached and once uncached: > > 0x00_8000_0000 - 0x08_7fff_ffff : Off chip DDR memory, cached > 0x10_0000_0000 - 0x17_ffff_ffff : Off chip DDR memory, uncached > > To use this uncached region we create a global DMA memory pool there and > reserve the corresponding area in the cached region. > > However the uncached region is fully above the 32bit address limit, so add > a dma-ranges map so the DMA address used for peripherals is still in the > regular cached region below the limit. > > Link: https://github.com/starfive-tech/JH7100_Docs/blob/main/JH7100%20Data%20Sheet%20V01.01.04-EN%20(4-21-2021).pdf > Signed-off-by: Emil Renner Berthing > Signed-off-by: Cristian Ciocaltea > --- > .../boot/dts/starfive/jh7100-common.dtsi | 24 +++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi > index b93ce351a90f..504c73f01f14 100644 > --- a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi > +++ b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi > @@ -39,6 +39,30 @@ led-ack { > label = "ack"; > }; > }; > + > + reserved-memory { > + #address-cells = <2>; > + #size-cells = <2>; > + ranges; > + > + dma-reserved { > + reg = <0x0 0xfa000000 0x0 0x1000000>; If i'm reading this correctly, this is at the top of the first 4G of RAM. But this is jh7100-common.dtsi. Is it guaranteed that all boards derived from this have at least 4G? What happens is a board only has 2G? It might also be worth putting a comment here about the memory being mapped twice. In the ARM world that would be illegal, so its maybe not seen that often. Yes, the commit message explains that, but when i look at the code on its own, it is less obvious. > + no-map; > + }; > + > + linux,dma { > + compatible = "shared-dma-pool"; > + reg = <0x10 0x7a000000 0x0 0x1000000>; > + no-map; > + linux,dma-default; > + }; > + };