From patchwork Tue Nov 15 10:01:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 82285 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1441279qge; Tue, 15 Nov 2016 02:01:36 -0800 (PST) X-Received: by 10.98.72.81 with SMTP id v78mr45583110pfa.104.1479204096050; Tue, 15 Nov 2016 02:01:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 75si25852495pfv.196.2016.11.15.02.01.35; Tue, 15 Nov 2016 02:01:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966504AbcKOKBe (ORCPT + 4 others); Tue, 15 Nov 2016 05:01:34 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:21092 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965840AbcKOKBc (ORCPT ); Tue, 15 Nov 2016 05:01:32 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGO000X4H6GZ900@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 15 Nov 2016 10:01:28 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161115100128eucas1p112417ab70ac5bcd1d62e3e7e18427cdc~HMEf8xbEA2666826668eucas1p1c; Tue, 15 Nov 2016 10:01:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 5E.31.19540.8FCDA285; Tue, 15 Nov 2016 10:01:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161115100127eucas1p102655ca6a67c33bb9e92c60bba7477a9~HMEfAj2hF0054900549eucas1p1W; Tue, 15 Nov 2016 10:01:27 +0000 (GMT) X-AuditID: cbfec7f5-f79ce6d000004c54-a8-582adcf8c5ae Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 9F.5D.07726.CFCDA285; Tue, 15 Nov 2016 10:01:32 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGO00AS0H67R4A0@eusync2.samsung.com>; Tue, 15 Nov 2016 10:01:27 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joerg Roedel , Inki Dae , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH] iommu/exynos: Fix warnings from DMA-debug Date: Tue, 15 Nov 2016 11:01:09 +0100 Message-id: <1479204069-29552-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWy7djPc7o/7mhFGCxZw2axccZ6VotJ9yew WCzYb23ROXsDu8X580Bixvl9TBZrj9wFsia/ZHPg8HhycB6Tx6ZVnWwek28sZ/To27KK0ePz JrkA1igum5TUnMyy1CJ9uwSujKubmtgL5vFW9ByYx9rA2MfdxcjJISFgIrFzQSMbhC0mceHe eiCbi0NIYCmjxJp3PWAJIYHPjBJnfvjB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YW l+al6yXn525iBAbptmM/N+9gvLQx+BCjAAejEg/vjqOaEUKsiWXFlbmHGCU4mJVEeM2vaUUI 8aYkVlalFuXHF5XmpBYfYjQF2j2RWUo0OR8YQXkl8YYmhuaWhkbGFhbmRkZK4rwlH66ECwmk J5akZqemFqQWwfQxcXBKNTDq3mviPr9BVb3yzGfX1xm1Mj2Giiwnfi/Oa91wO7DTao2o0p4n BzKef/wg7e6UsOv95Nezl6iGKr42lVmUtX3iPJbPT4xXrXUoup+8/vTPq7tqvF941/3vzt91 oysvUyfH8ZF5+XH1V3evPmM8+CiY60wJa9SHRo51LWtL7yeJPfEW/VZQpVuixFKckWioxVxU nAgAI60rNGgCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161115100127eucas1p102655ca6a67c33bb9e92c60bba7477a9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161115100127eucas1p102655ca6a67c33bb9e92c60bba7477a9 X-RootMTR: 20161115100127eucas1p102655ca6a67c33bb9e92c60bba7477a9 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 30808e9..7b0bd86 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -763,6 +763,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); @@ -909,6 +910,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); @@ -920,7 +922,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,