From patchwork Thu Jul 11 05:33:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miles Chen X-Patchwork-Id: 11039281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EFF36C5 for ; Thu, 11 Jul 2019 05:34:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C1862018F for ; Thu, 11 Jul 2019 05:34:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F13328A63; Thu, 11 Jul 2019 05:34:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB4D12018F for ; Thu, 11 Jul 2019 05:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7/BmHyhREo+1biOcpzQLzBT9aPlbQC0kog1XhEpieWY=; b=ZucwaHU5ruiZ3N zVqrTQBrLo4gF7hJSm9oDHLkZ73IjrkVppDZBuAg5PVbtBH2w7XGJy0VK1Yr0JThv+0A7j90LbMa4 L5mE6psGLBLNizl6Dzrpj5r/Ts720qYgI0w2XK1G/oJLgESFal888UJv42ZbouUndSPVQ2DR/XmEN 0VEmFn+lro8JM66RTrmJ5e2eU7d6ZCVqOGpKZ9ifhYhIVMZFhdU7LvkgW0kmKowS7pmLY2yjJfB6q 2ZrtgSRbX0ej7l27/x9ZsE7HJhih0oeNG0jwZ5GnG3Zsn162lppU7mpTl3k1xhOmvQZXjatvjE+NX JT0wxFRM9WZpj6ODfvTw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlRig-0004uJ-AN; Thu, 11 Jul 2019 05:34:14 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlRid-0004ts-MO for linux-mediatek@lists.infradead.org; Thu, 11 Jul 2019 05:34:13 +0000 X-UUID: 9e313e21a7dd42bca0244f69e3e18f3e-20190710 X-UUID: 9e313e21a7dd42bca0244f69e3e18f3e-20190710 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2111104780; Wed, 10 Jul 2019 21:33:47 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 10 Jul 2019 22:33:46 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 11 Jul 2019 13:33:44 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 11 Jul 2019 13:33:44 +0800 From: To: Christoph Hellwig , Marek Szyprowski , Robin Murphy Subject: [PATCH] kernel/dma: export dma_alloc_from_contiguous to modules Date: Thu, 11 Jul 2019 13:33:43 +0800 Message-ID: <20190711053343.28873-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190710_223411_738019_97A2C84E X-CRM114-Status: UNSURE ( 8.20 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miles Chen , iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Miles Chen --- kernel/dma/contiguous.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index b2a87905846d..d5920bdedc77 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -197,6 +197,7 @@ struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, return cma_alloc(dev_get_cma_area(dev), count, align, no_warn); } +EXPORT_SYMBOL_GPL(dma_alloc_from_contiguous); /** * dma_release_from_contiguous() - release allocated pages @@ -213,6 +214,7 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, { return cma_release(dev_get_cma_area(dev), pages, count); } +EXPORT_SYMBOL_GPL(dma_release_from_contiguous); /* * Support for reserved memory regions defined in device tree