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: 15001 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 083DE23F78 for ; Wed, 20 Feb 2013 06:44:05 +0000 (UTC) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by fiordland.canonical.com (Postfix) with ESMTP id 872F7A18ABB for ; Wed, 20 Feb 2013 06:44:04 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id 15so6571703vea.14 for ; Tue, 19 Feb 2013 22:44:04 -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:dkim-signature:mime-version:x-received:date:message-id :from:to: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=PmWzqmBTwMYTbPiypGuI8ABCw4S6TjBJ0/zS+D+NAkg=; b=L8yl7hoOrJhmCbStPzY9oJmt4HMQVFtt7DU5nnvIQzv3Af19vzWEE7gbbQDW/S3DlJ G8MVd5m6N4//UbYBfBezTlihofzaHTB89CfZOzs44MqmFsNpR+tRFlZUX7sEV8wVD2EK 0Ui30X2sf5vuurnBzQxE+9xG0yf1LAGi+ct7Wf2FAheHjmdZvBY6W9lH+W7TK9RqGd2E U0Y0zpkKASie0kltmiVq0tajVXFRXUmT+gF3wYT+61NJ+U2aQpLSLA9n2Tr6A4niWQD9 VgzVuKr97ohOAoupUerl5QhFH//uYPByZoaZVaFpcVEzphZFWoN3oK+ZyqN7D/44XPUO BuZA== X-Received: by 10.52.93.235 with SMTP id cx11mr20792132vdb.51.1361342643924; Tue, 19 Feb 2013 22:44:03 -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 st5csp182025veb; Tue, 19 Feb 2013 22:44:03 -0800 (PST) X-Received: by 10.204.6.5 with SMTP id 5mr7710287bkx.26.1361342642449; Tue, 19 Feb 2013 22:44:02 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id c16si49575385bkw.93.2013.02.19.22.43.58; Tue, 19 Feb 2013 22:44:02 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U83PF-0004jA-3b; Wed, 20 Feb 2013 06:43:53 +0000 Received: from mail-lb0-f176.google.com ([209.85.217.176]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U83PD-0004j5-On for linaro-mm-sig@lists.linaro.org; Wed, 20 Feb 2013 06:43:51 +0000 Received: by mail-lb0-f176.google.com with SMTP id s4so5637239lbc.21 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: From: Nishanth Peethambaran To: Marek Szyprowski Cc: linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [Linaro-mm-sig] [RFC] ARM: iommu: Adding new dma-mappin API to map sgtable 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: ALoCoQmY83nsMgCE6+vPo+j2Ug97XhqJ7tJUrdJ9xFgDQ+5DQ5OWakbva9czqbvqGyN3RN6m3Iss 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__ */