diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-11-16 12:59:19 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-11-16 12:59:19 -0500 |
commit | 0dbcae884779fdf7e2239a97ac7488877f0693d9 (patch) | |
tree | c220ca7af9542397538dcd0f288794b258739f8f /arch/x86/include/asm/cacheflush.h | |
parent | 47591df505129c9774af6cca2debf283a6e56ed7 (diff) |
x86: mm: Move PAT only functions to mm/pat.c
Commit e00c8cc93c1a "x86: Use new cache mode type in memtype related
functions" broke the ARCH=um build.
arch/x86/include/asm/cacheflush.h:67:36: error: return type is an incomplete type
static inline enum page_cache_mode get_page_memtype(struct page *pg)
The reason is simple. get_page_memtype() and set_page_memtype()
require enum page_cache_mode now, which is defined in
asm/pgtable_types.h. UM does not include that file for obvious reasons.
The simple solution is to move that functions to arch/x86/mm/pat.c
where the only callsites of this are located. They should have been
there in the first place.
Fixes: e00c8cc93c1a "x86: Use new cache mode type in memtype related functions"
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/x86/include/asm/cacheflush.h')
-rw-r--r-- | arch/x86/include/asm/cacheflush.h | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h index 157644bdf70e..47c8e32f621a 100644 --- a/arch/x86/include/asm/cacheflush.h +++ b/arch/x86/include/asm/cacheflush.h | |||
@@ -5,75 +5,6 @@ | |||
5 | #include <asm-generic/cacheflush.h> | 5 | #include <asm-generic/cacheflush.h> |
6 | #include <asm/special_insns.h> | 6 | #include <asm/special_insns.h> |
7 | 7 | ||
8 | #ifdef CONFIG_X86_PAT | ||
9 | /* | ||
10 | * X86 PAT uses page flags WC and Uncached together to keep track of | ||
11 | * memory type of pages that have backing page struct. X86 PAT supports 3 | ||
12 | * different memory types, _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC and | ||
13 | * _PAGE_CACHE_MODE_UC_MINUS and fourth state where page's memory type has not | ||
14 | * been changed from its default (value of -1 used to denote this). | ||
15 | * Note we do not support _PAGE_CACHE_MODE_UC here. | ||
16 | */ | ||
17 | |||
18 | #define _PGMT_DEFAULT 0 | ||
19 | #define _PGMT_WC (1UL << PG_arch_1) | ||
20 | #define _PGMT_UC_MINUS (1UL << PG_uncached) | ||
21 | #define _PGMT_WB (1UL << PG_uncached | 1UL << PG_arch_1) | ||
22 | #define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1) | ||
23 | #define _PGMT_CLEAR_MASK (~_PGMT_MASK) | ||
24 | |||
25 | static inline enum page_cache_mode get_page_memtype(struct page *pg) | ||
26 | { | ||
27 | unsigned long pg_flags = pg->flags & _PGMT_MASK; | ||
28 | |||
29 | if (pg_flags == _PGMT_DEFAULT) | ||
30 | return -1; | ||
31 | else if (pg_flags == _PGMT_WC) | ||
32 | return _PAGE_CACHE_MODE_WC; | ||
33 | else if (pg_flags == _PGMT_UC_MINUS) | ||
34 | return _PAGE_CACHE_MODE_UC_MINUS; | ||
35 | else | ||
36 | return _PAGE_CACHE_MODE_WB; | ||
37 | } | ||
38 | |||
39 | static inline void set_page_memtype(struct page *pg, | ||
40 | enum page_cache_mode memtype) | ||
41 | { | ||
42 | unsigned long memtype_flags; | ||
43 | unsigned long old_flags; | ||
44 | unsigned long new_flags; | ||
45 | |||
46 | switch (memtype) { | ||
47 | case _PAGE_CACHE_MODE_WC: | ||
48 | memtype_flags = _PGMT_WC; | ||
49 | break; | ||
50 | case _PAGE_CACHE_MODE_UC_MINUS: | ||
51 | memtype_flags = _PGMT_UC_MINUS; | ||
52 | break; | ||
53 | case _PAGE_CACHE_MODE_WB: | ||
54 | memtype_flags = _PGMT_WB; | ||
55 | break; | ||
56 | default: | ||
57 | memtype_flags = _PGMT_DEFAULT; | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | do { | ||
62 | old_flags = pg->flags; | ||
63 | new_flags = (old_flags & _PGMT_CLEAR_MASK) | memtype_flags; | ||
64 | } while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags); | ||
65 | } | ||
66 | #else | ||
67 | static inline enum page_cache_mode get_page_memtype(struct page *pg) | ||
68 | { | ||
69 | return -1; | ||
70 | } | ||
71 | static inline void set_page_memtype(struct page *pg, | ||
72 | enum page_cache_mode memtype) | ||
73 | { | ||
74 | } | ||
75 | #endif | ||
76 | |||
77 | /* | 8 | /* |
78 | * The set_memory_* API can be used to change various attributes of a virtual | 9 | * The set_memory_* API can be used to change various attributes of a virtual |
79 | * address range. The attributes include: | 10 | * address range. The attributes include: |