From patchwork Wed Feb 6 04:21:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seung-Woo Kim X-Patchwork-Id: 14577 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 63D9623F8B for ; Wed, 6 Feb 2013 04:59:22 +0000 (UTC) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by fiordland.canonical.com (Postfix) with ESMTP id D2943A1855D for ; Wed, 6 Feb 2013 04:59:21 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id d16so607212vcd.12 for ; Tue, 05 Feb 2013 20:59:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:date:message-id:x-mailer:in-reply-to :references:x-brightmail-tracker:x-brightmail-tracker:dlp-filter :x-mtr:x-cfilter-loop:x-mailman-approved-at:cc:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=pz6iW86xpskOSKas6xW44eeVXqD7W9CQGCOkemcc54M=; b=GbnGnL8JcJUIsonHbqRpPk0SxlIZwinJvlr5clx7383XqVB5YmppXDWwR02fB5ADft eNWP3oXJtI0uGH+RZzNak28qA/47mXrLtNU9Eee7bbyzD0aURKdD+5Z9CYkzBHk9MPTS icJ78/vUpa3Yoi+pcYoAW3vdIH74NyoC1Bx1k0OYec41PfucF7rrXbrlhLW7u/HgHnOH oC3pykgrP7GnBHWcuaZs5VGYmt8wCtPxZyBW1HybbhiT+fBK9NchkDkGdyjV+lAi3BpB uQQWC/SioWna2py42UFj/Rvna8vulK8H2LWP0e1jUMQSyFXW1PkojfK1tYNfSY5IejhJ lV6A== X-Received: by 10.58.8.82 with SMTP id p18mr27014098vea.54.1360126758062; Tue, 05 Feb 2013 20:59:18 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp520vec; Tue, 5 Feb 2013 20:59:17 -0800 (PST) X-Received: by 10.204.157.152 with SMTP id b24mr7171950bkx.92.1360126756348; Tue, 05 Feb 2013 20:59:16 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id fw18si16437792bkc.33.2013.02.05.20.59.09; Tue, 05 Feb 2013 20:59:16 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U2x68-00067q-5U; Wed, 06 Feb 2013 04:59:04 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U2wW9-0004bZ-Er for linaro-mm-sig@lists.linaro.org; Wed, 06 Feb 2013 04:21:53 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MHS001WH6S9ZCH0@mailout4.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 06 Feb 2013 13:21:49 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.42]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F2.3E.03918.D5AD1115; Wed, 06 Feb 2013 13:21:49 +0900 (KST) X-AuditID: cbfee61a-b7f7d6d000000f4e-25-5111da5d5ea4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 62.3E.03918.D5AD1115; Wed, 06 Feb 2013 13:21:49 +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 <0MHS00E2J6QZ6W90@mmp2.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 06 Feb 2013 13:21:49 +0900 (KST) From: Seung-Woo Kim To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org Date: Wed, 06 Feb 2013 13:21:14 +0900 Message-id: <1360124474-16636-1-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1360116403-14112-1-git-send-email-sw0312.kim@samsung.com> References: <1360116403-14112-1-git-send-email-sw0312.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t8zLd3YW4KBBr83WVl8ufKQyYHR4/a/ x8wBjFFcNimpOZllqUX6dglcGbfn/GMu+CVQ8XLVOqYGxuu8XYycHBICJhLrnn1lgbDFJC7c W8/WxcjFISSwjFFi+e87rDBFvfO2MUEkpjNKbLn2nBGqikniz6njYFVsAjoS+5f8BrNFBDwk nqw4xwxiMwtkSnyasIIdxBYWiJNYOfc10DoODhYBVYkpe4JAwrwCbhIb/q9mg1imILHg3lsw m1PAXWLH1TNg1wkB1fScuc8MsldC4DqbxLOfD8ASLAICEt8mHwKbKSEgK7HpADPEHEmJgytu sExgFF7AyLCKUTS1ILmgOCk911CvODG3uDQvXS85P3cTIyQIpXYwrmywOMQowMGoxMN7Q08w UIg1say4MvcQowQHs5IIr8I2oBBvSmJlVWpRfn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Fwmr8RSnJFoqMVcVJwIAEcx 2Va1AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 06 Feb 2013 04:59:03 +0000 Cc: sw0312.kim@samsung.com, kyungmin.park@samsung.com, linux@arm.linux.org.uk Subject: [Linaro-mm-sig] [RESEND][PATCH] ARM: dma-mapping: Add maximum alignment order for dma iommu buffers X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQnqOVJaSSH78rDIpTUNOQzvfYPDnidHSim06OOlzq86aEu7IyV0BfBH85Msc2floWjmyDlD Alignment order for a dma iommu buffer is set by buffer size. For large buffer, it is a waste of iommu address space. So configurable parameter to limit maximum alignment order can reduce the waste. Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin.park --- There was stupid misses in previous patch, so I resend fixed version. arch/arm/Kconfig | 21 +++++++++++++++++++++ arch/arm/mm/dma-mapping.c | 3 +++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 67874b8..4e89112 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -75,6 +75,27 @@ config ARM_DMA_USE_IOMMU select ARM_HAS_SG_CHAIN select NEED_SG_DMA_LENGTH +if ARM_DMA_USE_IOMMU + +config ARM_DMA_IOMMU_ALIGNMENT + int "Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers" + range 4 9 + default 8 + help + DMA mapping framework by default aligns all buffers to the smallest + PAGE_SIZE order which is greater than or equal to the requested buffer + size. This works well for buffers up to a few hundreds kilobytes, but + for larger buffers it just a waste of address space. Drivers which has + relatively small addressing window (like 64Mib) might run out of + virtual space with just a few allocations. + + With this parameter you can specify the maximum PAGE_SIZE order for + DMA IOMMU buffers. Larger buffers will be aligned only to this + specified order. The order is expressed as a power of two multiplied + by the PAGE_SIZE. + +endif + config HAVE_PWM bool diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 076c26d..4cce854 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1002,6 +1002,9 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, unsigned int count, start; unsigned long flags; + if (order > CONFIG_ARM_DMA_IOMMU_ALIGNMENT) + order = CONFIG_ARM_DMA_IOMMU_ALIGNMENT; + count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order;