From patchwork Mon Jun 17 04:18:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YoungJun Cho X-Patchwork-Id: 2730351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6A5DA9F472 for ; Mon, 17 Jun 2013 04:19:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F0CF20146 for ; Mon, 17 Jun 2013 04:19:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7738020143 for ; Mon, 17 Jun 2013 04:19:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoQun-0007oQ-M1; Mon, 17 Jun 2013 04:19:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoQuk-0004MZ-Ux; Mon, 17 Jun 2013 04:19:34 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UoQuh-0004M0-H4 for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2013 04:19:33 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOI008CKRZC27M0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2013 13:18:57 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.44]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 45.9C.08825.13E8EB15; Mon, 17 Jun 2013 13:18:57 +0900 (KST) X-AuditID: cbfee68e-b7f276d000002279-26-51be8e31dfa5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 22.5B.28381.13E8EB15; Mon, 17 Jun 2013 13:18:57 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOI0092SRZC2P70@mmp2.samsung.com>; Mon, 17 Jun 2013 13:18:56 +0900 (KST) From: YoungJun Cho To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, m.szyprowski@samsung.com Subject: [PATCH] ARM: dma-mapping: Get pages if the cpu_addr is out of atomic_pool Date: Mon, 17 Jun 2013 13:18:52 +0900 Message-id: <1371442732-15088-1-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t8zHV3Dvn2BBus7eC0+Xp7NbHG26Q27 xabH11gtLu+aw2Zx+zKvxdojd9kt9u6czOjA7tHS3MPmsXlJvUdv8zs2j74tqxg9Pm+SC2CN 4rJJSc3JLEst0rdL4Mq4fPsoa8Etropd+5ezNzC+5+hi5OSQEDCROLD5PTOELSZx4d56ti5G Lg4hgWWMEptb3rDAFF1o62YHsYUEpjNKvN7gD2E3M0lcfMUIYrMJaEo8/7iDFcQWEYiROHxw F1g9s0CqxJ9HDWALhAVCJOYePgZUz8HBIqAqsfx3EkiYV8BF4tqjLqhVChIL7r0Fu0FC4Deb xKSl7WwgCRYBAYlvkw+xgPRKCMhKbDoAdbOkxMEVN1gmMAouYGRYxSiaWpBcUJyUXmSkV5yY W1yal66XnJ+7iRESrn07GG8esD7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sIJnL489bRC7musbJbx05r5jLwI+v5nT K/XqtpvRxCY9PX8lluKMREMt5qLiRACQcCxfygIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130617_001931_794256_98E197C0 X-CRM114-Status: GOOD ( 10.10 ) X-Spam-Score: -7.9 (-------) Cc: kyungmin.park@samsung.com, linux-kernel@vger.kernel.org, yj44.cho@samsung.com, hdoyu@nvidia.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In __iommu_get_pages(), the cpu_addr is checked wheather in atomic_pool range or not. So if the cpu_addr is in atomic_pool range, it does not need to check twice. Signed-off-by: YoungJun Cho Signed-off-by: Kyungmin Park --- arch/arm/mm/dma-mapping.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ef3e0f3..1d158c2 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1372,16 +1372,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle, struct dma_attrs *attrs) { - struct page **pages = __iommu_get_pages(cpu_addr, attrs); + struct page **pages; size = PAGE_ALIGN(size); - if (!pages) { - WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); + if (__in_atomic_pool(cpu_addr, size)) { + __iommu_free_atomic(dev, cpu_addr, handle, size); return; } - if (__in_atomic_pool(cpu_addr, size)) { - __iommu_free_atomic(dev, cpu_addr, handle, size); + pages = __iommu_get_pages(cpu_addr, attrs); + if (!pages) { + WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); return; }