linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Prohibit ioremap() on kernel managed RAM
@ 2010-04-08  9:48 Russell King - ARM Linux
  2010-04-23 14:15 ` Catalin Marinas
  0 siblings, 1 reply; 15+ messages in thread
From: Russell King - ARM Linux @ 2010-04-08  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

ARMv6 and above have a restriction whereby aliasing virtual:physical
mappings must not have differing memory type and sharability
attributes.  Strictly, this covers the memory type (strongly ordered,
device, memory), cache attributes (uncached, write combine, write
through, write back read alloc, write back write alloc) and the
shared bit.

However, using ioremap() and its variants on system RAM results in
mappings which differ in these attributes from the main system RAM
mapping.  Other architectures which similar restrictions approch this
problem in the same way - they do not permit ioremap on main system
RAM.

Make ARM behave in the same way, with a WARN_ON() such that users can
be traced and an alternative approach found.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 28c8b95..03f1193 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -268,6 +268,12 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
 	if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK))
 		return NULL;
 
+	/*
+	 * Don't allow RAM to be mapped - this causes problems with ARMv6+
+	 */
+	if (WARN_ON(pfn_valid(pfn)))
+		return NULL;
+
 	type = get_mem_type(mtype);
 	if (!type)
 		return NULL;

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [RFC] Prohibit ioremap() on kernel managed RAM
@ 2010-04-23 14:40 Russell King
  2010-04-30 16:33 ` George G. Davis
  0 siblings, 1 reply; 15+ messages in thread
From: Russell King @ 2010-04-23 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

> Above change is necessary but what an alternative approach is for this. 
> There are many use case where ioremap* is needed.

This is a very difficult issue to answer; the only way we can safely
remap RAM with different attributes is if we disable the existing
mappings - but since we create those with 1MB sections, that's far
from easy to achieve.

I think a viable safe solution is to set aside some RAM at boot (which
the kernel doesn't manage at all) and then use ioremap on that; that
approach will still work with this patch in place.

Note that I've applied this patch to my devel tree, which has been
pushed out; please note that I'm making use of others 'net connections
to do this.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-05-05 16:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08  9:48 [RFC] Prohibit ioremap() on kernel managed RAM Russell King - ARM Linux
2010-04-23 14:15 ` Catalin Marinas
2010-04-23 14:27   ` Shilimkar, Santosh
  -- strict thread matches above, loose matches on Subject: below --
2010-04-23 14:40 Russell King
2010-04-30 16:33 ` George G. Davis
2010-04-30 16:38   ` Catalin Marinas
2010-05-01  6:24     ` Shilimkar, Santosh
2010-05-01  9:19       ` Russell King - ARM Linux
2010-05-03 15:59     ` George G. Davis
2010-05-04 15:29       ` Catalin Marinas
2010-05-05 16:23         ` George G. Davis
2010-05-05 16:30           ` Russell King - ARM Linux
2010-05-05 16:33             ` George G. Davis
2010-04-30 18:19   ` Russell King - ARM Linux
2010-04-30 22:30     ` George G. Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).