From patchwork Thu Nov 24 11:20:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9445245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9097660778 for ; Thu, 24 Nov 2016 11:20:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C61627D76 for ; Thu, 24 Nov 2016 11:20:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71C7827E78; Thu, 24 Nov 2016 11:20:47 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D7DA27D7F for ; Thu, 24 Nov 2016 11:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965086AbcKXLUk (ORCPT ); Thu, 24 Nov 2016 06:20:40 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:35258 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964851AbcKXLUj (ORCPT ); Thu, 24 Nov 2016 06:20:39 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OH500L408U38N00@mailout4.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 24 Nov 2016 20:20:37 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-04-5836cd053258 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 46.89.25310.50DC6385; Thu, 24 Nov 2016 20:20:37 +0900 (KST) Received: from AMDC2765.digital.local ([106.116.147.25]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OH500D6Y8U00G70@mmp1.samsung.com>; Thu, 24 Nov 2016 20:20:37 +0900 (KST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 2/5] iommu/exynos: Fix warnings from DMA-debug Date: Thu, 24 Nov 2016 12:20:17 +0100 Message-id: <1479986420-30859-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1479986420-30859-1-git-send-email-m.szyprowski@samsung.com> References: <1479986420-30859-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsVy+t9jAV3Ws2YRBg3TNCw2zljParFgv7VF 5+wN7BbnzwOJGef3MVmsPXKX3YHN48nBeUwem1Z1snlMvrGc0aNvyypGj8+b5AJYo9xsMlIT U1KLFFLzkvNTMvPSbZVCQ9x0LZQU8hJzU22VInR9Q4KUFMoSc0qBPCMDNODgHOAerKRvl+CW sX/mWdaCFbwV33a3szUwzuDuYuTgkBAwkXjYE9rFyAlkiklcuLeerYuRi0NIYCmjxKo5H1gh nF+MErNnP2EEqWITMJToetvFBmKLCLhLXP/znAWkiFlgA6PEuhkTmEESwgJ2Eg0vVzGB2CwC qhLPpt8Ca+YV8JB4fuE6E8Q6OYmTxyazgticAp4S0zf2s4DYQkA1F1a9ZZzAyLuAkWEVo0Rq QXJBcVJ6rmFearlecWJucWleul5yfu4mRnAgP5PawXhwl/shRgEORiUe3gdmZhFCrIllxZW5 hxglOJiVRHgNTgGFeFMSK6tSi/Lji0pzUosPMZoCHTaRWUo0OR8YZXkl8YYm5ibmxgYW5paW JkZK4ryNs5+FCwmkJ5akZqemFqQWwfQxcXBKNTDuPPBj7c5PTlMSAtZqWrx8czyj0MI4cHJW 65HTc3fsFDv1amGGdCx75aXDb1lmC6znblz0oyzWssbwxSWr+/u+alzOlrxU6cy8QHviGs3O +SU7N+qferb1WKbp2X+P8z+cn8QdwPpCTnbzffO8ylttq/QXK3GrbrLZoTeNW1qS2c7+Pdc9 2c75SizFGYmGWsxFxYkAPeSbBnoCAAA= X-MTR: 20000000000000000@CPGS Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a simple checks for dma_map_single() return value to make DMA-debug checker happly. Exynos IOMMU on Samsung Exynos SoCs always use device, which has linear DMA mapping ops (dma address is equal to physical memory address), so no failures are returned from dma_map_single(). Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index ac726e1760de..e7851cffbbee 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -744,6 +744,7 @@ static struct iommu_domain *exynos_iommu_domain_alloc(unsigned type) DMA_TO_DEVICE); /* For mapping page table entries we rely on dma == phys */ BUG_ON(handle != virt_to_phys(domain->pgtable)); + BUG_ON(dma_mapping_error(dma_dev, handle)); spin_lock_init(&domain->lock); spin_lock_init(&domain->pgtablelock); @@ -898,6 +899,7 @@ static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain, } if (lv1ent_fault(sent)) { + dma_addr_t handle; sysmmu_pte_t *pent; bool need_flush_flpd_cache = lv1ent_zero(sent); @@ -909,7 +911,9 @@ static sysmmu_pte_t *alloc_lv2entry(struct exynos_iommu_domain *domain, update_pte(sent, mk_lv1ent_page(virt_to_phys(pent))); kmemleak_ignore(pent); *pgcounter = NUM_LV2ENTRIES; - dma_map_single(dma_dev, pent, LV2TABLE_SIZE, DMA_TO_DEVICE); + handle = dma_map_single(dma_dev, pent, LV2TABLE_SIZE, + DMA_TO_DEVICE); + BUG_ON(dma_mapping_error(dma_dev, handle)); /* * If pre-fetched SLPD is a faulty SLPD in zero_l2_table,