aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pat.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2014-11-03 08:01:58 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-11-16 05:04:26 -0500
commitb14097bd911c2554b0b5271b3a6b2d84044d1843 (patch)
tree132d919af20e58bd1f14fca6cf3615287f58773d /arch/x86/mm/pat.c
parentc06814d8419a74528500f85faf5fc01f67f8e7e6 (diff)
x86: Use new cache mode type in mm/ioremap.c
Instead of directly using the cache mode bits in the pte switch to using the cache mode type. Based-on-patch-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: stefan.bader@canonical.com Cc: xen-devel@lists.xensource.com Cc: konrad.wilk@oracle.com Cc: ville.syrjala@linux.intel.com Cc: david.vrabel@citrix.com Cc: jbeulich@suse.com Cc: toshi.kani@hp.com Cc: plagnioj@jcrosoft.com Cc: tomi.valkeinen@ti.com Cc: bhelgaas@google.com Link: http://lkml.kernel.org/r/1415019724-4317-13-git-send-email-jgross@suse.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pat.c')
-rw-r--r--arch/x86/mm/pat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 2f3744fdc741..8f68a83491ba 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -462,7 +462,7 @@ int io_reserve_memtype(resource_size_t start, resource_size_t end,
462 if (!is_new_memtype_allowed(start, size, req_type, new_type)) 462 if (!is_new_memtype_allowed(start, size, req_type, new_type))
463 goto out_free; 463 goto out_free;
464 464
465 if (kernel_map_sync_memtype(start, size, new_prot) < 0) 465 if (kernel_map_sync_memtype(start, size, new_type) < 0)
466 goto out_free; 466 goto out_free;
467 467
468 *type = new_type; 468 *type = new_type;
@@ -560,7 +560,8 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
560 * Change the memory type for the physial address range in kernel identity 560 * Change the memory type for the physial address range in kernel identity
561 * mapping space if that range is a part of identity map. 561 * mapping space if that range is a part of identity map.
562 */ 562 */
563int kernel_map_sync_memtype(u64 base, unsigned long size, unsigned long flags) 563int kernel_map_sync_memtype(u64 base, unsigned long size,
564 enum page_cache_mode pcm)
564{ 565{
565 unsigned long id_sz; 566 unsigned long id_sz;
566 567
@@ -578,11 +579,11 @@ int kernel_map_sync_memtype(u64 base, unsigned long size, unsigned long flags)
578 __pa(high_memory) - base : 579 __pa(high_memory) - base :
579 size; 580 size;
580 581
581 if (ioremap_change_attr((unsigned long)__va(base), id_sz, flags) < 0) { 582 if (ioremap_change_attr((unsigned long)__va(base), id_sz, pcm) < 0) {
582 printk(KERN_INFO "%s:%d ioremap_change_attr failed %s " 583 printk(KERN_INFO "%s:%d ioremap_change_attr failed %s "
583 "for [mem %#010Lx-%#010Lx]\n", 584 "for [mem %#010Lx-%#010Lx]\n",
584 current->comm, current->pid, 585 current->comm, current->pid,
585 cattr_name(flags), 586 cattr_name(cachemode2protval(pcm)),
586 base, (unsigned long long)(base + size-1)); 587 base, (unsigned long long)(base + size-1));
587 return -EINVAL; 588 return -EINVAL;
588 } 589 }
@@ -656,7 +657,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
656 flags); 657 flags);
657 } 658 }
658 659
659 if (kernel_map_sync_memtype(paddr, size, flags) < 0) { 660 if (kernel_map_sync_memtype(paddr, size,
661 pgprot2cachemode(__pgprot(flags))) < 0) {
660 free_memtype(paddr, paddr + size); 662 free_memtype(paddr, paddr + size);
661 return -EINVAL; 663 return -EINVAL;
662 } 664 }