Commit 38cb47ba authored by Ingo Molnar's avatar Ingo Molnar

x86: relax RAM check in ioremap()

Kevin Winchester reported the loss of direct rendering, due to:

[    0.588184] agpgart: Detected AGP bridge 0
[    0.588184] agpgart: unable to get memory for graphics translation table.
[    0.588184] agpgart: agp_backend_initialize() failed.
[    0.588207] agpgart-amd64: probe of 0000:00:00.0 failed with error -12

and bisected it down to:

  commit 266b9f87
  Author: Thomas Gleixner <tglx@linutronix.de>
  Date:   Wed Jan 30 13:34:06 2008 +0100

      x86: fix ioremap RAM check

this check was too strict and caused an ioremap() failure.

the problem is due to the somewhat unclean way of how the GART code
reserves a memory range for its aperture, and how it utilizes it
later on.

Allow RAM pages to be ioremap()-ed too, as long as they are reserved.
Bisected-by: default avatarKevin Winchester <kjwinchester@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Tested-by: default avatarKevin Winchester <kjwinchester@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 9135f190
...@@ -116,7 +116,7 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -116,7 +116,7 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
{ {
void __iomem *addr; void __iomem *addr;
struct vm_struct *area; struct vm_struct *area;
unsigned long offset, last_addr; unsigned long pfn, offset, last_addr;
pgprot_t prot; pgprot_t prot;
/* Don't allow wraparound or zero size */ /* Don't allow wraparound or zero size */
...@@ -133,9 +133,10 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -133,9 +133,10 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
/* /*
* Don't allow anybody to remap normal RAM that we're using.. * Don't allow anybody to remap normal RAM that we're using..
*/ */
for (offset = phys_addr >> PAGE_SHIFT; offset < max_pfn_mapped && for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped &&
(offset << PAGE_SHIFT) < last_addr; offset++) { (pfn << PAGE_SHIFT) < last_addr; pfn++) {
if (page_is_ram(offset)) if (page_is_ram(pfn) && pfn_valid(pfn) &&
!PageReserved(pfn_to_page(pfn)))
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment