From patchwork Mon Sep 2 20:07:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11127029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA4E414E5 for ; Mon, 2 Sep 2019 20:08:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA04D20674 for ; Mon, 2 Sep 2019 20:08:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="i8EIHBME" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727348AbfIBUIE (ORCPT ); Mon, 2 Sep 2019 16:08:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36170 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfIBUIE (ORCPT ); Mon, 2 Sep 2019 16:08:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xqxQuwGBw6IqNxgSm5Uk9jgJRjqBVsfSI8lAUbmGfV4=; b=i8EIHBMEftogkv/Q4l1Z30fTwF wSoRIKc1rZ0/PDqW6fA5cgWNwUrkNbIwUO1CtM6Wggse9XoGsH1g+XRgVJ6D4GzYdcx/+zcEpMBXY Q1s/XqFVuhhfDcVUYZ2a9zywSk+2W48Ffl/4r5ULvh05/+Jz4QKkn+7Ai2FD4mVsMfg/M8IcS+n0S wpeInxH4J2+qaWK7qIldbKIkJZtHp00BMZgo8tjQuhXjFWXpVx53vFvCV8BQEQCjTdqek0DDMzNba qMfyUBAcUk+mPjSsnvzcMamBOfxb9B+85XTAQYlp1mFPSrh0448iNMyd4K8TkigLWYnZCAOa2+BSW 7y+gxiOw==; Received: from [2001:4bb8:18c:1755:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4scL-0007MQ-5U; Mon, 02 Sep 2019 20:08:02 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, Loic Pallardy , Bjorn Andersson Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] dma-mapping: remove dma_release_declared_memory Date: Mon, 2 Sep 2019 22:07:43 +0200 Message-Id: <20190902200746.16185-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902200746.16185-1-hch@lst.de> References: <20190902200746.16185-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org This function is entirely unused given that declared memory is generally provided by platform setup code. Signed-off-by: Christoph Hellwig --- Documentation/DMA-API.txt | 11 ----------- include/linux/dma-mapping.h | 6 ------ kernel/dma/coherent.c | 11 ----------- 3 files changed, 28 deletions(-) diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index e47c63bd4887..c0865ca664b8 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt @@ -595,17 +595,6 @@ For reasons of efficiency, most platforms choose to track the declared region only at the granularity of a page. For smaller allocations, you should use the dma_pool() API. -:: - - void - dma_release_declared_memory(struct device *dev) - -Remove the memory region previously declared from the system. This -API performs *no* in-use checking for this region and will return -unconditionally having removed all the required structures. It is the -driver's job to ensure that no parts of this memory region are -currently in use. - Part III - Debug drivers use of the DMA-API ------------------------------------------- diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 48ebe8295987..165cd61f1c6e 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -753,7 +753,6 @@ static inline int dma_get_cache_alignment(void) #ifdef CONFIG_DMA_DECLARE_COHERENT int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, dma_addr_t device_addr, size_t size); -void dma_release_declared_memory(struct device *dev); #else static inline int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, @@ -761,11 +760,6 @@ dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, { return -ENOSYS; } - -static inline void -dma_release_declared_memory(struct device *dev) -{ -} #endif /* CONFIG_DMA_DECLARE_COHERENT */ static inline void *dmam_alloc_coherent(struct device *dev, size_t size, diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 29fd6590dc1e..7271cda86a37 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -124,17 +124,6 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, } EXPORT_SYMBOL(dma_declare_coherent_memory); -void dma_release_declared_memory(struct device *dev) -{ - struct dma_coherent_mem *mem = dev->dma_mem; - - if (!mem) - return; - dma_release_coherent_memory(mem); - dev->dma_mem = NULL; -} -EXPORT_SYMBOL(dma_release_declared_memory); - static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem, ssize_t size, dma_addr_t *dma_handle) { From patchwork Mon Sep 2 20:07:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11127031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0495114E5 for ; Mon, 2 Sep 2019 20:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D61F720674 for ; Mon, 2 Sep 2019 20:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eR12wCXr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727380AbfIBUIJ (ORCPT ); Mon, 2 Sep 2019 16:08:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36188 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfIBUIJ (ORCPT ); Mon, 2 Sep 2019 16:08:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LdVrxkL37VTklHgUT3hBqRPwtefR2ZTRSxffxyS1bNQ=; b=eR12wCXrzskT5yKF1EtGfMTIMC vZO29ISsn2SsgNgCKOVf61BsrSaQD1/XVR6ffJvy77NmG9RyMaLCYU673eUuzIxBnDM7iPvPkgDek V1Jh6CGzMVA880f+FelEGBscMWDTL5BLMmEEtdykAixCnjvEosgvRe9ElmCO23oBab9pvPtm3aPbn nKMXn6TP57hSjzkFNg9HndaaQsZAd4xVPO9Hj/1jWHlJAGOFCVD+1XFqgNA6qKn5dyZZacAtfNtBD fMLLoRFGC6/uJ6zUcYJVvn9NnFqsm8B07tqEQHsf/O8ZNQrrmJUbHDA6Nc0MU4WzWbJy2nPqkqT95 JzuhOtgw==; Received: from [2001:4bb8:18c:1755:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4scQ-0007Mi-SU; Mon, 02 Sep 2019 20:08:07 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, Loic Pallardy , Bjorn Andersson Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] dma-mapping: remove the dma_mmap_from_dev_coherent export Date: Mon, 2 Sep 2019 22:07:44 +0200 Message-Id: <20190902200746.16185-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902200746.16185-1-hch@lst.de> References: <20190902200746.16185-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org dma_mmap_from_dev_coherent is only used by dma_map_ops instances, none of which is modular. Signed-off-by: Christoph Hellwig --- kernel/dma/coherent.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 7271cda86a37..7cafe1affdc9 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -277,7 +277,6 @@ int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, return __dma_mmap_from_coherent(mem, vma, vaddr, size, ret); } -EXPORT_SYMBOL(dma_mmap_from_dev_coherent); int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *vaddr, size_t size, int *ret) From patchwork Mon Sep 2 20:07:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11127033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B1FA1399 for ; Mon, 2 Sep 2019 20:08:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B55020674 for ; Mon, 2 Sep 2019 20:08:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JZ522zUF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727410AbfIBUIP (ORCPT ); Mon, 2 Sep 2019 16:08:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36206 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfIBUIP (ORCPT ); Mon, 2 Sep 2019 16:08:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=g/QEi3hgO0OyJQXGaAxJfuvSnqiwwXoSBsm20nYl6ts=; b=JZ522zUFE4TgteT9cqAHTzLL4/ Eba+EGf6i8+nT+sXzDuwc5W20Wib2GPh1/YlDsLjqiNAivFibqLLoYxPz9ZPqxjhVyPeb6avIdBR0 0ktWpSkpCEfEs0ik8IyeahsMmFZNvCPFW/IrWmqnMbR0/VNUMWhdC93XuKURqCkZsj5mFPa4AUm1k VDApvx/jIHwOx81BWF8+EgCn0tb7w9lhjXeCvHxj5q6yZZ9eXFX9wy/UQCgxBCsX0J2p9Ydf/GhT3 symQlhobm+sUAHspQceXdlS0SVgnyKSyujk4o+aUklEGt9I/8qlbNxAPOEvix+YpPf6JsEI7Z+7/R 44xFd5uw==; Received: from [2001:4bb8:18c:1755:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4scW-0007Ni-OQ; Mon, 02 Sep 2019 20:08:13 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, Loic Pallardy , Bjorn Andersson Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] remoteproc: don't allow modular build Date: Mon, 2 Sep 2019 22:07:45 +0200 Message-Id: <20190902200746.16185-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902200746.16185-1-hch@lst.de> References: <20190902200746.16185-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Remoteproc started using dma_declare_coherent_memory recently, which is a bad idea from drivers, and the maintainers agreed to fix that. But until that is fixed only allow building the driver built in so that we can remove the dma_declare_coherent_memory export and prevent other drivers from "accidentally" using it like remoteproc. Note that the driver would also leak the declared coherent memory on unload if it actually was built as a module at the moment. Signed-off-by: Christoph Hellwig Reviewed-by: Bjorn Andersson --- drivers/remoteproc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 28ed306982f7..94afdde4bc9f 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -2,7 +2,7 @@ menu "Remoteproc drivers" config REMOTEPROC - tristate "Support for Remote Processor subsystem" + bool "Support for Remote Processor subsystem" depends on HAS_DMA select CRC32 select FW_LOADER From patchwork Mon Sep 2 20:07:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11127035 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BABF14E5 for ; Mon, 2 Sep 2019 20:08:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BB6722DBF for ; Mon, 2 Sep 2019 20:08:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IKK7dOAU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727188AbfIBUIV (ORCPT ); Mon, 2 Sep 2019 16:08:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36224 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfIBUIU (ORCPT ); Mon, 2 Sep 2019 16:08:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BVNq47HXj2pt+zogEJG8nkEiH0l4/wH9jA+1tCZXI6w=; b=IKK7dOAUG6pwQ3QFcv9Q2x3ZUH zOxu0VV1ODcT6ycsRhGaL+MdqFJ01nNbP+4sqBmq5bM29wdnYvaIABqI6YxK58JfVVNG2KhxBbqQK XPkkhiI+gfs7TMrLKbB6Ba7JliUxN20U6GoWVZhqEFfe3+GEJ2zTrkLwNEQDgcemLy63W+bI8zMvF bLTvdnpWAYqzHN1ws/GsnN/cPWtw8y0I7E1I/p8LDh73tt7L2WNkvP1gE4BJL0jciVjdmLL1Jsz+j UThFdNhTBiUCzaxg6co3+rfiWR4B05AkSdBR0XGwMCeakPNbl4RdnNcNrwM1aqNvdoFw3H2iCKH9j Jtw4ezfw==; Received: from [2001:4bb8:18c:1755:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4scc-0007Od-Gn; Mon, 02 Sep 2019 20:08:19 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org, Loic Pallardy , Bjorn Andersson Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] dma-mapping: remove the dma_declare_coherent_memory export Date: Mon, 2 Sep 2019 22:07:46 +0200 Message-Id: <20190902200746.16185-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902200746.16185-1-hch@lst.de> References: <20190902200746.16185-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org dma_declare_coherent_memory is something that the platform setup code (which pretty much means the device tree these days) need to do so that drivers can use the memory as declared by the platform. Drivers themselves have no business calling this function. Signed-off-by: Christoph Hellwig --- kernel/dma/coherent.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 7cafe1affdc9..545e3869b0e3 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -122,7 +122,6 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, dma_release_coherent_memory(mem); return ret; } -EXPORT_SYMBOL(dma_declare_coherent_memory); static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem, ssize_t size, dma_addr_t *dma_handle)