Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3028809pxj; Sun, 6 Jun 2021 23:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ5CbCJunHbLQm5geuGiuc17qO8ISOCXo8ZVmThiPfK+X7n4D1fkt5HcCi2fHdzSFfuoA6 X-Received: by 2002:a17:906:530e:: with SMTP id h14mr16500610ejo.165.1623048173924; Sun, 06 Jun 2021 23:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623048173; cv=none; d=google.com; s=arc-20160816; b=eb+C+t+QEBfUdLxtQlDmh7LbRC8EDYWeMal40lS0/I3e4UiZjBG4xbI1UVfZmVRjk3 ltB8g0QXGkail4i316gkqhK6C8iYApuVUL+0m3KQQvRbJ7q6bjty0XMqwamDz8JxHxaw BbpchEVA+p2HErFi8/l2g7LXqrO7x0v+cDs2mKeqC1NvVPXx9s0u/+6j87mq0jVpC/5t FaiihkUwIc7ghxFHc/rE48jk0aA1MvgEtQOopl9JEH/5Fre9xf0TuNGx2SB1Wp6fD/Qw sTUa5mUjRX38GO8Vb+rGJtGqSkB92XhT9Kf/cdTkdSby1yRXLg+MrHEsKDEq8F45WszM 7UYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=U7937/PwdO1AvzfLR2uAYmLAbh4AE+ucY4HoKVaxmXI=; b=H29fec/oY67t8/b8S76KhJnG+LlfaUfmVXVL227jPE3Y3mtk0V0RJ9oiXIUVdJkFpe g5Zh7AhMAa3twXzpbP7e/AXCTGNGCFHq7EFNXDmVrNiFHCCaXvKDisaodpZ9ptUR7cfc tlAs8p0OWq2L8Yo6F1YZjCDcdt09cHZrSs4ZHvf+oFjBdbwdIn+XWYZtHotrqyKzULeA f5PJLq0jBSatpwx4iScUM01AWzVMdNXyLKKZRvFUqMYsHCqSG28DqVLWegxEZIZ9Aa4p jTqNFOKus1DRk4muXXpP5V24dNCN/ZWFQBSjj8vnANB2dxcAPLoh6DSSsdiFzGtufs+c 2NoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=miti1pGf; 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 j13si6995110edw.136.2021.06.06.23.42.31; Sun, 06 Jun 2021 23:42:53 -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=miti1pGf; 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 S230128AbhFGGnS (ORCPT + 99 others); Mon, 7 Jun 2021 02:43:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:59402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGGnS (ORCPT ); Mon, 7 Jun 2021 02:43:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A7CF26121E; Mon, 7 Jun 2021 06:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623048087; bh=WJHQdy4sxhvqgS0MC5lUqEPV39/gM84OpLAauZzAMsQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=miti1pGf4X8JSTw+5bAKnmC6J/Oj62GADAh/qU5LGizT3e/mguJHZYM/HqQjB9JIC kYOIigfg/o2c0kby0ih2HYmQpm24HYwopDiL3sUY0tLTvmmNznCaAsgxm9GLV4Mbis mZqLvmGJc7YlE5ocLu7KjJC0SKVop1urwUZyAaQHglZKXQnQTyz1DsATFehEIwFyv3 UjfoQ5iT8ItqzGwLGejyyPOHpU5BdHQGHEMs4OdvfqtyUQhg/N/R4GEYNMQJGqzZjk 6UyPivlChb4tunck8+dpZSp+s8/dW/A9h/CokwsPzzfa40Gn2ysp0dFXDHvrn2f+dr 8QEa7lrAA4jAA== Received: by mail-lf1-f51.google.com with SMTP id v22so23103384lfa.3; Sun, 06 Jun 2021 23:41:27 -0700 (PDT) X-Gm-Message-State: AOAM532VbGqkfmPt5AnfBI5y5u/+q90dviPrAoYCGpsKtV2PWb9PpYkw nDdCzppWJfU8BdsjCXxn9l1M57Io8QqyLh+cCjo= X-Received: by 2002:a05:6512:987:: with SMTP id w7mr10846468lft.41.1623048085938; Sun, 06 Jun 2021 23:41:25 -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> <20210607062701.GB24060@lst.de> In-Reply-To: <20210607062701.GB24060@lst.de> From: Guo Ren Date: Mon, 7 Jun 2021 14:41:14 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/3] riscv: Add DMA_COHERENT support To: Christoph Hellwig Cc: Nick Kossifidis , 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 7, 2021 at 2:27 PM Christoph Hellwig wrote: > > 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 Double/Triple the size of physical memory regions can't be accepted by SOC vendors, because it wastes HW resources. Some cost-down soc interconnects only have 32bit~34bit width of physical address, are you sure you could force them to expand it? (I can't) > or somewhat dynamic. How can HW implement with dynamic modifying PMA? What's the granularity? -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/