aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2014-10-13 18:54:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:18:22 -0400
commit906e36c5c717cc99e622350f533876feed9bffe0 (patch)
tree054826656a5ea90f62373eca18e0b504edc0b59c /arch/x86
parent67cf13ceed89e2c1a967719e98624a20c48dfb5a (diff)
x86: use optimized ioresource lookup in ioremap function
Use the optimized ioresource lookup, "region_is_ram", for the ioremap function. If the region is not found, it falls back to the "page_is_ram" function. If it is found and it is RAM, then the usual warning message is issued, and the ioremap operation is aborted. Otherwise, the ioremap operation continues. Signed-off-by: Mike Travis <travis@sgi.com> Acked-by: Alex Thorlton <athorlton@sgi.com> Reviewed-by: Cliff Wickman <cpw@sgi.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Mark Salter <msalter@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/ioremap.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index baff1da354e0..af78e50ca6ce 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -86,6 +86,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
86 pgprot_t prot; 86 pgprot_t prot;
87 int retval; 87 int retval;
88 void __iomem *ret_addr; 88 void __iomem *ret_addr;
89 int ram_region;
89 90
90 /* Don't allow wraparound or zero size */ 91 /* Don't allow wraparound or zero size */
91 last_addr = phys_addr + size - 1; 92 last_addr = phys_addr + size - 1;
@@ -108,12 +109,23 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
108 /* 109 /*
109 * Don't allow anybody to remap normal RAM that we're using.. 110 * Don't allow anybody to remap normal RAM that we're using..
110 */ 111 */
111 pfn = phys_addr >> PAGE_SHIFT; 112 /* First check if whole region can be identified as RAM or not */
112 last_pfn = last_addr >> PAGE_SHIFT; 113 ram_region = region_is_ram(phys_addr, size);
113 if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL, 114 if (ram_region > 0) {
114 __ioremap_check_ram) == 1) 115 WARN_ONCE(1, "ioremap on RAM at 0x%lx - 0x%lx\n",
116 (unsigned long int)phys_addr,
117 (unsigned long int)last_addr);
115 return NULL; 118 return NULL;
119 }
116 120
121 /* If could not be identified(-1), check page by page */
122 if (ram_region < 0) {
123 pfn = phys_addr >> PAGE_SHIFT;
124 last_pfn = last_addr >> PAGE_SHIFT;
125 if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
126 __ioremap_check_ram) == 1)
127 return NULL;
128 }
117 /* 129 /*
118 * Mappings have to be page-aligned 130 * Mappings have to be page-aligned
119 */ 131 */