Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2542333rdb; Wed, 4 Oct 2023 04:43:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsR02nzuS/6LiQfryixWRkqTiNo+eCUzCG13dzw41ZdM29KSdVWt8bqCB/Hs1cjUv9es4V X-Received: by 2002:a9d:7752:0:b0:6c4:ac5b:1f83 with SMTP id t18-20020a9d7752000000b006c4ac5b1f83mr1788328otl.2.1696419782994; Wed, 04 Oct 2023 04:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696419782; cv=none; d=google.com; s=arc-20160816; b=URjkpnRQ6B+ZBSaztTAlwHIzIjlzm0uRJuSGI8ekhMPQ4enp0otrm7G4L2ZEIETF3t sieRDd76AiFh3ayBEAS+WWdhGIRSoilfy1AgZRuVNwZmffBWey+G9wPfIlJAQDE78dYg v4vbfbbU5tM+BW3WN7IpRkmh7CrDutcQLvHseK5mdp0KPc/4lO3d9TxOWr6TWSXmcD3e 5vZEPvinPiafeu0xTQ+/i8VITiu7VjmWOOfbpzxyLCdelnQHeJDSjPScDv1CINSaoWbP JTHftOKsaXuE9ib8kTJUIUWx5GAXaLbpjimIQ+nH62lhZchm84uQrscwtfmUhIm96SgP RnXg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=j5XF5qD/JGNbyc7CMoCYHpGa7KrcDr5InS0i17aM/nY=; fh=+p/22pdPGYgzOIWCntvXVxSU55noq/oMMwz/UMgSHkQ=; b=YU4pUeXdw3uKS+bbJXu/M5Q6u+F9WinZ/NXimiyKOLXabcLC3AESYphoOzkmjbXZ6P a7BPaSezvQkpzKkaPnLFSYDErHD5lLKuTNsi1R10AHS5HbTzUdK5YrD+hW3XJ/0IxNtE KR1eLHK1tI0fTQH8owuwbvWIhaJpIPb/COqVP9UihZAanesocAk+NUk96QXtz7bTdkLK TXCsJvz2k5ncarGznWRmrKwkSbGrIKNgh6OvgfVfz3zIdXNQsccu8vrG1/J05/0Ea6y0 YqH3D5jESr4Jx2WQL3f++3UXc6SkyROIrNTbN9/XlqXcI+SlNWtkib29R3RD3CSaEOn9 UJmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F4e7oRS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d190-20020a6336c7000000b00565e0624182si3542771pga.404.2023.10.04.04.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 04:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F4e7oRS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D20FD8191446; Wed, 4 Oct 2023 04:43:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242218AbjJDLmv (ORCPT + 99 others); Wed, 4 Oct 2023 07:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232795AbjJDLmu (ORCPT ); Wed, 4 Oct 2023 07:42:50 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0791CA7; Wed, 4 Oct 2023 04:42:45 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0385EC433C7; Wed, 4 Oct 2023 11:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696419764; bh=fyfWdnLL1in84snsB7P+H9eun3ijbjisxGk16TwTc9U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F4e7oRS6CgYtSKUDfmtLJhKBv08S3FB82BJNHFH7bS9u7LpfroBlPZ7GjxdEUk2k7 Ukzd9Udbh/Dr6wjGvD5uQ+1sUnh7bohewHVUrglOdCAVei1OzBpMCM++2o47yEBWnj oRCU5/lGRSaeTTgiw6DeyD1QCjBUe3KHFM/MB8qe+UpDmGoHn4nQZeM0v74idTF+SJ SIyEKyT+529xt/CdmbRDj2WCnDw5WFrP6t4Zss7kqKfTywDNODWJ4InBtVjHXkVYOq 1BgfpHrn0tIV1vYoqAzEzOlD+TkhlopU0Tz7UamhDitPF9luEmQYR90NtOT6/0HY8X 9emfIJVTnjEAw== Date: Wed, 4 Oct 2023 19:30:36 +0800 From: Jisheng Zhang To: Drew Fustini , Christoph Hellwig , Lad Prabhakar Cc: Robert Nelson , Prabhakar , Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexandre Ghiti Subject: Re: [PATCH 0/6] RISC-V: Add eMMC support for TH1520 boards Message-ID: References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 04:43:02 -0700 (PDT) On Mon, Oct 02, 2023 at 09:37:44PM -0700, Drew Fustini wrote: > On Fri, Sep 22, 2023 at 05:48:21PM -0500, Robert Nelson wrote: > > On Fri, Sep 22, 2023 at 2:08 PM Robert Nelson wrote: > > > > > > On Thu, Sep 21, 2023 at 8:51 PM Drew Fustini wrote: > > > > > > > > This series adds support for the eMMC on the BeagleV Ahead and the > > > > Sipeed LicheePi 4A. This allows the kernel to boot with the rootfs on > > > > eMMC. > > > > > > > > I tested on top of v6.6-rc2 with this config [1]. I was able to boot > > > > both the Ahead [2] and LPi4a [3] from eMMC. The following prerequisites > > > > are required: > > > > > > > > [PATCH v2] riscv: dts: thead: set dma-noncoherent to soc bus [4] > > > > > > > > I pushed a branch [5] with this patch series and the above patch for > > > > those that find a git branch easier to test. > > > > > > > > Please note that only the MMC controller connected to the eMMC device > > > > is enabled in the device trees for these two boards. I did not yet > > > > attempt to configure and use the microSD card slot. My preference is to > > > > address that in a future patch series. > > > > > > > > References: > > > > [1] https://gist.github.com/pdp7/5fbdcf2a65eb1abdd3a29d519c19cdd2 > > > > [2] https://gist.github.com/pdp7/91a801a5f8d1070c53509eda9800ad78 > > > > [3] https://gist.github.com/pdp7/1445c3c991e88fd69c60165cef65726a > > > > [4] https://lore.kernel.org/linux-riscv/20230912072232.2455-1-jszhang@kernel.org/ > > > > [5] https://github.com/pdp7/linux/tree/b4/th1520-mmc > > > > > > This patchset came out very nice! > > > > > > v6.6-rc2 with Last RFC v2: > > > > > > [ 4.066630] mmc0: SDHCI controller on ffe7080000.mmc > > > [ffe7080000.mmc] using PIO > > > > > > debian@BeagleV:~$ sudo hdparm -tT /dev/mmcblk0 > > > > > > /dev/mmcblk0: > > > Timing cached reads: 1516 MB in 2.00 seconds = 758.09 MB/sec > > > Timing buffered disk reads: 84 MB in 3.01 seconds = 27.94 MB/sec > > > > > > vs v6.6-rc2 with this patchset: > > > > > > [ 4.096837] mmc0: SDHCI controller on ffe7080000.mmc > > > [ffe7080000.mmc] using DMA > > > > > > debian@BeagleV:~$ sudo hdparm -tT /dev/mmcblk0 > > > > > > /dev/mmcblk0: > > > Timing cached reads: 1580 MB in 2.00 seconds = 790.97 MB/sec > > > Timing buffered disk reads: 418 MB in 3.00 seconds = 139.11 MB/sec > > > > Drew pointed out on Slack, this was not quite right.. After more > > digging by Drew, CONFIG_DMA_GLOBAL_POOL is causing a DMA limitation > > with the multiplatform defconfig. so with, > > > > ./scripts/config --disable CONFIG_ARCH_R9A07G043 > > > > (to remove CONFIG_DMA_GLOBAL_POOL)... another 2x in buffered reads.. > > > > [ 4.059242] mmc0: SDHCI controller on ffe7080000.mmc > > [ffe7080000.mmc] using ADMA 64-bit > > > > debian@BeagleV:~$ sudo hdparm -tT /dev/mmcblk0 > > > > /dev/mmcblk0: > > Timing cached reads: 1600 MB in 2.00 seconds = 800.93 MB/sec > > Timing buffered disk reads: 892 MB in 3.00 seconds = 297.06 MB/sec > > It seems CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail [1]: > > mmc0: Unable to allocate ADMA buffers - falling back to standard DMA > > Prabhakar's AX45MP non-coherent DMA support [2] series introduced the > selection of DMA_GLOBAL_POOL for ARCH_R9A07G043 and the riscv defconfig > selects ARCH_R9A07G043. > > Patch 5 in the series [3] states that: > > With DMA_GLOBAL_POOL enabled all DMA allocations happen from this > region and synchronization callbacks are implemented to synchronize > when doing DMA transactions. > > This example of a "shared-dma-pool" node was given: > > pma_resv0@58000000 { > compatible = "shared-dma-pool"; > reg = <0x0 0x58000000 0x0 0x08000000>; > no-map; > linux,dma-default; > }; > > I've copied that to th1520-beaglev-ahead.dts. The address of 0x58000000 > has no significance on th1520, but the existence of shared-dma-pool > seems to fix the problem. ADMA mode [4] is now working even though > CONFIG_DMA_GLOBAL_POOL=y. + Christoph, Lad IMHO, this is not TH1520 specific but a generic issue. I believe commit 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC") can cause regression on all non-dma-coherent riscv platforms with generic defconfig. This is a common issue. The logic here is: generic riscv defconfig selects ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all non-dma-coherent riscv platforms have a dma global pool, this assumption seems not correct. And I believe DMA_GLOBAL_POOL should not be selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific conditions can select it globaly, for example NOMMU ARM and so on. Since this is a regression, what's proper fix? any suggestion is appreciated. Thanks > > Thanks, > Drew > > [1] https://gist.github.com/pdp7/73041ed808bbc7dd445836fb90574979 > [2] https://lore.kernel.org/linux-riscv/20230818135723.80612-1-prabhakar.mahadev-lad.rj@bp.renesas.com/ > [3] https://lore.kernel.org/linux-riscv/20230818135723.80612-6-prabhakar.mahadev-lad.rj@bp.renesas.com/ > [4] https://gist.github.com/pdp7/91e72a663d3bb73eb28182337ad8bbcb