diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:34:05 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:05 -0500 |
commit | 74ff2857f099951020a47420872f5c1460f32c27 (patch) | |
tree | 2087ac62a943702239f226b4c64b543e17db30db /arch/x86/mm | |
parent | f87519e8f4f1de9b39a40e56479a7ad2443169dd (diff) |
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: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/ioremap_32.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/ioremap_64.c | 14 |
2 files changed, 8 insertions, 10 deletions
diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c index d43251c9c1c6..213ace58a188 100644 --- a/arch/x86/mm/ioremap_32.c +++ b/arch/x86/mm/ioremap_32.c | |||
@@ -74,7 +74,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
74 | /* | 74 | /* |
75 | * Ok, go for it.. | 75 | * Ok, go for it.. |
76 | */ | 76 | */ |
77 | area = get_vm_area(size, VM_IOREMAP | (flags << 20)); | 77 | area = get_vm_area(size, VM_IOREMAP); |
78 | if (!area) | 78 | if (!area) |
79 | return NULL; | 79 | return NULL; |
80 | area->phys_addr = phys_addr; | 80 | area->phys_addr = phys_addr; |
@@ -189,7 +189,7 @@ void iounmap(volatile void __iomem *addr) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | /* Reset the direct mapping. Can block */ | 191 | /* Reset the direct mapping. Can block */ |
192 | if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { | 192 | if (p->phys_addr < virt_to_phys(high_memory) - 1) { |
193 | change_page_attr(virt_to_page(__va(p->phys_addr)), | 193 | change_page_attr(virt_to_page(__va(p->phys_addr)), |
194 | get_vm_area_size(p) >> PAGE_SHIFT, | 194 | get_vm_area_size(p) >> PAGE_SHIFT, |
195 | PAGE_KERNEL); | 195 | PAGE_KERNEL); |
diff --git a/arch/x86/mm/ioremap_64.c b/arch/x86/mm/ioremap_64.c index 8862a19f39c8..bb9246c4a07b 100644 --- a/arch/x86/mm/ioremap_64.c +++ b/arch/x86/mm/ioremap_64.c | |||
@@ -31,7 +31,7 @@ EXPORT_SYMBOL(__phys_addr); | |||
31 | * conflicts. | 31 | * conflicts. |
32 | */ | 32 | */ |
33 | static int ioremap_change_attr(unsigned long phys_addr, unsigned long size, | 33 | static int ioremap_change_attr(unsigned long phys_addr, unsigned long size, |
34 | unsigned long flags) | 34 | pgprot_t prot) |
35 | { | 35 | { |
36 | int err = 0; | 36 | int err = 0; |
37 | if (phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT)) { | 37 | 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 | * the phys addr can be a in hole between nodes and | 50 | * the phys addr can be a in hole between nodes and |
51 | * not have an memmap entry. | 51 | * not have an memmap entry. |
52 | */ | 52 | */ |
53 | err = change_page_attr_addr(vaddr,npages, | 53 | err = change_page_attr_addr(vaddr, npages, prot); |
54 | MAKE_GLOBAL(__PAGE_KERNEL|flags)); | 54 | |
55 | if (!err) | 55 | if (!err) |
56 | global_flush_tlb(); | 56 | global_flush_tlb(); |
57 | } | 57 | } |
@@ -97,7 +97,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
97 | /* | 97 | /* |
98 | * Ok, go for it.. | 98 | * Ok, go for it.. |
99 | */ | 99 | */ |
100 | area = get_vm_area(size, VM_IOREMAP | (flags << 20)); | 100 | area = get_vm_area(size, VM_IOREMAP); |
101 | if (!area) | 101 | if (!area) |
102 | return NULL; | 102 | return NULL; |
103 | area->phys_addr = phys_addr; | 103 | area->phys_addr = phys_addr; |
@@ -107,8 +107,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
107 | remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr)); | 107 | remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr)); |
108 | return NULL; | 108 | return NULL; |
109 | } | 109 | } |
110 | if (flags && ioremap_change_attr(phys_addr, size, flags) < 0) { | 110 | if (ioremap_change_attr(phys_addr, size, pgprot) < 0) { |
111 | area->flags &= 0xffffff; | ||
112 | vunmap(addr); | 111 | vunmap(addr); |
113 | return NULL; | 112 | return NULL; |
114 | } | 113 | } |
@@ -180,8 +179,7 @@ void iounmap(volatile void __iomem *addr) | |||
180 | } | 179 | } |
181 | 180 | ||
182 | /* Reset the direct mapping. Can block */ | 181 | /* Reset the direct mapping. Can block */ |
183 | if (p->flags >> 20) | 182 | ioremap_change_attr(p->phys_addr, p->size, PAGE_KERNEL); |
184 | ioremap_change_attr(p->phys_addr, p->size, 0); | ||
185 | 183 | ||
186 | /* Finally remove it */ | 184 | /* Finally remove it */ |
187 | o = remove_vm_area((void *)addr); | 185 | o = remove_vm_area((void *)addr); |