Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10321684ybi; Thu, 11 Jul 2019 03:25:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXThnC2TGRtiATid8OM6BNbFKH9smS2NyMgShl29ZMv8B/ecZfhj8/EhvKXHMKor+TO6Qp X-Received: by 2002:a63:714a:: with SMTP id b10mr3749493pgn.25.1562840715005; Thu, 11 Jul 2019 03:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562840714; cv=none; d=google.com; s=arc-20160816; b=ki+e147TxwEQH9x594B1j7K5HfhNE6KlZk/4lheLUB6Ez4bDg8RYAMMCMAaUb46cyF I3Sce5P9AxfwOs6Bi5svXAfk6y97PVYLoN4exgVnxhICe92ZuKYbQa5p1jaaPLSmOzzX 7vFPCiUsYmOMIS1AKztx4csjvwCaY2RX6IpKsDJK18CAWc+L3A6TOT0xQiUTE2tZSnA9 CmfKrmdOtrTgKY3R2YjRQmtQqA2SRx5DjsGU+KzHeTCmGKEh4H3NTZHurFC7d8/+XoVh CAbZecrQYIkQILDpZZr0q7hnWMdPXoRKsfX6zCwvrLMk0DVtj8uOoHxyNMEvFPTCA2D7 PVqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1RFtwBv5gneBUykNXWkuvXAveZBYhPCx+QnOsAR0YPk=; b=xHqzx3YRub2ynrmc1EFR8GpVutzgzDZGVSRusiu4WbOAanglv9iWWJFOcCjTARfeog U4QIactccYgkyvp00QjU/a0LepKv9uMfPY/6Exgs3J0XBziBIKfT9a8/MQFakJCVRqiR o+ov7rayMDVU41asrIxI0LkKWVKJc/K06lScuWoCvNoH/0jY+En/dKois5Iyq841Lhya kpjmS5mYrUO3VXDLxO+dm2zM2NWmNBgCSLWzgCTpLHdgiiaiJICCIPz7XFySnIzeosb3 PqBiyRTxqwaY2ggJ4qMtz9fP87e0YqYZseRTxpZcZeilzPwLM9XUqyiH7zCi8UkEgUdS wJvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si4681433plh.59.2019.07.11.03.24.58; Thu, 11 Jul 2019 03:25:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbfGKKDg (ORCPT + 99 others); Thu, 11 Jul 2019 06:03:36 -0400 Received: from verein.lst.de ([213.95.11.211]:56801 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728303AbfGKKDf (ORCPT ); Thu, 11 Jul 2019 06:03:35 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 3471C68B05; Thu, 11 Jul 2019 12:03:33 +0200 (CEST) Date: Thu, 11 Jul 2019 12:03:32 +0200 From: Christoph Hellwig To: Robin Murphy Cc: miles.chen@mediatek.com, Christoph Hellwig , Marek Szyprowski , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, wsd_upstream@mediatek.com, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] kernel/dma: export dma_alloc_from_contiguous to modules Message-ID: <20190711100332.GA5853@lst.de> References: <20190711053343.28873-1-miles.chen@mediatek.com> <7d14b94f-454f-d512-bc8f-589f71bc07ea@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d14b94f-454f-d512-bc8f-589f71bc07ea@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 11, 2019 at 09:50:58AM +0100, Robin Murphy wrote: > On 11/07/2019 06:33, miles.chen@mediatek.com wrote: >> From: Miles Chen >> >> This change exports dma_alloc_from_contiguous and >> dma_release_from_contiguous to modules. >> >> Currently, we can add a reserve a memory node in dts files, make >> it a CMA memory by setting compatible = "shared-dma-pool", >> and setup the dev->cma_area by using of_reserved_mem_device_init_by_idx(). >> >> Export dma_alloc_from_contiguous and dma_release_from_contiguous, so we >> can allocate/free from/to dev->cma_area in kernel modules. > > As far as I understand, this was never intended for drivers to call > directly. If a device has its own private CMA area, then regular > dma_alloc_attrs() should allocate from that automatically; if that's not > happening already, then there's a bug somewhere. Agreed.