diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-10-24 18:58:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-02-04 06:10:41 -0500 |
commit | 375074cc736ab1d89a708c0a8d7baa4a70d5d476 (patch) | |
tree | e7ceb81f6fc54814fc57716a79f8d232f5e6afb8 /arch/x86/kernel/process.c | |
parent | 0967160ad615985c7c35443156ea9aecc60c37b8 (diff) |
x86: Clean up cr4 manipulation
CR4 manipulation was split, seemingly at random, between direct
(write_cr4) and using a helper (set/clear_in_cr4). Unfortunately,
the set_in_cr4 and clear_in_cr4 helpers also poke at the boot code,
which only a small subset of users actually wanted.
This patch replaces all cr4 access in functions that don't leave cr4
exactly the way they found it with new helpers cr4_set_bits,
cr4_clear_bits, and cr4_set_bits_and_update_boot.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Vince Weaver <vince@deater.net>
Cc: "hillf.zj" <hillf.zj@alibaba-inc.com>
Cc: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/495a10bdc9e67016b8fd3945700d46cfd5c12c2f.1414190806.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index e127ddaa2d5a..046e2d620bbe 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/fpu-internal.h> | 28 | #include <asm/fpu-internal.h> |
29 | #include <asm/debugreg.h> | 29 | #include <asm/debugreg.h> |
30 | #include <asm/nmi.h> | 30 | #include <asm/nmi.h> |
31 | #include <asm/tlbflush.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | 34 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, |
@@ -141,7 +142,7 @@ void flush_thread(void) | |||
141 | 142 | ||
142 | static void hard_disable_TSC(void) | 143 | static void hard_disable_TSC(void) |
143 | { | 144 | { |
144 | write_cr4(read_cr4() | X86_CR4_TSD); | 145 | cr4_set_bits(X86_CR4_TSD); |
145 | } | 146 | } |
146 | 147 | ||
147 | void disable_TSC(void) | 148 | void disable_TSC(void) |
@@ -158,7 +159,7 @@ void disable_TSC(void) | |||
158 | 159 | ||
159 | static void hard_enable_TSC(void) | 160 | static void hard_enable_TSC(void) |
160 | { | 161 | { |
161 | write_cr4(read_cr4() & ~X86_CR4_TSD); | 162 | cr4_clear_bits(X86_CR4_TSD); |
162 | } | 163 | } |
163 | 164 | ||
164 | static void enable_TSC(void) | 165 | static void enable_TSC(void) |