aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/ioremap.c20
-rw-r--r--arch/x86/mm/pageattr.c10
-rw-r--r--arch/x86/pci/i386.c12
3 files changed, 33 insertions, 9 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 0be9f9c59aa6..6d02a36e5e49 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -176,11 +176,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
176 /* 176 /*
177 * Do not fallback to certain memory types with certain 177 * Do not fallback to certain memory types with certain
178 * requested type: 178 * requested type:
179 * - request is uncached, return cannot be write-back 179 * - request is uc-, return cannot be write-back
180 * - request is uncached, return cannot be write-combine 180 * - request is uc-, return cannot be write-combine
181 * - request is write-combine, return cannot be write-back 181 * - request is write-combine, return cannot be write-back
182 */ 182 */
183 if ((prot_val == _PAGE_CACHE_UC && 183 if ((prot_val == _PAGE_CACHE_UC_MINUS &&
184 (new_prot_val == _PAGE_CACHE_WB || 184 (new_prot_val == _PAGE_CACHE_WB ||
185 new_prot_val == _PAGE_CACHE_WC)) || 185 new_prot_val == _PAGE_CACHE_WC)) ||
186 (prot_val == _PAGE_CACHE_WC && 186 (prot_val == _PAGE_CACHE_WC &&
@@ -201,6 +201,9 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
201 default: 201 default:
202 prot = PAGE_KERNEL_NOCACHE; 202 prot = PAGE_KERNEL_NOCACHE;
203 break; 203 break;
204 case _PAGE_CACHE_UC_MINUS:
205 prot = PAGE_KERNEL_UC_MINUS;
206 break;
204 case _PAGE_CACHE_WC: 207 case _PAGE_CACHE_WC:
205 prot = PAGE_KERNEL_WC; 208 prot = PAGE_KERNEL_WC;
206 break; 209 break;
@@ -255,7 +258,16 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
255 */ 258 */
256void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) 259void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
257{ 260{
258 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_UC, 261 /*
262 * Ideally, this should be:
263 * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS;
264 *
265 * Till we fix all X drivers to use ioremap_wc(), we will use
266 * UC MINUS.
267 */
268 unsigned long val = _PAGE_CACHE_UC_MINUS;
269
270 return __ioremap_caller(phys_addr, size, val,
259 __builtin_return_address(0)); 271 __builtin_return_address(0));
260} 272}
261EXPORT_SYMBOL(ioremap_nocache); 273EXPORT_SYMBOL(ioremap_nocache);
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index bd5e05c654dc..60bcb5b6a37e 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -777,14 +777,20 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages,
777 777
778int _set_memory_uc(unsigned long addr, int numpages) 778int _set_memory_uc(unsigned long addr, int numpages)
779{ 779{
780 /*
781 * for now UC MINUS. see comments in ioremap_nocache()
782 */
780 return change_page_attr_set(addr, numpages, 783 return change_page_attr_set(addr, numpages,
781 __pgprot(_PAGE_CACHE_UC)); 784 __pgprot(_PAGE_CACHE_UC_MINUS));
782} 785}
783 786
784int set_memory_uc(unsigned long addr, int numpages) 787int set_memory_uc(unsigned long addr, int numpages)
785{ 788{
789 /*
790 * for now UC MINUS. see comments in ioremap_nocache()
791 */
786 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, 792 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
787 _PAGE_CACHE_UC, NULL)) 793 _PAGE_CACHE_UC_MINUS, NULL))
788 return -EINVAL; 794 return -EINVAL;
789 795
790 return _set_memory_uc(addr, numpages); 796 return _set_memory_uc(addr, numpages);
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 94f6c73a53d0..8af0f0bae2af 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -301,6 +301,13 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
301 prot = pgprot_val(vma->vm_page_prot); 301 prot = pgprot_val(vma->vm_page_prot);
302 if (pat_wc_enabled && write_combine) 302 if (pat_wc_enabled && write_combine)
303 prot |= _PAGE_CACHE_WC; 303 prot |= _PAGE_CACHE_WC;
304 else if (pat_wc_enabled)
305 /*
306 * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
307 * To avoid attribute conflicts, request UC MINUS here
308 * aswell.
309 */
310 prot |= _PAGE_CACHE_UC_MINUS;
304 else if (boot_cpu_data.x86 > 3) 311 else if (boot_cpu_data.x86 > 3)
305 prot |= _PAGE_CACHE_UC; 312 prot |= _PAGE_CACHE_UC;
306 313
@@ -319,9 +326,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
319 * - request is uncached, return cannot be write-combine 326 * - request is uncached, return cannot be write-combine
320 * - request is write-combine, return cannot be write-back 327 * - request is write-combine, return cannot be write-back
321 */ 328 */
322 if ((flags == _PAGE_CACHE_UC && 329 if ((flags == _PAGE_CACHE_UC_MINUS &&
323 (new_flags == _PAGE_CACHE_WB || 330 (new_flags == _PAGE_CACHE_WB)) ||
324 new_flags == _PAGE_CACHE_WC)) ||
325 (flags == _PAGE_CACHE_WC && 331 (flags == _PAGE_CACHE_WC &&
326 new_flags == _PAGE_CACHE_WB)) { 332 new_flags == _PAGE_CACHE_WB)) {
327 free_memtype(addr, addr+len); 333 free_memtype(addr, addr+len);