From patchwork Thu Sep 13 15:17:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10599739 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 79F2D14E5 for ; Thu, 13 Sep 2018 15:19:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 626A52B0FB for ; Thu, 13 Sep 2018 15:19:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56CB42B0FD; Thu, 13 Sep 2018 15:19:59 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 A27F62B0FB for ; Thu, 13 Sep 2018 15:19:58 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=dqhOfNVQkehcgJf9bE1Bias5vMvw92/rPVE2z8m8CR4=; b=kUUSnQ509JtsOd27kZ96cswAlc 6DYIyjH8ZrKoLq87FSwPJkaT+n2tiIWFryhB6M9QNgWhx8Qt1TfOW+590Ybq6GMr3AT3DeEq6KIW9 Z4qKejhTpjQnR43yiKhP+7ika8lAKIMXvKKG+SKRiTiYrJym42WgDju3o19E6Sgxiwby9dXapXm3c PtznQjK8+nSrQ73LjUsosw7iZsvfpzWgZPi/t0Ny3Jgn0U8VkMDqmFgVaO1cIQATDio6E7utg7Ar9 ehZWhpXKCeW3UJFat6ACS7yumvhOb739QdtHw7JJbfvL07/vW2bshLoL+7Lmg4C4ycQsXrkNzfCAF Kv8azYOA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TPI-0001NY-OJ; Thu, 13 Sep 2018 15:19:48 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TNF-0007sc-6e for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2018 15:17:44 +0000 Received: from localhost (p54B3335A.dip0.t-ipconnect.de [84.179.51.90]) by pokefinder.org (Postfix) with ESMTPSA id EB10D2CF60B; Thu, 13 Sep 2018 17:17:24 +0200 (CEST) From: Wolfram Sang To: iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig Subject: [RFC PATCH 1/3] ARM: dma-mapping: update comment about handling dma_ops when detaching from IOMMU Date: Thu, 13 Sep 2018 17:17:14 +0200 Message-Id: <20180913151716.6333-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> References: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180913_081741_408726_5AC3DE9B X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Update the comment because we don't set the pointer to NULL anymore. Also use the correct pointer name 'dma_ops' instead of 'dma_map_ops'. Fixes: 1874619a7df4 ("ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()") Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- arch/arm/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 66566472c153..e3b04786838f 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2287,7 +2287,7 @@ EXPORT_SYMBOL_GPL(arm_iommu_attach_device); * @dev: valid struct device pointer * * Detaches the provided device from a previously attached map. - * This voids the dma operations (dma_map_ops pointer) + * This overwrites the dma_ops pointer with appropriate non-IOMMU ops. */ void arm_iommu_detach_device(struct device *dev) { From patchwork Thu Sep 13 15:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10599735 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 1F9C114E5 for ; Thu, 13 Sep 2018 15:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 076122B0F6 for ; Thu, 13 Sep 2018 15:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF5BD2B0F8; Thu, 13 Sep 2018 15:18:33 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 7A55B2B0F6 for ; Thu, 13 Sep 2018 15:18:33 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=/dohEwordoObYj9knpZnYxY2m1N6UVNsdJtqMkh7oNU=; b=TivYvBvflkvdB/8rWH2pt1QuKr CqXZwYQWlfO9ILtGKm5ogP7kNlbKeMtuPRR1C2ek/oXgimA32bsuKY2bLOjB6DUONTl5tfBjQkdQy 0hlRMyHI7y7+9yw/tCjJr2x1V/324Y5IPNt+0S2fBaLF4w0IomAzcNARUXPszgQ4Ulfp0u1piAh6a v+lxNIzIzIozmQv8Ux7hu8QFOP+K4iYTHmsteDCt0eBWg/d6s88n8fQr7yYVR0yliuW7UapZQ/C3o M7ePxgsBfzNo1cxvOafTNlukUZUS9tnA5JAcOARBEaydBdJiY59SeNInKn07en0MAptqyX8SGU2rG g0y+ZvSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TNt-0000mK-CH; Thu, 13 Sep 2018 15:18:21 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TNE-0007sd-3A for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2018 15:17:42 +0000 Received: from localhost (p54B3335A.dip0.t-ipconnect.de [84.179.51.90]) by pokefinder.org (Postfix) with ESMTPSA id 8D4D62CF689; Thu, 13 Sep 2018 17:17:25 +0200 (CEST) From: Wolfram Sang To: iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig Subject: [RFC PATCH 2/3] dma-mapping: clear dma_ops pointer also on ARM Date: Thu, 13 Sep 2018 17:17:15 +0200 Message-Id: <20180913151716.6333-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> References: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180913_081740_320001_B973F971 X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The generic fallback of arch_teardown_dma_ops() clears the dma_ops pointer but the ARM specific version does not. Rename the generic one, so it can be called from ARM specific one, too. This will ensure consistent behaviour. Signed-off-by: Wolfram Sang --- arch/arm/mm/dma-mapping.c | 6 +++--- include/linux/dma-mapping.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e3b04786838f..466b0242e8af 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2396,8 +2396,8 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, void arch_teardown_dma_ops(struct device *dev) { - if (!dev->archdata.dma_ops_setup) - return; + if (dev->archdata.dma_ops_setup) + arm_teardown_iommu_dma_ops(dev); - arm_teardown_iommu_dma_ops(dev); + generic_teardown_dma_ops(dev); } diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index eafd6f318e78..020512cb7f0e 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -663,11 +663,12 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, bool coherent) { } #endif -#ifndef arch_teardown_dma_ops -static inline void arch_teardown_dma_ops(struct device *dev) +static inline void generic_teardown_dma_ops(struct device *dev) { dev->dma_ops = NULL; } +#ifndef arch_teardown_dma_ops +#define arch_teardown_dma_ops generic_teardown_dma_ops #endif static inline unsigned int dma_get_max_seg_size(struct device *dev) From patchwork Thu Sep 13 15:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10599737 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 94B4D14F9 for ; Thu, 13 Sep 2018 15:19:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D53B2B0F8 for ; Thu, 13 Sep 2018 15:19:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 704C92B0FA; Thu, 13 Sep 2018 15:19:24 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 2F5EA2B0F8 for ; Thu, 13 Sep 2018 15:19:23 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=f90T/pddiT8HIxT7qv7Vnh1eQ0YuaiZ68wx+zXi4W2g=; b=PUl4aM1kbqhfh3HgJRq+CzCG4Q 10LKCm32YtsIM4vKQbp9Qf5FwERmVX3k4jN/DXmVsCWnfSLHVfyVC1FVHqzoUJMZUk23t1sDvYT1O mHC02asWoSdXznEbrWzVkipZYIkhyYqwEBsBF9Rd+te4OS1ATw/wMqOfj6in95nRLeNgJ/25fYHbY UT5TYb4eKsxGA2RALqryGVkpah3Zxbc89+3s5pYpNmdPeUdR0xrCKkvXt71yEowvRGHjej0TEhCc6 N4mGnThCwJZRqxHAeuQWr04qbGFw7JNYnEL4B8Czek9fF9xuOEafTtMOqtblBEmpELaH5qB1pz+d+ 7rCJEdqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TOd-00016f-Oh; Thu, 13 Sep 2018 15:19:07 +0000 Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0TNF-0007sm-6d for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2018 15:17:44 +0000 Received: from localhost (p54B3335A.dip0.t-ipconnect.de [84.179.51.90]) by pokefinder.org (Postfix) with ESMTPSA id 2B8B42CF688; Thu, 13 Sep 2018 17:17:26 +0200 (CEST) From: Wolfram Sang To: iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig Subject: [RFC PATCH 3/3] dma-mapping: clear dma_parms on teardown, too Date: Thu, 13 Sep 2018 17:17:16 +0200 Message-Id: <20180913151716.6333-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> References: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180913_081741_418773_93430021 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP While sanitizig the pointer for dma_ops on teardown, do the same for dma_parms, too. Rename the function to have a more generic name. Signed-off-by: Wolfram Sang --- arch/arm/mm/dma-mapping.c | 2 +- include/linux/dma-mapping.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 466b0242e8af..bcf77bc0423f 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2399,5 +2399,5 @@ void arch_teardown_dma_ops(struct device *dev) if (dev->archdata.dma_ops_setup) arm_teardown_iommu_dma_ops(dev); - generic_teardown_dma_ops(dev); + generic_teardown_dma(dev); } diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 020512cb7f0e..6a2d8779b1d8 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -663,12 +663,13 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, bool coherent) { } #endif -static inline void generic_teardown_dma_ops(struct device *dev) +static inline void generic_teardown_dma(struct device *dev) { dev->dma_ops = NULL; + dev->dma_parms = NULL; } #ifndef arch_teardown_dma_ops -#define arch_teardown_dma_ops generic_teardown_dma_ops +#define arch_teardown_dma_ops generic_teardown_dma #endif static inline unsigned int dma_get_max_seg_size(struct device *dev)