aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2005-01-11 01:48:53 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-11 01:48:53 -0800
commit54465502760ca40444639dcb8114860dda8a5453 (patch)
tree9db07a710916c4e5865b66f0449a1ae50cb94e23 /arch
parent82a7151979b57d1ca84792ddf19efccc247c9558 (diff)
downloadhistory-54465502760ca40444639dcb8114860dda8a5453.tar.gz
[PATCH] x86_64: Fix ioremap attribute restoration on i386 and x86-64
We need to save the access flags to properly restore the direct mapping on unmap. For that we use some upper bits in vm_flags Also add a comment for that to the header file. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/mm/ioremap.c6
-rw-r--r--arch/x86_64/mm/ioremap.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index 1aa488b7f99917..58ff04eeb9dbc0 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -157,7 +157,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
/*
* Ok, go for it..
*/
- area = get_vm_area(size, VM_IOREMAP);
+ area = get_vm_area(size, VM_IOREMAP | (flags << 20));
if (!area)
return NULL;
area->phys_addr = phys_addr;
@@ -235,9 +235,9 @@ void iounmap(volatile void __iomem *addr)
if (!p) {
printk("__iounmap: bad address %p\n", addr);
return;
- }
+ }
- if (p->flags && p->phys_addr < virt_to_phys(high_memory) - 1) {
+ if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) {
change_page_attr(virt_to_page(__va(p->phys_addr)),
p->size >> PAGE_SHIFT,
PAGE_KERNEL);
diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
index 1a166779eeba56..12363e69b0c31e 100644
--- a/arch/x86_64/mm/ioremap.c
+++ b/arch/x86_64/mm/ioremap.c
@@ -175,11 +175,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
if (phys_addr >= 0xA0000 && last_addr < 0x100000)
return (__force void __iomem *)phys_to_virt(phys_addr);
+#ifndef CONFIG_DISCONTIGMEM
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
- if (phys_addr < virt_to_phys(high_memory)) {
-#ifndef CONFIG_DISCONTIGMEM
+ if (last_addr < virt_to_phys(high_memory)) {
char *t_addr, *t_end;
struct page *page;
@@ -189,8 +189,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
if(!PageReserved(page))
return NULL;
-#endif
}
+#endif
/*
* Mappings have to be page-aligned
@@ -202,7 +202,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
/*
* Ok, go for it..
*/
- area = get_vm_area(size, VM_IOREMAP | (flags << 24));
+ area = get_vm_area(size, VM_IOREMAP | (flags << 20));
if (!area)
return NULL;
area->phys_addr = phys_addr;
@@ -263,7 +263,7 @@ void iounmap(volatile void __iomem *addr)
}
*pprev = p->next;
unmap_vm_area(p);
- if ((p->flags >> 24) &&
+ if ((p->flags >> 20) &&
p->phys_addr + p->size - 1 < virt_to_phys(high_memory)) {
change_page_attr(virt_to_page(__va(p->phys_addr)),
p->size >> PAGE_SHIFT,