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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3441C4743F for ; Mon, 7 Jun 2021 06:27:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91C6E611BD for ; Mon, 7 Jun 2021 06:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbhFGG26 (ORCPT ); Mon, 7 Jun 2021 02:28:58 -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.