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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDEE4C83F33 for ; Mon, 4 Sep 2023 19:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243744AbjIDT14 (ORCPT ); Mon, 4 Sep 2023 15:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243562AbjIDT1z (ORCPT ); Mon, 4 Sep 2023 15:27:55 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67A0CDB for ; Mon, 4 Sep 2023 12:27:49 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-68a56401c12so995558b3a.2 for ; Mon, 04 Sep 2023 12:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1693855669; x=1694460469; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=yWREej5t+eIqMC63lmoGy+XChxC2cKp7ZhM4c1pDWR0=; b=Ylatk4oMqX4DLeqkZXR5HOXv27jd4k5xLgL8zKr7OoCdqGTnukdwQUeSh7HbVwzDsq ql4qd7gD4XB8/ZXQVItAH45uEG649qttWb+tOEHcDiorrNfC9MopjcskaQQO8ioKVVVN hvrHzkYGRB1ZvKFwPI8S0CaeCr9kIoteYcdkxYCjfnu8d1csaY8nqUnMm4r8jXPvCU2r tsXz7fwxpeRE7MLdqzbcwsONvs/p5koEYZ7GNynZwY1tFRKTsb1j8cJv3pB2BXMOzO33 B8EGAx+KV7szKraE1YtKCXtRUn17YHXH19Z6IbrpRkAecT38e6L05LKnX3JeKdBuak89 5UFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693855669; x=1694460469; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yWREej5t+eIqMC63lmoGy+XChxC2cKp7ZhM4c1pDWR0=; b=RuXRmoXaM1nGFepMnl6SX2UnkCADfcWwpZb+AR4pAFL0ER9VmyRk++JAgXLjb+peNI MpweTFmuqP0mRSCFAYn8LDKhwiXJZek5Cgd0cnxMYCmce0IY7wNpAfgGUb8xslnA/Myq zwXT7kOppnNGPtjh7UaxbbEtfbuXR0rvhU4bzXH+WrDWxISvEGLyKeiR1t1gUVacOoP2 alsHuk/JCcp0GGs0ohDkOAaVg9aFJJQardlgnFS2Z4oyxcnHwt4PO0jxslOoy5Ferp9d +gYBi7eu8REQMf6DAdWNyANO/Ve6qCq1KObnh15m6ZsjyzltlzUmZ/TthQmXEvALRO5A /a1g== X-Gm-Message-State: AOJu0YzPf4Cynn7iK7+1010M/wqf7Nt4zrXCINi7TUF/3mCLZOlR8bds CVmptZ4XSAJfEwXa74U+AF3q7Q== X-Google-Smtp-Source: AGHT+IF8jZgXYFF7x4w9/EJ+mUhvyY5RomvN8zh7QIx1a3gn13jt+ZjTcXlJuczNF8kMK83V8bbJpg== X-Received: by 2002:a05:6a21:4841:b0:14c:c511:387d with SMTP id au1-20020a056a21484100b0014cc511387dmr9713357pzc.9.1693855669066; Mon, 04 Sep 2023 12:27:49 -0700 (PDT) Received: from x1 ([2601:1c2:1800:f680:5de2:2323:20de:e26d]) by smtp.gmail.com with ESMTPSA id cg11-20020a056a00290b00b0068c9fc82bfbsm6591591pfb.197.2023.09.04.12.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 12:27:48 -0700 (PDT) Date: Mon, 4 Sep 2023 12:27:46 -0700 From: Drew Fustini To: Xi Ruoyao Cc: Jisheng Zhang , Guo Ren , Fu Wei , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: dts: thead: set dma-noncoherent to soc bus Message-ID: References: <20230820115353.1962-1-jszhang@kernel.org> <292198d3915bafbe1c82372da2f2755a1842512f.camel@xry111.site> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, Sep 04, 2023 at 10:52:39AM -0700, Drew Fustini wrote: > On Tue, Sep 05, 2023 at 12:28:41AM +0800, Xi Ruoyao wrote: > > On Mon, 2023-09-04 at 22:45 +0800, Jisheng Zhang wrote: > > > On Sun, Sep 03, 2023 at 04:32:21PM -0700, Drew Fustini wrote: > > > > On Sun, Aug 20, 2023 at 07:53:53PM +0800, Jisheng Zhang wrote: > > > > > riscv select ARCH_DMA_DEFAULT_COHERENT by default, and th1520 isn't > > > > > dma coherent, so set dma-noncoherent to reflect this fact. > > > > > > > > > > Signed-off-by: Jisheng Zhang > > > > > --- > > > > >  arch/riscv/boot/dts/thead/th1520.dtsi | 1 + > > > > >  1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi > > > > > index 56a73134b49e..58108f0eb3fd 100644 > > > > > --- a/arch/riscv/boot/dts/thead/th1520.dtsi > > > > > +++ b/arch/riscv/boot/dts/thead/th1520.dtsi > > > > > @@ -139,6 +139,7 @@ soc { > > > > >                 interrupt-parent = <&plic>; > > > > >                 #address-cells = <2>; > > > > >                 #size-cells = <2>; > > > > > +               dma-noncoherent; > > > > >                 ranges; > > > > >   > > > > >                 plic: interrupt-controller@ffd8000000 { > > > > > -- > > > > > 2.40.1 > > > > > > > > > > > > > Tested-by: Drew Fustini > > > > > > > > I tried this on the BeagleV Ahead. They system booted as expected and I > > > > did not notice any problems in the boot log. > > > > > > > > Are there other patches such as the dwmac series that I should test this > > > > with? > > > > > > Hmm, this patch is necessary to test dwmac, emmc ;) > > > > Drew: does this fix the "broken DMA" issue you've mentioned in the EMMC > > support patch? > > After I sent my reply yesterday, I then tried applying this patch on top > of my eMMC series. I removed SDHCI_QUIRK_BROKEN_DMA and I discovered > that SDMA did not immediately break and the mmcblk0 partitions appeared > in /dev [1]. Note - I am using CONFIG_INITRAMFS_SOURCE set to my > buidlroot rootfs.cpio so that the system will boot okay regardless of > the emmc. > > I was able to mount the emmc boot partition /dev/mmcblk0p2. However, > after unmounting it, I noticed that I could not mount it again: > > # mount /dev/mmcblk0p2 /mnt/p2 > [ 41.684899] EXT4-fs (mmcblk0p2): mounted filesystem 6ea98ccf-2178-48a9-a1ad-0eb454f57268 r/w with ordered data mode > # ls -la /mnt/p2 > total 22696 > drwxr-xr-x 5 root root 4096 Sep 4 2023 . > drwxr-xr-x 4 root root 0 Jan 1 00:00 .. > -rw-rw-r-- 1 1000 1000 26455552 Sep 4 2023 Image > drwxr-xr-x 2 root root 4096 Jul 29 2023 extlinux > > # umount /mnt/p2 > [ 52.101003] EXT4-fs (mmcblk0p2): unmounting filesystem 6ea98ccf-2178-48a9-a1ad-0eb454f57268. > # mount /dev/mmcblk0p2 /mnt/p2 > [ 58.826078] JBD2: no valid journal superblock found > [ 58.831041] EXT4-fs (mmcblk0p2): Could not load journal inode > mount: mounting /dev/mmcblk0p2 on /mnt/p2 failed: Invalid argument > > I was completely unable to mount the root fs partition /dev/mmcblk0p3: > > # mount /dev/mmcblk0p2 /mnt/p2 > [ 58.826078] JBD2: no valid journal superblock found > [ 58.831041] EXT4-fs (mmcblk0p2): Could not load journal inode > mount: mounting /dev/mmcblk0p2 on /mnt/p2 failed: Invalid argument > # umount /mnt/p2 > umount: can't unmount /mnt/p2: Invalid argument > > I suspect there is some corruption of the buffers happening. I see there > are also these patch series from Jisheng so I will try applying them and > see if there is any difference: > > [PATCH v2 0/2] riscv: errata: improve T-Head CMO > [PATCH] riscv: mm: update T-Head memory type definitions Good news, I applied "riscv: errata: improve T-Head CMO" [1] and SDMA is now working correctly. I can mount both boot and rootfs paritions and then is no problem umounting and then remounting [2]. Note - I didn't 'riscv: mm: update T-Head memory type definitions' yet but I will do that next and make sure everything is still working. I'll post an update to my eMMC series. -Drew [1] https://lore.kernel.org/all/20230827090813.1353-1-jszhang@kernel.org/ [2] https://gist.github.com/pdp7/c72c91530c46ef560f4d1940ea1964c9