Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5143303pxj; Wed, 9 Jun 2021 10:05:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5PzCkgyyQLYzDzcm4DX8Lq20iY+THD5exJdoyEX+1xo7F4DBKIVoGymf4sZyRsP7C/SOy X-Received: by 2002:a17:907:62a7:: with SMTP id nd39mr847312ejc.502.1623258359539; Wed, 09 Jun 2021 10:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623258359; cv=none; d=google.com; s=arc-20160816; b=mSBsC52cW9y3GCfYcXjkV7q9EnaqRpYFYSMpzltHYXejUvBiO7I+bQb4rXBIF7mKIo IHfU98CqczruooxCDn97ptOzlyM1BqGB7nlRkWcGiO3tCO1Q0WkzoU65Aet7Qp1xeUXU Jk45/Db4Z0WzwCOOprsgofxBvw/qp3IJUy5X8/yhsekpGeYV8mM3T/gk1+KUvzYEbWZT UwTfdZiss+n0OYM5rPD7zSAK/63nA8Dvgx/gSVBxSrwBmuVrYcXbOgkpL2Hse7oI6Xqq C05dUTv3JvHARJ4WBUSFbHsiG947B1cm9X3TD+OXFu0Gefs4NFz8gaeFNj5H96g0XxUs pOqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sVOvpgkj/HcQEC0DEM+Ytv8Acia96LYlFJs0iR7sVE0=; b=TT5I3/zy6qxyjGNZ7dlbLA7rarIVr9RAB+Xoy5m2xNQBgn8ssj9jamoaQiTmCM28gZ gFKoU9qfD7yCV3TWFq9/rPZT5nltqv1biPJq3fMww0OWrh0p2v3QmC3uKpcseeCDxHG/ p8dKxRJo3Tc0c+yhDAC8+eyhddzcfKrOptuy5pBr/8pO1PLfdY/vjIr9lyqjrnAnyfV3 XAc6Vs06JYu27a9IUMctUq9IMpfur4RtjydeN7j2yfTo0XkkGatXi1tKlYpJRtmo7S/i OIml8jdyeR3sYpS5jh5TKXSVUnZ3GguxRKRo7b+ag8vTxE/Da60m7f0+GAor/k7sPRjw LUAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Prreyzpb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz10si213316edb.266.2021.06.09.10.05.35; Wed, 09 Jun 2021 10:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Prreyzpb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236406AbhFIDa1 (ORCPT + 99 others); Tue, 8 Jun 2021 23:30:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232859AbhFIDa0 (ORCPT ); Tue, 8 Jun 2021 23:30:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07D5461351; Wed, 9 Jun 2021 03:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623209313; bh=sVOvpgkj/HcQEC0DEM+Ytv8Acia96LYlFJs0iR7sVE0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Prreyzpb+3DlgrClJOr+3H3PX/coyUs5SEPJorPwPemvOan9aHP6vrbIqHWn3XYUH tooelE1e5K3whyhpOMytDg7IODDI4Dpwi92LT0ugkIfLQkSSmL1dwwEtUESd7WSv1V AuBFoRFO9NLSV+zam3AKBJC0Ses7L63TzeW/u0AZQqxTOb6lR5QJAvwvjB7BspZM1F V61tbf4lTiXl+veTtVpLMA+vYyhubEfhj+YK8JncnWYxCH0B5VXLyMOzQb9QQIxgVe M+6uCo1WvWGHSc7ZDJgFh4739nC9+6Co8EgnHe6H07ySNIzJHfPLNxcrQrYk+RTbeI XB5vuu+1cmxUg== Received: by mail-lf1-f51.google.com with SMTP id p7so1535753lfg.4; Tue, 08 Jun 2021 20:28:32 -0700 (PDT) X-Gm-Message-State: AOAM5337YhH/V2mz/a8o8IkWJcZ3/P+A6pOTANo5HmgjLFONQDpsHWXv I2BOrynFneRuVf2eu3PUMPJIKE+gWs/NxYRyO1w= X-Received: by 2002:ac2:4c0e:: with SMTP id t14mr17968325lfq.555.1623209311215; Tue, 08 Jun 2021 20:28:31 -0700 (PDT) MIME-Version: 1.0 References: <1621400656-25678-1-git-send-email-guoren@kernel.org> <20210519052048.GA24853@lst.de> <20210519064435.GA3076809@x1> <20210519065352.GA31590@lst.de> <29733b0931d9dd6a2f0b6919067c7efe@mailhost.ics.forth.gr> In-Reply-To: <29733b0931d9dd6a2f0b6919067c7efe@mailhost.ics.forth.gr> From: Guo Ren Date: Wed, 9 Jun 2021 11:28:19 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/3] riscv: Add DMA_COHERENT support To: Nick Kossifidis Cc: Christoph Hellwig , Drew Fustini , Anup Patel , Palmer Dabbelt , wefu@redhat.com, =?UTF-8?B?V2VpIFd1ICjlkLTkvJ8p?= , linux-riscv , Linux Kernel Mailing List , linux-arch , linux-sunxi@lists.linux.dev, Guo Ren , Paul Walmsley , Benjamin Koch , Matteo Croce , Wei Fu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 7, 2021 at 2:14 AM Nick Kossifidis wrote: > > =CE=A3=CF=84=CE=B9=CF=82 2021-05-20 04:45, Guo Ren =CE=AD=CE=B3=CF=81=CE= =B1=CF=88=CE=B5: > > On Wed, May 19, 2021 at 2:53 PM Christoph Hellwig wrote: > >> > >> On Tue, May 18, 2021 at 11:44:35PM -0700, Drew Fustini wrote: > >> > This patch series looks like it might be useful for the StarFive JH7= 100 > >> > [1] [2] too as it has peripherals on a non-coherent interconnect. GM= AC, > >> > USB and SDIO require that the L2 cache must be manually flushed afte= r > >> > DMA operations if the data is intended to be shared with U74 cores [= 2]. > >> > >> Not too much, given that the SiFive lineage CPUs have an uncached > >> window, that is a totally different way to allocate uncached memory. > > It's a very big MIPS smell. What's the attribute of the uncached > > window? (uncached + strong-order/ uncached + weak, most vendors still > > use AXI interconnect, how to deal with a bufferable attribute?) In > > fact, customers' drivers use different ways to deal with DMA memory in > > non-coherent SOC. Most riscv SOC vendors are from ARM, so giving them > > the same way in DMA memory is a smart choice. So using PTE attributes > > is more suitable. > > > > See: > > https://github.com/riscv/virtual-memory/blob/main/specs/611-virtual-mem= ory-diff.pdf > > 4.4.1 > > The draft supports custom attribute bits in PTE. > > > > Not only it doesn't support custom attributes on PTEs: > > "Bits63=E2=80=9354 are reserved for future standard use and must be zeroe= d by > software for forward compatibility." > > It also goes further to say that: > > "if any of these bits are set, a page-fault exception is raised" Agree, when our processor's mmu works in compatible mmu, we must keep "Bits63=E2=80=9354 bit" zero in Linux. So, I think this is the first version of the PTE format. If the "PBMT" extension proposal is approved, it will cause the second version of the PTE format. Maybe in the future, we'll get more versions of the PTE formats. So, seems Linux must support multi versions of PTE formats with one Image, right? Okay, we could stop arguing with the D1 PTE format. And talk about how to let Linux support multi versions of PTE formats that come from the future RISC-V privilege spec. --=20 Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/