From patchwork Fri Mar 23 12:26:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7433 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 D4BAD23E00 for ; Fri, 23 Mar 2012 12:26:24 +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 9C9E2A1851E for ; Fri, 23 Mar 2012 12:26:24 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so6064136iag.11 for ; Fri, 23 Mar 2012 05:26:24 -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 :mime-version:date:from:in-reply-to:to:message-id:x-mailer :references: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=0UInU8+jdVw+iPxZ2vWkiS4L9s4/Nr0RJj8BOVW8Lk0=; b=cVURLMfqlixYblkpBsWdh+QdaJGZraaQpoXUcRQZP7pMRAvBo2Zdeveg5ES+sF2D2b PQ2fqnMKrZJLgs/qxF7Jlaao5jPcBRfVRy5m84s+1NbQerK+lmnPeX5xppORmRw/bdBD ZQFSSthHTSB4urllDm58ZVy+ZPbXM/ScY6JSAPca3Pp8dAQgWyw/pbUaiUSsduEyPD8E z94AjxKdiLhYmPjm4iUPysRA6XZ+6UlDIkLIJyNPwC3J1QQAeFQdbVvHdDKUaB9cFpFq aC0t7vjZBzceCz7P1kxgeaq5aBosGQvhcDLTAKeTjhNFhZMdcGc+JzJE8MF0/tD6pyyA WGcA== Received: by 10.50.183.163 with SMTP id en3mr1795583igc.12.1332505584410; Fri, 23 Mar 2012 05:26:24 -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.203.79 with SMTP id fh15csp21797ibb; Fri, 23 Mar 2012 05:26:23 -0700 (PDT) Received: by 10.180.83.42 with SMTP id n10mr6131114wiy.9.1332505577288; Fri, 23 Mar 2012 05:26:17 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id k51si8363282weq.75.2012.03.23.05.26.16; Fri, 23 Mar 2012 05:26:17 -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 1SB3ZP-0006yL-Ju; Fri, 23 Mar 2012 12:26:15 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SB3ZM-0005S9-KZ for linaro-mm-sig@lists.linaro.org; Fri, 23 Mar 2012 12:26:12 +0000 MIME-version: 1.0 Received: from euspt2 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0M1C00D1M7VOV450@mailout4.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 23 Mar 2012 12:26:12 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M1C009B57VJUC@spt2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Fri, 23 Mar 2012 12:26:08 +0000 (GMT) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 0CD11270059; Fri, 23 Mar 2012 13:27:10 +0100 (CET) Date: Fri, 23 Mar 2012 13:26:03 +0100 From: Marek Szyprowski In-reply-to: <1332505563-17646-1-git-send-email-m.szyprowski@samsung.com> To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org Message-id: <1332505563-17646-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.1 References: <08af01cd08ee$2fd04770$8f70d650$%szyprowski@samsung.com> <1332505563-17646-1-git-send-email-m.szyprowski@samsung.com> Cc: Russell King - ARM Linux , Arnd Bergmann , Konrad Rzeszutek Wilk , Benjamin Herrenschmidt , Kyungmin Park , Andrzej Pietrasiewicz , KyongHo Cho , Joerg Roedel Subject: [Linaro-mm-sig] [PATCH 2/2] arm: dma-mapping: use dma_mmap_from_coherent() 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: ALoCoQl/iunV0DY1DMRpoeN0tRT4ZRvYKvTmCY0rYK/A12QHQDdwr7VR4Dufe06O5G6unHtS+WZy Use dma_mmap_from_coherent() to fix broken mapping of the coherent buffers to userspace. Reported-by: Subash Patel Signed-off-by: Marek Szyprowski --- arch/arm/mm/dma-mapping.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6c24218..0cee054 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -511,6 +511,9 @@ int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, pgprot_writecombine(vma->vm_page_prot) : pgprot_dmacoherent(vma->vm_page_prot); + if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) + return ret; + c = arm_vmregion_find(&consistent_head, (unsigned long)cpu_addr); if (c) { unsigned long off = vma->vm_pgoff;