Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3289504pxv; Mon, 26 Jul 2021 00:02:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjsCYKT+Uk/lWuj77hEtgtptW6Z6adNYsP0QQ+QZXXgrBusy/hbV2MnR5L2CBt3LU0//eR X-Received: by 2002:a17:906:48c5:: with SMTP id d5mr3434060ejt.553.1627282960427; Mon, 26 Jul 2021 00:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627282960; cv=none; d=google.com; s=arc-20160816; b=FvKJZU2763UKGVlGrV3J2mxAUIDj88Fp5h/ZB25GoFgYjew4Y+wcyGhstnFDRcCOHq gbkONJ1BsSs3xV5Spg5UJXhcBFd3nZ8dqedkQdcqDOeO2uytIVsMglyYPUmbmJCi59sT CWaaLrS0dQOFRu49HAI9LMQdQZP9UdePinZ77va53g5ft3QBlQzo5HU3gWtmVCfRYYOM gcz6ac4q563IkLQaYS5A+gjy7pUaCoqikO63rByy9Zf8/ntquY5KHOVJJZibUUQqAFHx HVYEZ0Wn+GCMr9muElRkYSFBiugT7MMkx6tBJusDZoqTXQjCOFVviQJujhg0hvmFskoy 0DFg== 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=SMdO1KCVdqUZWdLCgH/SuZUAszkR7B0H0UbvCDA8q3k=; b=xqXsKHN5nCOA0GdNAcX/5PQfqNI1d9kbQ849w+sTrEinpYn2FV6W7R00f5ism4HbD/ VkQqn1lsn0bxEJmE3+eSbuSbKQxh9BcyGx/Tg66SR5fVsikOPxdJ/bex+wjZZowi595q oH6waLZbpb9HN2NCj8hK1a+GOwYxnPVG8Nn57MWiQSn3vEFt9Bf6Eim8EiuYETC2HBcc fn5ntvtqQyrjDO2n1FNSQL33spA0BMOt3l4Vw8ynwXBVH0qQ7QcfYMYQHuZ2iuIuwI4e twQBSo2EDK1olL/kXJeYtdHf/v54jiN8RAoQ0tcl9hNMSftjzJPubuCuRXIn3Sual1uZ KJRQ== 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 b18si7111070edw.290.2021.07.26.00.02.18; Mon, 26 Jul 2021 00:02:40 -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 S231725AbhGZGUH (ORCPT + 99 others); Mon, 26 Jul 2021 02:20:07 -0400 Received: from verein.lst.de ([213.95.11.211]:43938 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231570AbhGZGUG (ORCPT ); Mon, 26 Jul 2021 02:20:06 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id DA9D068B05; Mon, 26 Jul 2021 09:00:30 +0200 (CEST) Date: Mon, 26 Jul 2021 09:00:30 +0200 From: Christoph Hellwig To: Atish Patra Cc: linux-kernel@vger.kernel.org, Albert Ou , Christoph Hellwig , devicetree@vger.kernel.org, Dmitry Vyukov , Frank Rowand , Guo Ren , iommu@lists.linux-foundation.org, linux-riscv@lists.infradead.org, Marek Szyprowski , Palmer Dabbelt , Paul Walmsley , Rob Herring , Robin Murphy , Tobias Klauser Subject: Re: [RFC 3/5] dma-mapping: Enable global non-coherent pool support for RISC-V Message-ID: <20210726070030.GB9035@lst.de> References: <20210723214031.3251801-1-atish.patra@wdc.com> <20210723214031.3251801-4-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210723214031.3251801-4-atish.patra@wdc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 23, 2021 at 02:40:29PM -0700, Atish Patra wrote: > Currently, linux,dma-default is used to reserve a global non-coherent pool > to allocate memory for dma operations. This can be useful for RISC-V as > well as the ISA specification doesn't specify a method to modify PMA > attributes or page table entries to define non-cacheable area yet. > A non-cacheable memory window is an alternate options for vendors to > support non-coherent devices. Please explain why you do not want to use the simply non-cachable window support using arch_dma_set_uncached as used by mips, niops2 and xtensa. > +static int __dma_init_global_coherent(phys_addr_t phys_addr, dma_addr_t device_addr, size_t size) > { > struct dma_coherent_mem *mem; > > - mem = dma_init_coherent_memory(phys_addr, phys_addr, size, true); > + if (phys_addr == device_addr) > + mem = dma_init_coherent_memory(phys_addr, device_addr, size, true); > + else > + mem = dma_init_coherent_memory(phys_addr, device_addr, size, false); Nak. The phys_addr != device_addr support is goign away. This needs to be filled in using dma-ranges property hanging of the struct device.