aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/pgtable.h19
-rw-r--r--arch/x86/mm/ioremap.c3
-rw-r--r--arch/x86/mm/pat.c8
3 files changed, 18 insertions, 12 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index aa97a070f09f..c112ea63f40d 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -9,9 +9,10 @@
9/* 9/*
10 * Macro to mark a page protection value as UC- 10 * Macro to mark a page protection value as UC-
11 */ 11 */
12#define pgprot_noncached(prot) \ 12#define pgprot_noncached(prot) \
13 ((boot_cpu_data.x86 > 3) \ 13 ((boot_cpu_data.x86 > 3) \
14 ? (__pgprot(pgprot_val(prot) | _PAGE_CACHE_UC_MINUS)) \ 14 ? (__pgprot(pgprot_val(prot) | \
15 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))) \
15 : (prot)) 16 : (prot))
16 17
17#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
@@ -404,8 +405,8 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
404#define canon_pgprot(p) __pgprot(massage_pgprot(p)) 405#define canon_pgprot(p) __pgprot(massage_pgprot(p))
405 406
406static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, 407static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
407 unsigned long flags, 408 enum page_cache_mode pcm,
408 unsigned long new_flags) 409 enum page_cache_mode new_pcm)
409{ 410{
410 /* 411 /*
411 * PAT type is always WB for untracked ranges, so no need to check. 412 * PAT type is always WB for untracked ranges, so no need to check.
@@ -419,10 +420,10 @@ static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
419 * - request is uncached, return cannot be write-back 420 * - request is uncached, return cannot be write-back
420 * - request is write-combine, return cannot be write-back 421 * - request is write-combine, return cannot be write-back
421 */ 422 */
422 if ((flags == _PAGE_CACHE_UC_MINUS && 423 if ((pcm == _PAGE_CACHE_MODE_UC_MINUS &&
423 new_flags == _PAGE_CACHE_WB) || 424 new_pcm == _PAGE_CACHE_MODE_WB) ||
424 (flags == _PAGE_CACHE_WC && 425 (pcm == _PAGE_CACHE_MODE_WC &&
425 new_flags == _PAGE_CACHE_WB)) { 426 new_pcm == _PAGE_CACHE_MODE_WB)) {
426 return 0; 427 return 0;
427 } 428 }
428 429
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index af78e50ca6ce..3a81eb9aad78 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -142,7 +142,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
142 142
143 if (prot_val != new_prot_val) { 143 if (prot_val != new_prot_val) {
144 if (!is_new_memtype_allowed(phys_addr, size, 144 if (!is_new_memtype_allowed(phys_addr, size,
145 prot_val, new_prot_val)) { 145 pgprot2cachemode(__pgprot(prot_val)),
146 pgprot2cachemode(__pgprot(new_prot_val)))) {
146 printk(KERN_ERR 147 printk(KERN_ERR
147 "ioremap error for 0x%llx-0x%llx, requested 0x%lx, got 0x%lx\n", 148 "ioremap error for 0x%llx-0x%llx, requested 0x%lx, got 0x%lx\n",
148 (unsigned long long)phys_addr, 149 (unsigned long long)phys_addr,
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 657438858e83..47282c273647 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -455,7 +455,9 @@ int io_reserve_memtype(resource_size_t start, resource_size_t end,
455 if (ret) 455 if (ret)
456 goto out_err; 456 goto out_err;
457 457
458 if (!is_new_memtype_allowed(start, size, req_type, new_type)) 458 if (!is_new_memtype_allowed(start, size,
459 pgprot2cachemode(__pgprot(req_type)),
460 pgprot2cachemode(__pgprot(new_type))))
459 goto out_free; 461 goto out_free;
460 462
461 if (kernel_map_sync_memtype(start, size, new_type) < 0) 463 if (kernel_map_sync_memtype(start, size, new_type) < 0)
@@ -630,7 +632,9 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
630 632
631 if (flags != want_flags) { 633 if (flags != want_flags) {
632 if (strict_prot || 634 if (strict_prot ||
633 !is_new_memtype_allowed(paddr, size, want_flags, flags)) { 635 !is_new_memtype_allowed(paddr, size,
636 pgprot2cachemode(__pgprot(want_flags)),
637 pgprot2cachemode(__pgprot(flags)))) {
634 free_memtype(paddr, paddr + size); 638 free_memtype(paddr, paddr + size);
635 printk(KERN_ERR "%s:%d map pfn expected mapping type %s" 639 printk(KERN_ERR "%s:%d map pfn expected mapping type %s"
636 " for [mem %#010Lx-%#010Lx], got %s\n", 640 " for [mem %#010Lx-%#010Lx], got %s\n",