Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3022110pxj; Sun, 6 Jun 2021 23:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySdWQL2N61XJ/c9HRwdet5Z7rdvEBhifl9stUb1xr1Fk0zy3eoWzM1ttN945/xj1hK4BFC X-Received: by 2002:aa7:c6c2:: with SMTP id b2mr18747937eds.8.1623047306501; Sun, 06 Jun 2021 23:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623047306; cv=none; d=google.com; s=arc-20160816; b=npSx7veuiw2MIH3DQPEfbMshJ1DLayn9suiSHnBvYwl6ZVpUFTfG9/ex09K0BPYPo2 VJK4l/SIFvQeNujnf0IOAkL3+KacdNW3sO5fAG6Fvwn4Rl/WlP8p28vzaIUch2rH65ri cJiCnjl1kw1RqGUCeTFetjE/acxRUmR1Id/t12s49ouUPWswWIu3KFpMj6fMh30idSUG BfNs1i+2ujDm52xArffs+YZzWxXcWyXm2wSgiEc8X1fEYvokrDmCCKBm23nXWBLffyoI T3JGdyLptiA3FSHH22A0nmZohAAPWBzeywND4jHJcU4ARBWgeGQVgJ48/5EzS53fX68I w0rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=OFrBrHnOmv3+ZY8+0ljBl6C8PP0ijk/lZQ3wBqfFQY4=; b=y4RBssRdfI30ZJ1B/uKne03FT7DS+Ug2jQHtnf/yUuOJyzU52/Hu+KguSz7VjG2ARL WKfHngYzcUHrscgSdvZHS/WTLbHiIscT9/q7WPzAVkGhUACeJoMZkQ8cPchOVpXrOd+r 9QnjDln7tzswPUT7szav+Dlj0rQL/Z0+aB0YzaufF4VckzAW2hiD5E77/3s/HkzaFtGC stO6h6u1VAyUEQaAPk1tLiC6zeO0eytuZ/PqnQBjAVycOr8rIph25fiPe7NoHuO8UA9n kc2XNs/ApNdQ5K+y57GMR4E+A7/BbHsDg98UyQyZgCoHAX+BcSzE0YKG3Wts9LOvKtrs vxKg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si13059572edq.46.2021.06.06.23.28.04; Sun, 06 Jun 2021 23:28:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbhFGG25 (ORCPT + 99 others); Mon, 7 Jun 2021 02:28:57 -0400 Received: from verein.lst.de ([213.95.11.211]:44507 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGG2z (ORCPT ); Mon, 7 Jun 2021 02:28:55 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 3212967373; Mon, 7 Jun 2021 08:27:01 +0200 (CEST) Date: Mon, 7 Jun 2021 08:27:01 +0200 From: Christoph Hellwig To: Guo Ren Cc: Nick Kossifidis , Christoph Hellwig , Drew Fustini , Anup Patel , Palmer Dabbelt , wefu@redhat.com, Wei Wu =?utf-8?B?KOWQtOS8nyk=?= , linux-riscv , Linux Kernel Mailing List , linux-arch , linux-sunxi@lists.linux.dev, Guo Ren , Paul Walmsley , Benjamin Koch , Matteo Croce , Wei Fu Subject: Re: [PATCH RFC 0/3] riscv: Add DMA_COHERENT support Message-ID: <20210607062701.GB24060@lst.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 11:19:03AM +0800, Guo Ren wrote: > >From Linux non-coherency view, we need: > - Non-cache + Strong Order PTE attributes to deal with drivers' DMA descriptors > - Non-cache + weak order to deal with framebuffer drivers > - CMO dma_sync to sync cache with DMA devices This is not strictly true. At the very minimum you only need cache invalidation and writeback instructions. For example early parisc CPUs and some m68knommu SOCs have no support for uncached areas at all, and Linux works. But to be fair this is very painful and supports only very limited periphals. So for modern full Linux support some uncahed memory is advisable. But that doesn't have to be using PTE attributes. It could also be physical memory regions that are either totally fixed or somewhat dynamic.