Merge branch 'x86-pat-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / arch / x86 / mm / pat.c
index 81fb75344cd3e3f2353904b44a95ea73d0167da4..66b55d6e69ed8d74f2479ab567a6ddab4829ae05 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
 #include <asm/tlbflush.h>
+#include <asm/x86_init.h>
 #include <asm/pgtable.h>
 #include <asm/fcntl.h>
 #include <asm/e820.h>
@@ -383,7 +384,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
        }
 
        /* Low ISA region is always mapped WB in page table. No need to track */
-       if (is_ISA_range(start, end - 1)) {
+       if (x86_platform.is_untracked_pat_range(start, end)) {
                if (new_type)
                        *new_type = _PAGE_CACHE_WB;
                return 0;
@@ -494,7 +495,7 @@ int free_memtype(u64 start, u64 end)
                return 0;
 
        /* Low ISA region is always mapped WB. No need to track */
-       if (is_ISA_range(start, end - 1))
+       if (x86_platform.is_untracked_pat_range(start, end))
                return 0;
 
        is_range_ram = pat_pagerange_is_ram(start, end);
@@ -577,7 +578,7 @@ static unsigned long lookup_memtype(u64 paddr)
        int rettype = _PAGE_CACHE_WB;
        struct memtype *entry;
 
-       if (is_ISA_range(paddr, paddr + PAGE_SIZE - 1))
+       if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE))
                return rettype;
 
        if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {
@@ -1013,8 +1014,10 @@ static const struct file_operations memtype_fops = {
 
 static int __init pat_memtype_list_init(void)
 {
-       debugfs_create_file("pat_memtype_list", S_IRUSR, arch_debugfs_dir,
-                               NULL, &memtype_fops);
+       if (pat_enabled) {
+               debugfs_create_file("pat_memtype_list", S_IRUSR,
+                                   arch_debugfs_dir, NULL, &memtype_fops);
+       }
        return 0;
 }