From patchwork Wed Jun 13 11:50:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9263 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 1BAC023E53 for ; Wed, 13 Jun 2012 11:51:11 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id C974EA184CC for ; Wed, 13 Jun 2012 11:51:10 +0000 (UTC) Received: by yhpp61 with SMTP id p61so433056yhp.11 for ; Wed, 13 Jun 2012 04:51:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml: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=NCMRzaqDPl8HpgBbIYezcKo3r455MQo9YbFmbHNwgnk=; b=fpS/4I9qUyZaMLiCbwP2VXks9NL1CnbhDaMyWHSTkGvWy73HGFu+QvbNZswpWKI8hP l3TOaqTcljKrBD1sHBFHdU9jItWKOo2a7NUWaVvatiga+Zg4oeVJnUs5/ypAJEAAM15V XPCfaYxplKp6ulSfX6EcWpDsin6FtQGDK634zhCg3G0cDikHSU+CJ8ekGhKMyERzGvFg /oDKCAkGCy5wAfPMNbW0p1qmKcE7rKZag4PnvJBI51o+Y99lWXhThmvitXdcYYPjQiuR ewhG+3HsDwkwPSaVnW2hueuPlFQBWLsrrcaR6jUTGdXNIy+U5blDEOpZ+8wl8xHq3SVk H7/g== Received: by 10.50.40.193 with SMTP id z1mr10351926igk.0.1339588269785; Wed, 13 Jun 2012 04:51:09 -0700 (PDT) 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.231.24.148 with SMTP id v20csp18051ibb; Wed, 13 Jun 2012 04:51:07 -0700 (PDT) Received: by 10.204.150.76 with SMTP id x12mr12914449bkv.97.1339588266819; Wed, 13 Jun 2012 04:51:06 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id gi18si1366749bkc.73.2012.06.13.04.51.04; Wed, 13 Jun 2012 04:51:06 -0700 (PDT) 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 1Sem6G-00007H-4q; Wed, 13 Jun 2012 11:51:00 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Sem6D-00004y-0e for linaro-mm-sig@lists.linaro.org; Wed, 13 Jun 2012 11:50:58 +0000 Received: from epcpsbgm2.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M5K00E3Z0WAVTE0@mailout2.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 13 Jun 2012 20:50:53 +0900 (KST) X-AuditID: cbfee61b-b7fcc6d000003a7a-e2-4fd87e9d97ae Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 80.95.14970.D9E78DF4; Wed, 13 Jun 2012 20:50:53 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M5K00JMG0WB4X70@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 13 Jun 2012 20:50:53 +0900 (KST) From: Marek Szyprowski To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 13 Jun 2012 13:50:13 +0200 Message-id: <1339588218-24398-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1339588218-24398-1-git-send-email-m.szyprowski@samsung.com> References: <1339588218-24398-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jAd25dTf8DWYdlrP4cuUhkwOjx+1/ j5kDGKO4bFJSczLLUov07RK4MpY9u8VUMF24YslijQbGGQJdjJwcEgImEsuuHmOCsMUkLtxb z9bFyMUhJLCIUWLn8RMsEM5aJolHX5eyglSxCRhKdL3tYgOxRQRmMErs6ksDKWIW2Mci0bn5 BCNIQlggTOJ/Vwc7iM0ioCrxZ/YRsGZeAQ+JH9vvQ62Tl3h6vw9sEKeAp8TvZ/vA4kJANb+n HWaewMi7gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkaw159J72Bc1WBxiFGAg1GJhzcD GAxCrIllxZW5hxglOJiVRHifZQOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8zZZX/AXEkhPLEnN Tk0tSC2CyTJxcEo1MLozOtrtasvcpy5vMe+e86K6SQm6/9ul3//Jk5y42Pv4QpUKxpjsY7Gi h6f1TvmUWhv80ohnUZTIilPzJ/fvCr595FvHHpl30k5xwVOTXSLvGEz+O9OhbG/R5mcTrwh5 CYXZzmEP7t/98seV5FqXKQL3fNn2vPvV3XrOXaVRNdxdyVfNoOBzoBJLcUaioRZzUXEiAMSP 6j/2AQAA X-TM-AS-MML: No Cc: Abhinav Kochhar , Russell King - ARM Linux , Arnd Bergmann , Konrad Rzeszutek Wilk , Benjamin Herrenschmidt , Kyungmin Park , Subash Patel Subject: [Linaro-mm-sig] [PATCHv2 1/6] common: DMA-mapping: add DMA_ATTR_NO_KERNEL_MAPPING attribute 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: ALoCoQnGnNQfs9GCIM+FH0EnZUrZLH2alSRMa3xFcdMLO+Km+U6XHjSPW+qxDHaa7AUvLGn9iusO This patch adds DMA_ATTR_NO_KERNEL_MAPPING attribute which lets the platform to avoid creating a kernel virtual mapping for the allocated buffer. On some architectures creating such mapping is non-trivial task and consumes very limited resources (like kernel virtual address space or dma consistent address space). Buffers allocated with this attribute can be only passed to user space by calling dma_mmap_attrs(). Signed-off-by: Marek Szyprowski Reviewed-by: Kyungmin Park Reviewed-by: Daniel Vetter --- Documentation/DMA-attributes.txt | 18 ++++++++++++++++++ include/linux/dma-attrs.h | 1 + 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index 5c72eed..725580d 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt @@ -49,3 +49,21 @@ DMA_ATTR_NON_CONSISTENT lets the platform to choose to return either consistent or non-consistent memory as it sees fit. By using this API, you are guaranteeing to the platform that you have all the correct and necessary sync points for this memory in the driver. + +DMA_ATTR_NO_KERNEL_MAPPING +-------------------------- + +DMA_ATTR_NO_KERNEL_MAPPING lets the platform to avoid creating a kernel +virtual mapping for the allocated buffer. On some architectures creating +such mapping is non-trivial task and consumes very limited resources +(like kernel virtual address space or dma consistent address space). +Buffers allocated with this attribute can be only passed to user space +by calling dma_mmap_attrs(). By using this API, you are guaranteeing +that you won't dereference the pointer returned by dma_alloc_attr(). You +can threat it as a cookie that must be passed to dma_mmap_attrs() and +dma_free_attrs(). Make sure that both of these also get this attribute +set on each call. + +Since it is optional for platforms to implement +DMA_ATTR_NO_KERNEL_MAPPING, those that do not will simply ignore the +attribute and exhibit default behavior. diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 547ab56..a37c10c 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_KERNEL_MAPPING, DMA_ATTR_MAX, };