From patchwork Thu May 17 16:53:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 8767 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 80F4623E49 for ; Thu, 17 May 2012 16:53:38 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 50431A18B7E for ; Thu, 17 May 2012 16:53:38 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so2443524ggn.11 for ; Thu, 17 May 2012 09:53:38 -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 :mime-version:date:from:in-reply-to:to:message-id:x-mailer :references:cc:subject:x-beenthere:x-mailman-version:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=lfblyrWET0oFpUNrPDMNQcV57U2oXSBMcgrYa62CoKk=; b=CqxNJi9I0BMgF6Wanm2Wl5z/Mq8UI5ZGuCORYb2L1yqNxp2kMUUdp6D8MmWqSI57r/ hCY6mo42rtqYx8w8ERMTW7LrGnBUm3Nghn5aVLYCuKs8eqMtgKcr0TPjrhZKD3xemrCq f+JPFN9Ll48o+If/+VWT+PaH+ViTRZntvBoXlGxBk50gJH5ZpvVxl/gwBPNjbcM+oV/x tfR2jlcnMVO6xGY90zPigJ9ih/LgKoJzT5t3HsVlYBEAPK10QMn2ttZgYeXbeBIUsHnL HeGCyOyR7FPnY+t0YdzS2ZeahRlWRmmMcwTdUHsups9CHlLoAOecKu2uS45CKk6l4Myo 0pow== Received: by 10.50.203.39 with SMTP id kn7mr6158941igc.53.1337273617645; Thu, 17 May 2012 09:53:37 -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.35.72 with SMTP id o8csp41934ibd; Thu, 17 May 2012 09:53:35 -0700 (PDT) Received: by 10.216.131.223 with SMTP id m73mr5155457wei.75.1337273615047; Thu, 17 May 2012 09:53:35 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id g6si9058774wie.28.2012.05.17.09.53.33; Thu, 17 May 2012 09:53:35 -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 1SV3xB-000064-Px; Thu, 17 May 2012 16:53:29 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SV3xA-00005C-F3 for linaro-mm-sig@lists.linaro.org; Thu, 17 May 2012 16:53:28 +0000 MIME-version: 1.0 Received: from euspt1 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M46005KMEXGHE70@mailout4.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 17 May 2012 17:53:40 +0100 (BST) Received: from ubuntu.arm.acom ([106.210.236.191]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M46008IQEWVMY@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 17 May 2012 17:53:26 +0100 (BST) Date: Thu, 17 May 2012 18:53:04 +0200 From: Marek Szyprowski In-reply-to: <1337273586-11089-1-git-send-email-m.szyprowski@samsung.com> 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 Message-id: <1337273586-11089-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.10.1 References: <1337273586-11089-1-git-send-email-m.szyprowski@samsung.com> Cc: Abhinav Kochhar , Russell King - ARM Linux , Arnd Bergmann , Konrad Rzeszutek Wilk , Benjamin Herrenschmidt , Kyungmin Park , Subash Patel Subject: [Linaro-mm-sig] [PATCH 1/3] 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: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQmZ1KwOcl/67xJBytDVQe97wpDmGH003z54MewSkeGgrVzm57AJjwkaryVLRWm73HipgSKG 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 --- Documentation/DMA-attributes.txt | 18 ++++++++++++++++++ include/linux/dma-attrs.h | 1 + 2 files changed, 19 insertions(+) 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, };