From patchwork Wed Aug 22 10:20:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi Doyu X-Patchwork-Id: 10867 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 90F8323E1B for ; Wed, 22 Aug 2012 10:21:03 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2AB62A18D1E for ; Wed, 22 Aug 2012 10:20:52 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j38so707700iad.11 for ; Wed, 22 Aug 2012 03:21:03 -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-pgp-universal:from:to:date:message-id:x-mailer:in-reply-to :references:mime-version: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=xNS9fqX0R97efeRnEUe3y8eXbHhcO/SZsyFX7k8ZgNs=; b=oLjNdZKCWK+oVvy6hQUCEw5k74S3pdG1En5U4qbYQoCHM03wAvfegGIqhtdT4XQ+eN jS7k0kjEVJD2zbrtvWJ+76GK1x+B6C3QdkX7QD7Cifg8Dd+ZvyRx2QvIVMpWbr/M3P5r mCmiFp05aP2kt2bTzW75CUD5gJ1Aq5iB9EiFbPKPoQJOk8l1JQi5lkGS+Ql4iU4LYWmA 8/oRueKP6vvkYFcY55KVmCDZj43ItvnAbByqOQqrFQ5VSDdPucK8vNB9IAzKCze1SKoY 3WJJ5eF+QGWvSmiTtvZ2Wvbaq4dZyWNG/RGT3aBML156uLXOnhl4muowWqHODd67M9sx 8N5A== Received: by 10.50.182.161 with SMTP id ef1mr1581945igc.0.1345630862977; Wed, 22 Aug 2012 03:21:02 -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.50.184.232 with SMTP id ex8csp194237igc; Wed, 22 Aug 2012 03:21:02 -0700 (PDT) Received: by 10.204.130.211 with SMTP id u19mr6135035bks.24.1345630861913; Wed, 22 Aug 2012 03:21:01 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id hg2si2084496bkc.26.2012.08.22.03.21.00; Wed, 22 Aug 2012 03:21:01 -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 1T483X-0003oF-Ho; Wed, 22 Aug 2012 10:20:59 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1T483V-0003nm-Rs for linaro-mm-sig@lists.linaro.org; Wed, 22 Aug 2012 10:20:58 +0000 Received: from hqnvupgp06.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Wed, 22 Aug 2012 03:20:12 -0700 Received: from hqemhub01.nvidia.com ([172.17.108.22]) by hqnvupgp06.nvidia.com (PGP Universal service); Wed, 22 Aug 2012 03:20:51 -0700 X-PGP-Universal: processed; by hqnvupgp06.nvidia.com on Wed, 22 Aug 2012 03:20:51 -0700 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by hqemhub01.nvidia.com (172.20.150.30) with Microsoft SMTP Server id 8.3.264.0; Wed, 22 Aug 2012 03:20:51 -0700 Received: from daphne.nvidia.com (Not Verified[172.16.212.96]) by hqnvemgw01.nvidia.com with MailMarshal (v6,7,2,8378) id ; Wed, 22 Aug 2012 03:20:51 -0700 Received: from oreo.Nvidia.com (dhcp-10-21-25-186.nvidia.com [10.21.25.186]) by daphne.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id q7MAKWer027973; Wed, 22 Aug 2012 03:20:47 -0700 (PDT) From: Hiroshi Doyu To: Marek Szyprowski Date: Wed, 22 Aug 2012 13:20:29 +0300 Message-ID: <1345630830-9586-4-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1345630830-9586-1-git-send-email-hdoyu@nvidia.com> References: <1345630830-9586-1-git-send-email-hdoyu@nvidia.com> MIME-Version: 1.0 Cc: "linux@arm.linux.org.uk" , "arnd@arndb.de" , "konrad.wilk@oracle.com" , "minchan@kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-mm-sig@lists.linaro.org" , "linux-mm@kvack.org" , "kyungmin.park@samsung.com" , "linux-arm-kernel@lists.infradead.org" Subject: [Linaro-mm-sig] [RFC 3/4] ARM: dma-mapping: Return cpu addr when dma_alloc(GFP_ATOMIC) 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: ALoCoQnGo0HqVssitG9Bo2HKcJ3Md/DqcMJePS0F6mldoh1BSaGhdpxhFF+xroTOcGExzH6lCOK6 Make dma_alloc{_attrs}() returns cpu address when DMA_ATTR_NO_KERNEL_MAPPING && GFP_ATOMIC. Signed-off-by: Hiroshi Doyu --- arch/arm/mm/dma-mapping.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 9260107..a0cd476 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1198,8 +1198,11 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size, if (*handle == DMA_ERROR_CODE) goto err_buffer; - if (dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) + if (dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) { + if (gfp & GFP_ATOMIC) + return page_address(pages[0]); return pages; + } addr = __iommu_alloc_remap(pages, size, gfp, prot, __builtin_return_address(0));