summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/cacheflush.h
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2014-11-03 14:01:59 +0100
committerThomas Gleixner <tglx@linutronix.de>2014-11-16 11:04:26 +0100
commite00c8cc93c1ac01ecd5049929a50fb47b62bb041 (patch)
treea3833abca982fc685332340bb604dc925eb91c24 /arch/x86/include/asm/cacheflush.h
parentb14097bd911c2554b0b5271b3a6b2d84044d1843 (diff)
downloadlinux-stable-e00c8cc93c1ac01ecd5049929a50fb47b62bb041.tar.gz
linux-stable-e00c8cc93c1ac01ecd5049929a50fb47b62bb041.tar.bz2
linux-stable-e00c8cc93c1ac01ecd5049929a50fb47b62bb041.zip
x86: Use new cache mode type in memtype related functions
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-14-git-send-email-jgross@suse.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include/asm/cacheflush.h')
-rw-r--r--arch/x86/include/asm/cacheflush.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h
index 9863ee3747da..157644bdf70e 100644
--- a/arch/x86/include/asm/cacheflush.h
+++ b/arch/x86/include/asm/cacheflush.h
@@ -9,10 +9,10 @@
/*
* X86 PAT uses page flags WC and Uncached together to keep track of
* memory type of pages that have backing page struct. X86 PAT supports 3
- * different memory types, _PAGE_CACHE_WB, _PAGE_CACHE_WC and
- * _PAGE_CACHE_UC_MINUS and fourth state where page's memory type has not
+ * different memory types, _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC and
+ * _PAGE_CACHE_MODE_UC_MINUS and fourth state where page's memory type has not
* been changed from its default (value of -1 used to denote this).
- * Note we do not support _PAGE_CACHE_UC here.
+ * Note we do not support _PAGE_CACHE_MODE_UC here.
*/
#define _PGMT_DEFAULT 0
@@ -22,36 +22,40 @@
#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
-static inline unsigned long get_page_memtype(struct page *pg)
+static inline enum page_cache_mode get_page_memtype(struct page *pg)
{
unsigned long pg_flags = pg->flags & _PGMT_MASK;
if (pg_flags == _PGMT_DEFAULT)
return -1;
else if (pg_flags == _PGMT_WC)
- return _PAGE_CACHE_WC;
+ return _PAGE_CACHE_MODE_WC;
else if (pg_flags == _PGMT_UC_MINUS)
- return _PAGE_CACHE_UC_MINUS;
+ return _PAGE_CACHE_MODE_UC_MINUS;
else
- return _PAGE_CACHE_WB;
+ return _PAGE_CACHE_MODE_WB;
}
-static inline void set_page_memtype(struct page *pg, unsigned long memtype)
+static inline void set_page_memtype(struct page *pg,
+ enum page_cache_mode memtype)
{
- unsigned long memtype_flags = _PGMT_DEFAULT;
+ unsigned long memtype_flags;
unsigned long old_flags;
unsigned long new_flags;
switch (memtype) {
- case _PAGE_CACHE_WC:
+ case _PAGE_CACHE_MODE_WC:
memtype_flags = _PGMT_WC;
break;
- case _PAGE_CACHE_UC_MINUS:
+ case _PAGE_CACHE_MODE_UC_MINUS:
memtype_flags = _PGMT_UC_MINUS;
break;
- case _PAGE_CACHE_WB:
+ case _PAGE_CACHE_MODE_WB:
memtype_flags = _PGMT_WB;
break;
+ default:
+ memtype_flags = _PGMT_DEFAULT;
+ break;
}
do {
@@ -60,8 +64,14 @@ static inline void set_page_memtype(struct page *pg, unsigned long memtype)
} while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags);
}
#else
-static inline unsigned long get_page_memtype(struct page *pg) { return -1; }
-static inline void set_page_memtype(struct page *pg, unsigned long memtype) { }
+static inline enum page_cache_mode get_page_memtype(struct page *pg)
+{
+ return -1;
+}
+static inline void set_page_memtype(struct page *pg,
+ enum page_cache_mode memtype)
+{
+}
#endif
/*