diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-04-25 20:07:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-30 17:15:35 -0400 |
commit | de33c442ed2a465d2d7804b26dafd2eec067aa34 (patch) | |
tree | 02a9cb2b96d0ad535f0dbfbdccc35afe21aa052e /arch/x86 | |
parent | b9b39bfba5b0de3418305f01cfa7bc55a16004e1 (diff) |
x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range()
Use UC_MINUS for ioremap(), ioremap_nocache() instead of strong UC.
Once all the X drivers move to ioremap_wc(), we can go back to strong
UC semantics for ioremap() and ioremap_nocache().
To avoid attribute aliasing issues, pci_mmap_page_range() will also
use UC_MINUS for default non write-combining mapping request.
Next steps:
a) change all the video drivers using ioremap() or ioremap_nocache()
and adding WC MTTR using mttr_add() to ioremap_wc()
b) for strict usage, we can go back to strong uc semantics
for ioremap() and ioremap_nocache() after some grace period for
completing step-a.
c) user level X server needs to use the appropriate method for setting
up WC mapping (like using resourceX_wc sysfs file instead of
adding MTRR for WC and using /dev/mem or resourceX under /sys)
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/ioremap.c | 20 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 10 | ||||
-rw-r--r-- | arch/x86/pci/i386.c | 12 |
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 | */ |
256 | void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) | 259 | void __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 | } |
261 | EXPORT_SYMBOL(ioremap_nocache); | 273 | EXPORT_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 | ||
778 | int _set_memory_uc(unsigned long addr, int numpages) | 778 | int _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 | ||
784 | int set_memory_uc(unsigned long addr, int numpages) | 787 | int 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); |