From patchwork Fri Aug 24 08:29:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi Doyu X-Patchwork-Id: 10917 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 A2BFF23E41 for ; Fri, 24 Aug 2012 08:30:26 +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 803F9A187E1 for ; Fri, 24 Aug 2012 08:30:09 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so671330iaf.11 for ; Fri, 24 Aug 2012 01:30:26 -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=LK1/3XOJtgca+Blzsva545JCaMMPKbivnjl1CIqFZZA=; b=CIitV909uNhoEm3yKS7OVft6InqBHd3ngtklVcgf6BtZPtrps8G/fn3QnO8qVg7qht 22/QTiHy1zDzjjVjWq83Jjyylb8HPI40HQf90jSRECC1ELvngW+7OdnVZqbHi1dS3CJe D6nymajSWw1lxwB7SuQygFzVytN3pyZD5B9amy3cmB771BrTf0EDMuuT0XKombYjT1MF 3rZ5V68BGajiLezaW0r3jExq5Fcs7knR4JMQQS/gjtQ6g1lg+6fKSkkmxtwz1EgLQr0J WGpqAyoqkdck7qKHjH6/avxjlPRrGLla7SZUehWLezpZtZ7YqKd3UtZfqpBFmyuaFi4z W35w== Received: by 10.50.159.196 with SMTP id xe4mr1244363igb.43.1345797026098; Fri, 24 Aug 2012 01:30:26 -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 ex8csp307516igc; Fri, 24 Aug 2012 01:30:25 -0700 (PDT) Received: by 10.180.93.8 with SMTP id cq8mr3646480wib.16.1345797024977; Fri, 24 Aug 2012 01:30:24 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id m7si13389437wea.124.2012.08.24.01.30.23; Fri, 24 Aug 2012 01:30:24 -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 1T4pHa-00041t-Ta; Fri, 24 Aug 2012 08:30:22 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1T4pHY-00041m-Ro for linaro-mm-sig@lists.linaro.org; Fri, 24 Aug 2012 08:30:21 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Fri, 24 Aug 2012 01:29:34 -0700 Received: from hqemhub02.nvidia.com ([172.17.108.22]) by hqnvupgp08.nvidia.com (PGP Universal service); Fri, 24 Aug 2012 01:30:12 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Fri, 24 Aug 2012 01:30:12 -0700 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server id 8.3.264.0; Fri, 24 Aug 2012 01:30:12 -0700 Received: from daphne.nvidia.com (Not Verified[172.16.212.96]) by hqnvemgw02.nvidia.com with MailMarshal (v6,7,2,8378) id ; Fri, 24 Aug 2012 01:31:03 -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 q7O8TWB0024274; Fri, 24 Aug 2012 01:30:08 -0700 (PDT) From: Hiroshi Doyu To: Date: Fri, 24 Aug 2012 11:29:04 +0300 Message-ID: <1345796945-21115-4-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1345796945-21115-1-git-send-email-hdoyu@nvidia.com> References: <1345796945-21115-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, pullip.cho@samsung.com, linux-arm-kernel@lists.infradead.org Subject: [Linaro-mm-sig] [v3 3/4] ARM: dma-mapping: Introduce __atomic_get_pages() for __iommu_get_pages() 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: ALoCoQnlvf+tdQyjFmPsESR+r496ptDNXP3P3wrGB8ND38dzLnpTuCOb6D11iTtSKRydrJNLRT8w Support atomic allocation in __iommu_get_pages(). Signed-off-by: Hiroshi Doyu --- arch/arm/mm/dma-mapping.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 508fde1..58a852b 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -501,6 +501,15 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) return ptr; } +static struct page **__atomic_get_pages(void *addr) +{ + struct dma_pool *pool = &atomic_pool; + struct page **pages = pool->pages; + int offs = (addr - pool->vaddr) >> PAGE_SHIFT; + + return pages + offs; +} + static bool __in_atomic_pool(void *start, size_t size) { struct dma_pool *pool = &atomic_pool; @@ -1184,6 +1193,9 @@ static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs) { struct vm_struct *area; + if (__in_atomic_pool(cpu_addr, PAGE_SIZE)) + return __atomic_get_pages(cpu_addr); + if (dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) return cpu_addr;