diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-04 12:15:51 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-04 12:15:51 -0400 |
| commit | 4ded383569d6316d68d2aed298f8eb8d7bca37af (patch) | |
| tree | 87849300140f7a1c4d4efc78760156826cb28557 /arch/x86/mm/pat.c | |
| parent | e97dcb0eadbb821eccd549d4987b653cf61e2374 (diff) | |
| parent | 870568b39064cab2dd971fe57969916036982862 (diff) | |
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip:
x86, fpu: fix CONFIG_PREEMPT=y corruption of application's FPU stack
suspend-vs-iommu: prevent suspend if we could not resume
x86: section mismatch fix
x86: fix Xorg crash with xf86MapVidMem error
x86: fix pointer type warning in arch/x86/mm/init_64.c:early_memtest
x86: fix bad pmd ffff810000207xxx(9090909090909090)
x86: ioremap fix failing nesting check
x86: fix broken math-emu with lazy allocation of fpu area
x86: enable preemption in delay
x86: disable preemption in native_smp_prepare_cpus
x86: fix APIC warning on 32bit v2
Diffstat (limited to 'arch/x86/mm/pat.c')
| -rw-r--r-- | arch/x86/mm/pat.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index de3a99812450..06b7a1c90fb8 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
| @@ -34,7 +34,7 @@ void __cpuinit pat_disable(char *reason) | |||
| 34 | printk(KERN_INFO "%s\n", reason); | 34 | printk(KERN_INFO "%s\n", reason); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static int nopat(char *str) | 37 | static int __init nopat(char *str) |
| 38 | { | 38 | { |
| 39 | pat_disable("PAT support disabled."); | 39 | pat_disable("PAT support disabled."); |
| 40 | return 0; | 40 | return 0; |
| @@ -151,32 +151,33 @@ static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot, | |||
| 151 | unsigned long pat_type; | 151 | unsigned long pat_type; |
| 152 | u8 mtrr_type; | 152 | u8 mtrr_type; |
| 153 | 153 | ||
| 154 | mtrr_type = mtrr_type_lookup(start, end); | ||
| 155 | if (mtrr_type == 0xFF) { /* MTRR not enabled */ | ||
| 156 | *ret_prot = prot; | ||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | if (mtrr_type == 0xFE) { /* MTRR match error */ | ||
| 160 | *ret_prot = _PAGE_CACHE_UC; | ||
| 161 | return -1; | ||
| 162 | } | ||
| 163 | if (mtrr_type != MTRR_TYPE_UNCACHABLE && | ||
| 164 | mtrr_type != MTRR_TYPE_WRBACK && | ||
| 165 | mtrr_type != MTRR_TYPE_WRCOMB) { /* MTRR type unhandled */ | ||
| 166 | *ret_prot = _PAGE_CACHE_UC; | ||
| 167 | return -1; | ||
| 168 | } | ||
| 169 | |||
| 170 | pat_type = prot & _PAGE_CACHE_MASK; | 154 | pat_type = prot & _PAGE_CACHE_MASK; |
| 171 | prot &= (~_PAGE_CACHE_MASK); | 155 | prot &= (~_PAGE_CACHE_MASK); |
| 172 | 156 | ||
| 173 | /* Currently doing intersection by hand. Optimize it later. */ | 157 | /* |
| 158 | * We return the PAT request directly for types where PAT takes | ||
| 159 | * precedence with respect to MTRR and for UC_MINUS. | ||
| 160 | * Consistency checks with other PAT requests is done later | ||
| 161 | * while going through memtype list. | ||
| 162 | */ | ||
| 174 | if (pat_type == _PAGE_CACHE_WC) { | 163 | if (pat_type == _PAGE_CACHE_WC) { |
| 175 | *ret_prot = prot | _PAGE_CACHE_WC; | 164 | *ret_prot = prot | _PAGE_CACHE_WC; |
| 165 | return 0; | ||
| 176 | } else if (pat_type == _PAGE_CACHE_UC_MINUS) { | 166 | } else if (pat_type == _PAGE_CACHE_UC_MINUS) { |
| 177 | *ret_prot = prot | _PAGE_CACHE_UC_MINUS; | 167 | *ret_prot = prot | _PAGE_CACHE_UC_MINUS; |
| 178 | } else if (pat_type == _PAGE_CACHE_UC || | 168 | return 0; |
| 179 | mtrr_type == MTRR_TYPE_UNCACHABLE) { | 169 | } else if (pat_type == _PAGE_CACHE_UC) { |
| 170 | *ret_prot = prot | _PAGE_CACHE_UC; | ||
| 171 | return 0; | ||
| 172 | } | ||
| 173 | |||
| 174 | /* | ||
| 175 | * Look for MTRR hint to get the effective type in case where PAT | ||
| 176 | * request is for WB. | ||
| 177 | */ | ||
| 178 | mtrr_type = mtrr_type_lookup(start, end); | ||
| 179 | |||
| 180 | if (mtrr_type == MTRR_TYPE_UNCACHABLE) { | ||
| 180 | *ret_prot = prot | _PAGE_CACHE_UC; | 181 | *ret_prot = prot | _PAGE_CACHE_UC; |
| 181 | } else if (mtrr_type == MTRR_TYPE_WRCOMB) { | 182 | } else if (mtrr_type == MTRR_TYPE_WRCOMB) { |
| 182 | *ret_prot = prot | _PAGE_CACHE_WC; | 183 | *ret_prot = prot | _PAGE_CACHE_WC; |
| @@ -233,14 +234,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
| 233 | 234 | ||
| 234 | if (req_type == -1) { | 235 | if (req_type == -1) { |
| 235 | /* | 236 | /* |
| 236 | * Special case where caller wants to inherit from mtrr or | 237 | * Call mtrr_lookup to get the type hint. This is an |
| 237 | * existing pat mapping, defaulting to UC_MINUS in case of | 238 | * optimization for /dev/mem mmap'ers into WB memory (BIOS |
| 238 | * no match. | 239 | * tools and ACPI tools). Use WB request for WB memory and use |
| 240 | * UC_MINUS otherwise. | ||
| 239 | */ | 241 | */ |
| 240 | u8 mtrr_type = mtrr_type_lookup(start, end); | 242 | u8 mtrr_type = mtrr_type_lookup(start, end); |
| 241 | if (mtrr_type == 0xFE) { /* MTRR match error */ | ||
| 242 | err = -1; | ||
| 243 | } | ||
| 244 | 243 | ||
| 245 | if (mtrr_type == MTRR_TYPE_WRBACK) { | 244 | if (mtrr_type == MTRR_TYPE_WRBACK) { |
| 246 | req_type = _PAGE_CACHE_WB; | 245 | req_type = _PAGE_CACHE_WB; |
