From patchwork Sat May 12 08:41:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhinav X-Patchwork-Id: 8585 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 0E8AC23F00 for ; Mon, 14 May 2012 10:52:09 +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 BCEFCA18522 for ; Mon, 14 May 2012 10:52:08 +0000 (UTC) Received: by ggnf1 with SMTP id f1so3170144ggn.11 for ; Mon, 14 May 2012 03:52:08 -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:x-brightmail-tracker:x-tm-as-mml :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=Zfrtr4YQMf1TE89kK9hTqUKLtYKOlAUm71KVvN9TFKk=; b=hPZe1W6YLnBFFSQmO0ikcL9l2fXhwZhcsGTVKiJkfiZNeAl4XoIh7RL15n7znJnId0 7iPiSVaSpJH3R1a81VRUwUZ2A/AJHkj8PcAgfH4Arv+8xMvA0XW1++EVMNYB2pBQ8ONq 9zclLtArxCPSGvizs6fguo1LIJqJXd4cBxLB+uzin7RLr9jwBlWr7xEXtv9RzoLnMGf0 TPI/K3ZBetOtTlJvZ82V1W/iE8UwRQQ92/88+hxWshlcJy8taJf4FWTuhxjy4Rv3I2E2 qWDAHNsHHNz67dcmdciq8nasp4/OzkXAw9Sb9j9xzSThYSpjsujzoo2UixCqyep4VV7n ACrg== Received: by 10.42.89.72 with SMTP id f8mr1724208icm.33.1336992727961; Mon, 14 May 2012 03:52:07 -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 o8csp334125ibd; Mon, 14 May 2012 03:52:06 -0700 (PDT) Received: by 10.180.104.137 with SMTP id ge9mr18646649wib.20.1336992726130; Mon, 14 May 2012 03:52:06 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id c21si18180022wed.127.2012.05.14.03.52.04; Mon, 14 May 2012 03:52: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 1STssj-0004wh-Tg; Mon, 14 May 2012 10:52:01 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1ST7ge-0001Q7-9y for linaro-mm-sig@lists.linaro.org; Sat, 12 May 2012 08:28:24 +0000 Received: from epcpsbgm1.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 <0M3W0044TI798MD0@mailout2.samsung.com> for linaro-mm-sig@lists.linaro.org; Sat, 12 May 2012 17:28:21 +0900 (KST) X-AuditID: cbfee61a-b7bbeae000003a71-96-4fae1f25c022 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id B5.43.14961.52F1EAF4; Sat, 12 May 2012 17:28:21 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M3W005X4I757Y00@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Sat, 12 May 2012 17:28:21 +0900 (KST) From: Abhinav To: m.szyprowski@samsung.com Date: Sat, 12 May 2012 14:11:58 +0530 Message-id: <1336812118-10024-1-git-send-email-abhinav.k@samsung.com> X-Mailer: git-send-email 1.7.0.4 X-Brightmail-Tracker: AAAAAA== X-TM-AS-MML: No X-Mailman-Approved-At: Mon, 14 May 2012 10:52:01 +0000 Cc: linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, abhinav.k@samsung.com, subash.rp@samsung.com Subject: [Linaro-mm-sig] [PATCH 2/3] [RFC]:DMA-MAPPING:Define new wrapper functions to pass new dma attribute to IOMMU ops 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: ALoCoQmgAkb6xK0bHLF+QNSDtpSXYAiKdQIugxZcsivbbGxoQ2CwQ1nddTPJ4Bykbz/+Fzu5imud With these new functions the drivers can pass the new dma attribute to IOMMU ops of dma mapping framework to differentiate between kernel and user space allocations. Signed-off-by: Abhinav --- arch/arm/include/asm/dma-mapping.h | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) -- 1.7.0.4 diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index bbef15d..7fc003a 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -14,6 +14,12 @@ #define DMA_ERROR_CODE (~0) extern struct dma_map_ops arm_dma_ops; +struct page_infodma { + struct page **pages; + unsigned long nr_pages; + unsigned long shared; +}; + static inline struct dma_map_ops *get_dma_ops(struct device *dev) { if (dev && dev->archdata.dma_ops) @@ -205,6 +211,14 @@ static inline void *dma_alloc_writecombine(struct device *dev, size_t size, return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs); } +static inline void *dma_alloc_writecombine_user(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + DEFINE_DMA_ATTRS(attrs); + dma_set_attr(DMA_ATTR_USER_SPACE, &attrs); + return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs); +} + static inline void dma_free_writecombine(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) { @@ -213,6 +227,14 @@ static inline void dma_free_writecombine(struct device *dev, size_t size, return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs); } +static inline void dma_free_writecombine_user(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_handle) +{ + DEFINE_DMA_ATTRS(attrs); + dma_set_attr(DMA_ATTR_USER_SPACE, &attrs); + return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs); +} + static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size) { @@ -221,6 +243,14 @@ static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struc return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); } +static inline int dma_mmap_writecombine_user(struct device *dev, struct vm_area_struct *vma, + void *cpu_addr, dma_addr_t dma_addr, size_t size) +{ + DEFINE_DMA_ATTRS(attrs); + dma_set_attr(DMA_ATTR_USER_SPACE, &attrs); + return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); +} + /* * This can be called during boot to increase the size of the consistent * DMA region above it's default value of 2MB. It must be called before the