Commit 74ff2857 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

x86: make c_p_a unconditional in ioremap

Make c_p_a unconditional for ioremap and iounmap. This ensures
complete consistency of the flags which are handed to
ioremap_page_range and the real flags in the mappings.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f87519e8
...@@ -74,7 +74,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -74,7 +74,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
/* /*
* Ok, go for it.. * Ok, go for it..
*/ */
area = get_vm_area(size, VM_IOREMAP | (flags << 20)); area = get_vm_area(size, VM_IOREMAP);
if (!area) if (!area)
return NULL; return NULL;
area->phys_addr = phys_addr; area->phys_addr = phys_addr;
...@@ -189,7 +189,7 @@ void iounmap(volatile void __iomem *addr) ...@@ -189,7 +189,7 @@ void iounmap(volatile void __iomem *addr)
} }
/* Reset the direct mapping. Can block */ /* Reset the direct mapping. Can block */
if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { if (p->phys_addr < virt_to_phys(high_memory) - 1) {
change_page_attr(virt_to_page(__va(p->phys_addr)), change_page_attr(virt_to_page(__va(p->phys_addr)),
get_vm_area_size(p) >> PAGE_SHIFT, get_vm_area_size(p) >> PAGE_SHIFT,
PAGE_KERNEL); PAGE_KERNEL);
......
...@@ -31,7 +31,7 @@ EXPORT_SYMBOL(__phys_addr); ...@@ -31,7 +31,7 @@ EXPORT_SYMBOL(__phys_addr);
* conflicts. * conflicts.
*/ */
static int ioremap_change_attr(unsigned long phys_addr, unsigned long size, static int ioremap_change_attr(unsigned long phys_addr, unsigned long size,
unsigned long flags) pgprot_t prot)
{ {
int err = 0; int err = 0;
if (phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT)) { if (phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT)) {
...@@ -50,8 +50,8 @@ static int ioremap_change_attr(unsigned long phys_addr, unsigned long size, ...@@ -50,8 +50,8 @@ static int ioremap_change_attr(unsigned long phys_addr, unsigned long size,
* the phys addr can be a in hole between nodes and * the phys addr can be a in hole between nodes and
* not have an memmap entry. * not have an memmap entry.
*/ */
err = change_page_attr_addr(vaddr,npages, err = change_page_attr_addr(vaddr, npages, prot);
MAKE_GLOBAL(__PAGE_KERNEL|flags));
if (!err) if (!err)
global_flush_tlb(); global_flush_tlb();
} }
...@@ -97,7 +97,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -97,7 +97,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
/* /*
* Ok, go for it.. * Ok, go for it..
*/ */
area = get_vm_area(size, VM_IOREMAP | (flags << 20)); area = get_vm_area(size, VM_IOREMAP);
if (!area) if (!area)
return NULL; return NULL;
area->phys_addr = phys_addr; area->phys_addr = phys_addr;
...@@ -107,8 +107,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, ...@@ -107,8 +107,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr)); remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr));
return NULL; return NULL;
} }
if (flags && ioremap_change_attr(phys_addr, size, flags) < 0) { if (ioremap_change_attr(phys_addr, size, pgprot) < 0) {
area->flags &= 0xffffff;
vunmap(addr); vunmap(addr);
return NULL; return NULL;
} }
...@@ -180,8 +179,7 @@ void iounmap(volatile void __iomem *addr) ...@@ -180,8 +179,7 @@ void iounmap(volatile void __iomem *addr)
} }
/* Reset the direct mapping. Can block */ /* Reset the direct mapping. Can block */
if (p->flags >> 20) ioremap_change_attr(p->phys_addr, p->size, PAGE_KERNEL);
ioremap_change_attr(p->phys_addr, p->size, 0);
/* Finally remove it */ /* Finally remove it */
o = remove_vm_area((void *)addr); o = remove_vm_area((void *)addr);
......
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