From patchwork Tue Jun 7 07:12:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 855322 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p577EDaV028035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Jun 2011 07:14:34 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTqUE-0001Y4-Gv; Tue, 07 Jun 2011 07:14:02 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QTqUE-0003Q9-3V; Tue, 07 Jun 2011 07:14:02 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QTqU8-0003Po-1n for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2011 07:13:59 +0000 Received: from spt2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LME008U6S3498@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2011 08:13:52 +0100 (BST) 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 <0LME00JR7S32IX@spt2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2011 08:13:50 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 4AB5927004B; Tue, 07 Jun 2011 09:14:18 +0200 (CEST) Date: Tue, 07 Jun 2011 09:12:25 +0200 From: Marek Szyprowski Subject: [PATCH] ARM: fix ioremap to allow mapping some specific RAM areas To: linux-arm-kernel@lists.infradead.org Message-id: <1307430745-17329-1-git-send-email-m.szyprowski@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.2.5 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110607_031356_323472_71F14CC9 X-CRM114-Status: GOOD ( 17.32 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [210.118.77.12 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain Cc: Kyungmin Park , Russell King - ARM Linux , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 07 Jun 2011 07:14:34 +0000 (UTC) Creating more than one mapping on ARMv6+ might cause unspecified behavior, so ioremap() should fail if it was called with area that matches low memory. However if the board code removes the specific area from low memory mapping on boot (for example by calling memblock_remove()), then creating a mapping with ioremap might be desired. This patch enables creating mapping for RAM by ioremap call, but only if the target area has no low memory mapping yet. This enables board code to reserve particular memory areas with memblock_remove() and provide them to device drivers with a declare_coherent_memory() call. Signed-off-by: Marek Szyprowski Signed-off-by: Kyungmin Park --- arch/arm/mm/ioremap.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index ab50627..d3fcc05 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -202,9 +203,10 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, return NULL; /* - * Don't allow RAM to be mapped - this causes problems with ARMv6+ + * Don't allow low memory to be mapped again - this causes problems + * with ARMv6+ */ - if (WARN_ON(pfn_valid(pfn))) + if (WARN_ON(memblock_is_memory(pfn << PAGE_SHIFT))) return NULL; type = get_mem_type(mtype);