From patchwork Tue Jan 8 10:12:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhinav X-Patchwork-Id: 13914 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 A6ADA23E2E for ; Tue, 8 Jan 2013 09:50:41 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id 37893A18D3C for ; Tue, 8 Jan 2013 09:50:41 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so174598vba.27 for ; Tue, 08 Jan 2013 01:50:40 -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 :x-brightmail-tracker: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=M22rHscC10q2ks3KGJaUHnJHddSt0/3o9oGfJ+PfHRM=; b=kyFioj50wetldeVknxgyxSr/ZC3+AxCicEXauzvB3evhQ3zuZ6Jl1lxB09Xgp36uyA T2ZwhzAhsPJukJyVv7pvhNOIERwa09RHPZ727BXuGLsqlBr91UGGxXQgh4lUY+kz+uA8 h5ioJyL3XT0iR7/G34Xqc/maYCzltRQ+d7GUHLT2Qo1PLA1uJwO/9iZuHtZxp8sAakCA En9BsrLUs8RcfEpTzdecL9xYbDX9Jahl0fJAisQtNLeNZd7IwdgL4dYRx4CUhMdULpa3 glRAm5BWCOGOxcN8ru5zjNCPDkd5pTOvPpl/sMFpL6ptZ1+u2MrVfSEIKjWsnmqrKfua fITQ== X-Received: by 10.58.247.132 with SMTP id ye4mr89018573vec.9.1357638640680; Tue, 08 Jan 2013 01:50:40 -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.145.101 with SMTP id st5csp101815veb; Tue, 8 Jan 2013 01:50:39 -0800 (PST) X-Received: by 10.204.11.142 with SMTP id t14mr32325667bkt.9.1357638638978; Tue, 08 Jan 2013 01:50:38 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id gc7si108474715bkc.13.2013.01.08.01.50.37; Tue, 08 Jan 2013 01:50:38 -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 1TsVpJ-0006Ga-EV; Tue, 08 Jan 2013 09:50:33 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TsVpI-0006GT-45 for linaro-mm-sig@lists.linaro.org; Tue, 08 Jan 2013 09:50:32 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGA003U3WN1M2O0@mailout4.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 08 Jan 2013 18:50:28 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-2f-50ebebe4d462 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id FE.B8.12699.4EBEBE05; Tue, 08 Jan 2013 18:50:28 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGA0083PWNWF300@mmp2.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 08 Jan 2013 18:50:28 +0900 (KST) From: Abhinav Kochhar To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org Date: Tue, 08 Jan 2013 05:12:24 -0500 Message-id: <1357639944-12050-1-git-send-email-abhinav.k@samsung.com> X-Mailer: git-send-email 1.8.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJJMWRmVeSWpSXmKPExsVy+t9jQd0nr18HGHy9KGTx5cpDJgdGj9v/ HjMHMEZx2aSk5mSWpRbp2yVwZXxbNYOlYCNfxe2TW5gbGJt5uhg5OCQETCRObZXsYuQEMsUk Ltxbz9bFyMUhJDCdUWLu0QMsEM4GJol7E5vZQKrYBHQlzu15ywxiiwjESRxfeYsJZBCzgJHE 4yVgJcICkRKzpx9jB7FZBFQlLp9dBBbnFXCV+HNvCxPEMjmJD3sesU9g5F7AyLCKUTS1ILmg OCk910ivODG3uDQvXS85P3cTI9iDz6R3MK5qsDjEKMDBqMTDeynmdYAQa2JZcWXuIUYJDmYl EV77fUAh3pTEyqrUovz4otKc1OJDjNIcLErivIynngQICaQnlqRmp6YWpBbBZJk4OKUaGM1l z77iupEumB5+SDM+VvbSt6+vCi8v35ZWsKn12BLxNi6/HdySR8JFfv3buZ/PoOiJe4f9+id9 DhcKP5cc9d98kXHin/S1yteMZGcybNG+K1umvuzjzOqdZ/9fr1S4uGWaVmXuNZO1kjyPfot7 HIx6vaUg2eLEiVT1BQw1BYZ3Ki/ejf6RLqfEUpyRaKjFXFScCAADriBb3AEAAA== Cc: inki.dae@samsung.com Subject: [Linaro-mm-sig] [RFC] ARM: dma-mapping: Add DMA attribute to skip iommu mapping 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: ALoCoQnAnRVLTccgTkDvE4d8v9bg0Wmz0un+kf3gRjgzSgPXjtKIJsc97ejSv/ZVOt2Rw58/TiMY Adding a new dma attribute which can be used by the platform drivers to avoid creating iommu mappings. In some cases the buffers are allocated by display controller driver using dma alloc apis but are not used for scanout. Though the buffers are allocated by display controller but are only used for sharing among different devices. With this attribute the platform drivers can choose not to create iommu mapping at the time of buffer allocation and only create the mapping when they access this buffer. Change-Id: I2178b3756170982d814e085ca62474d07b616a21 Signed-off-by: Abhinav Kochhar --- arch/arm/mm/dma-mapping.c | 8 +++++--- include/linux/dma-attrs.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c0f0f43..e73003c 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1279,9 +1279,11 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size, if (!pages) return NULL; - *handle = __iommu_create_mapping(dev, pages, size); - if (*handle == DMA_ERROR_CODE) - goto err_buffer; + if (!dma_get_attr(DMA_ATTR_NO_IOMMU_MAPPING, attrs)) { + *handle = __iommu_create_mapping(dev, pages, size); + if (*handle == DMA_ERROR_CODE) + goto err_buffer; + } if (dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) return pages; diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index c8e1831..1f04419 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h @@ -15,6 +15,7 @@ enum dma_attr { DMA_ATTR_WEAK_ORDERING, DMA_ATTR_WRITE_COMBINE, DMA_ATTR_NON_CONSISTENT, + DMA_ATTR_NO_IOMMU_MAPPING, DMA_ATTR_NO_KERNEL_MAPPING, DMA_ATTR_SKIP_CPU_SYNC, DMA_ATTR_FORCE_CONTIGUOUS,