From patchwork Wed Feb 20 06:43:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Peethambaran X-Patchwork-Id: 2166541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 211113FDF1 for ; Wed, 20 Feb 2013 06:46:44 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U83PH-0000rp-KM; Wed, 20 Feb 2013 06:43:55 +0000 Received: from mail-lb0-f169.google.com ([209.85.217.169]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U83PF-0000rW-CX for linux-arm-kernel@lists.infradead.org; Wed, 20 Feb 2013 06:43:54 +0000 Received: by mail-lb0-f169.google.com with SMTP id m4so5730050lbo.28 for ; Tue, 19 Feb 2013 22:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=RzG7HEcFJB+WRAhQaLcG5MvOxuMW8XBbUYG1MYTT68M=; b=JRIVz5cBeYSxHqro/i5+MqIg50lz4UjG8xK9u+mfy2JaR7MlJlkb5lgW2Rxcgh1Nmx f7cXnM0lAJtj6ltZ6yxYIzpXcNP1Cs4Rq+yE2PAwh9T6WLbO0ASCFHggymWcuw3hCFEW 7eLmltf3Fq1Gn5KPUFtV41eMu5jjKmhQYiFxAojgxYs08aMU2NPNnTzoJCUOIQ+lEGGK P1/vJBaWw8Lx3oOruUhCle3VmEq9FTMn8uNJEC3K+4P5Ccl3dS7UcR7aFc/fae5PqbgO O7jky5+PDu9yTtVbWll6t/4Fa5AKudc4LOkL2rGR1ny6fJx7ttTruiAWP7KzKwzH0ZOH /3EQ== MIME-Version: 1.0 X-Received: by 10.152.146.199 with SMTP id te7mr16514716lab.23.1361342631081; Tue, 19 Feb 2013 22:43:51 -0800 (PST) Received: by 10.112.99.233 with HTTP; Tue, 19 Feb 2013 22:43:50 -0800 (PST) Date: Wed, 20 Feb 2013 12:13:50 +0530 Message-ID: Subject: [RFC] ARM: iommu: Adding new dma-mappin API to map sgtable From: Nishanth Peethambaran To: Marek Szyprowski X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130220_014353_576724_96DEA360 X-CRM114-Status: GOOD ( 10.52 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (nishanth.p[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Adding APIs in arm dma mapping code to map a scatterlist in iommu domain and get dma address. Allocators outside dma-mapping code like ION could allocate pages and devices would need to map them for iommu and obtain a linear dma address. Intention is to re-use the IOVA managment code and "mapping" across allocators. Can the above requirement be done without adding new APIs? APIs available to map an sglist (arm_dma_map_sg) does not provide a linear dma address. Signed-off-by: Nishanth Peethambaran --- arch/arm/include/asm/dma-mapping.h | 10 ++++++++++ 1 file changed, 10 insertions(+) #endif diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 5b579b9..f9e2f6c 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -268,6 +268,16 @@ extern void arm_dma_sync_sg_for_device(struct device *, struct scatterlist *, in extern int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr, dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs); +/* + * Map scatterlist pages for the device and return a dma address + */ +extern dma_addr_t arm_dma_map_sgtable(struct device *dev, struct sgtable *sgt, + enum dma_data_direction dir, struct dma_attrs *attrs); +/* + * Unmap the dma address + */ +extern void arm_dma_unmap(struct device *, dma_addr_t iova, int size, + enum dma_data_direction dir, struct dma_attrs *attrs); #endif /* __KERNEL__ */