diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/pat.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 72c0f6097402..64cc0c18233e 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -419,3 +419,42 @@ int free_memtype(u64 start, u64 end) | |||
419 | return err; | 419 | return err; |
420 | } | 420 | } |
421 | 421 | ||
422 | |||
423 | /* /dev/mem interface. Use the previous mapping */ | ||
424 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | ||
425 | unsigned long size, pgprot_t vma_prot) | ||
426 | { | ||
427 | return vma_prot; | ||
428 | } | ||
429 | |||
430 | int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | ||
431 | unsigned long size, pgprot_t *vma_prot) | ||
432 | { | ||
433 | |||
434 | if (file->f_flags & O_SYNC) { | ||
435 | *vma_prot = pgprot_noncached(*vma_prot); | ||
436 | return 1; | ||
437 | } | ||
438 | |||
439 | #ifdef CONFIG_X86_32 | ||
440 | /* | ||
441 | * On the PPro and successors, the MTRRs are used to set | ||
442 | * memory types for physical addresses outside main memory, | ||
443 | * so blindly setting UC or PWT on those pages is wrong. | ||
444 | * For Pentiums and earlier, the surround logic should disable | ||
445 | * caching for the high addresses through the KEN pin, but | ||
446 | * we maintain the tradition of paranoia in this code. | ||
447 | */ | ||
448 | if (!pat_wc_enabled && | ||
449 | ! ( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) || | ||
450 | test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) || | ||
451 | test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || | ||
452 | test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability)) && | ||
453 | (pfn << PAGE_SHIFT) >= __pa(high_memory)) { | ||
454 | *vma_prot = pgprot_noncached(*vma_prot); | ||
455 | return 1; | ||
456 | } | ||
457 | #endif | ||
458 | |||
459 | return 1; | ||
460 | } | ||