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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0845BE7B60F for ; Wed, 4 Oct 2023 13:03:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 183DA6B01F0; Wed, 4 Oct 2023 09:03:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10D086B01F2; Wed, 4 Oct 2023 09:03:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC7AB6B01F3; Wed, 4 Oct 2023 09:03:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D62B66B01F0 for ; Wed, 4 Oct 2023 09:03:46 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A87E01A013C for ; Wed, 4 Oct 2023 13:03:46 +0000 (UTC) X-FDA: 81307796052.07.EA8E4DC Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) by imf27.hostedemail.com (Postfix) with ESMTP id D51C1400AD for ; Wed, 4 Oct 2023 13:03:03 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TfTIvZ1n; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of prabhakar.csengg@gmail.com designates 209.85.221.170 as permitted sender) smtp.mailfrom=prabhakar.csengg@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696424584; a=rsa-sha256; cv=none; b=YJ3BWPX2UGCMJx8NmTwfkVvPKWSY+6y7tLeMpR55/nfi2PpSNSJ/c2Rc8IdNE+u5fuaP1O Z/2BwfKTb8i+9MlvG8fjwB4iuQDhvaDiYcdzNjoTz4JDSjQ7YPiyeK6cQXX8vZMkp2Y5WN Q/EREak76fb55YZ33lV/puhRvW4GhO4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TfTIvZ1n; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of prabhakar.csengg@gmail.com designates 209.85.221.170 as permitted sender) smtp.mailfrom=prabhakar.csengg@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696424584; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bSv0fnQiWGKznN7qc7Hk8Fhlm64nM7lW3Q5OIBrznfA=; b=TjfkNW1ZsDqiWgmWqieiy4A4bRNRZoy3YnjSCgosugX7iHhihGLcOE9uq6gIInkOWRRYL7 UpxPVW78T7ew9brKgXLk6jdtGEZWreKqyBxJ6YG0mVU+hUZbJvVdndXFByVChr7Vs9GX5r Ezl/2NBLdvKMC1b8Xt/yMUAqd52tdoU= Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-49d39f07066so892998e0c.0 for ; Wed, 04 Oct 2023 06:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696424583; x=1697029383; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bSv0fnQiWGKznN7qc7Hk8Fhlm64nM7lW3Q5OIBrznfA=; b=TfTIvZ1nZmup3AzWUkub7hMMKcTCQADIDp6GvFgzlWcUXucYfFu0+2NP0VEo70MnN+ ipBGllO8D2VTUQMT8qI525T3YPRDobIgpaEbsPikAPpdbyAVvoXz99o/+eMSt1t4haQy idmfWtM/2Sd8woSI6WpFB9JrD2KSG8g+2gFEXiWqSje4z4jyXTVghHl253Iyvi7WPEF3 fmf0QLd/b069EE5UEI62YeK3JUiwHkDvF1hqKYYz01aKHaos0gnnVu98OKrFk4bh9oRo A+0Y4Gl94Z7Nle0s+YLTlFZckOgWSEIBfFSWLO6OIkSB6BUF7TseXUkSBY1Fz8hVuAcG vNvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696424583; x=1697029383; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bSv0fnQiWGKznN7qc7Hk8Fhlm64nM7lW3Q5OIBrznfA=; b=FUF+qR5wD7tO2XdXJ++ASGMoJYD1jS+ST+XZhVLlSgVtD4WCdhF3z9QPvjxvxBYaYW YypXgL5Jj2DilJyzF6gQFVetvKxS7DAP+N29yF2+dodgJ4xb/vF7FoZwTAOu8eMXG8+k dxwxtTjM+DqVoCgRxyF+HpSw3nKMfkwcX203ZAWTfIe/LoHWR/WfMyVZUPJK4lBDORap 1AycH6BS5xzfw1ERKzFCC2j5IJEURA2tFmwI+4AKFAvGjBUNZYqD6g15uXjF+iPCgL2A qy/Xj8Rxzj4tm1nK052kLx8Nq8mFrneZWjl5eDXdPRkn/ECBI9mE2aqVkBPeDOLKggwX XvwQ== X-Gm-Message-State: AOJu0YyyqEvZ5U7l8MM0CKIVsfrS53j4/n2kiBZh3vjBtc60+sMJmP2c +eQhd/FZJ3c9a8M8Trl6NnTICVCsUHMuDIy9iYA= X-Google-Smtp-Source: AGHT+IEmmj5kDwjfmLxuhp+KqCie3sEBZRH8qhFF3JL8qvtcD8WJmGUdKav7/FUfeLhBloT9LJ8hb0kuH7HP2pQD718= X-Received: by 2002:a1f:4bc4:0:b0:47e:8a9:478c with SMTP id y187-20020a1f4bc4000000b0047e08a9478cmr1789874vka.16.1696424582835; Wed, 04 Oct 2023 06:03:02 -0700 (PDT) MIME-Version: 1.0 References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> In-Reply-To: From: "Lad, Prabhakar" Date: Wed, 4 Oct 2023 14:02:36 +0100 Message-ID: Subject: Re: [PATCH 0/6] RISC-V: Add eMMC support for TH1520 boards To: Jisheng Zhang Cc: Drew Fustini , Christoph Hellwig , Lad Prabhakar , Robert Nelson , 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 , Linux-MM , Robin Murphy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D51C1400AD X-Stat-Signature: 74inu1xgdneqj8chzq7whskgfot8pxje X-HE-Tag: 1696424583-727234 X-HE-Meta: U2FsdGVkX1/IFUYC3+U4MnXP9CluXoSZi70ZqhL72GopvXVJ4fySHPU5UDoutSxBDbs/BvKDFwAe6k/VlsHA7F47M/bDN4TEhb5GdJQ9xO5fIcTQLBxNLQkdfZJ/O8M6qL6JXQdUaNUrobbbh0pDzis79WGbz6xHHUbPXReVVR8BTbz4EwhS4DfJtlOo+3SnNYjMLbDi6E3YiNVXn+eyuOGxwEAN+GP4nnusyeH7Apy49OsGTvUgJNTNvpdYHYtqtal4Y3jOS8pRqAXPaBY/Y6g9VvVJCz38my3s++tJkeG4KserISF3XbN7l1TCrlTkcAW9R9IfxXKgPucmoGF3KjT/7Iyc3/R3UUBkzDVWTSTsWi0+JnGPs1J2quejWPoNvPn3X5Ts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Fi+phR5hR+Tz2smPvahUPdbTERApk9NiOamhtMHzL1fN5DomMlzDPAbDnPcciJhEfHOz4YX/GIaW76rkMBPVu0WJ4TgOJjhgM8ZaMeYD7TZjlR/Ls/qeuooiz/UaYCAy0ITzIKI130EQv4FKNWsBnb+2c3QHZs4nRJEgD7voGemnkcyQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: + CC linux-mm and Robin Murphy On Wed, Oct 4, 2023 at 12:42=E2=80=AFPM Jisheng Zhang = wrote: > > 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=E2=80=AFPM Robert Nelson wrote: > > > > > > > > On Thu, Sep 21, 2023 at 8:51=E2=80=AFPM Drew Fustini wrote: > > > > > > > > > > This series adds support for the eMMC on the BeagleV Ahead and th= e > > > > > Sipeed LicheePi 4A. This allows the kernel to boot with the rootf= s on > > > > > eMMC. > > > > > > > > > > I tested on top of v6.6-rc2 with this config [1]. I was able to b= oot > > > > > both the Ahead [2] and LPi4a [3] from eMMC. The following prerequ= isites > > > > > 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 de= vice > > > > > is enabled in the device trees for these two boards. I did not ye= t > > > > > 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-jsz= hang@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 =3D 758.09 MB/sec > > > > Timing buffered disk reads: 84 MB in 3.01 seconds =3D 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 =3D 790.97 MB/sec > > > > Timing buffered disk reads: 418 MB in 3.00 seconds =3D 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 =3D 800.93 MB/sec > > > Timing buffered disk reads: 892 MB in 3.00 seconds =3D 297.06 MB/se= c > > > > It seems CONFIG_DMA_GLOBAL_POOL=3Dy 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 =3D "shared-dma-pool"; > > reg =3D <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=3Dy. > > + 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-prabhaka= r.mahadev-lad.rj@bp.renesas.com/ > > [3] https://lore.kernel.org/linux-riscv/20230818135723.80612-6-prabhaka= r.mahadev-lad.rj@bp.renesas.com/ > > [4] https://gist.github.com/pdp7/91e72a663d3bb73eb28182337ad8bbcb