diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mtrr/state.c')
-rw-r--r-- | arch/x86/kernel/cpu/mtrr/state.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/state.c b/arch/x86/kernel/cpu/mtrr/state.c index 9f8ba923d1c9..7f7e2753685b 100644 --- a/arch/x86/kernel/cpu/mtrr/state.c +++ b/arch/x86/kernel/cpu/mtrr/state.c | |||
@@ -19,13 +19,15 @@ void set_mtrr_prepare_save(struct set_mtrr_context *ctxt) | |||
19 | if (use_intel() || is_cpu(CYRIX)) { | 19 | if (use_intel() || is_cpu(CYRIX)) { |
20 | 20 | ||
21 | /* Save value of CR4 and clear Page Global Enable (bit 7) */ | 21 | /* Save value of CR4 and clear Page Global Enable (bit 7) */ |
22 | if ( cpu_has_pge ) { | 22 | if (cpu_has_pge) { |
23 | ctxt->cr4val = read_cr4(); | 23 | ctxt->cr4val = read_cr4(); |
24 | write_cr4(ctxt->cr4val & ~X86_CR4_PGE); | 24 | write_cr4(ctxt->cr4val & ~X86_CR4_PGE); |
25 | } | 25 | } |
26 | 26 | ||
27 | /* Disable and flush caches. Note that wbinvd flushes the TLBs as | 27 | /* |
28 | a side-effect */ | 28 | * Disable and flush caches. Note that wbinvd flushes the TLBs |
29 | * as a side-effect | ||
30 | */ | ||
29 | cr0 = read_cr0() | X86_CR0_CD; | 31 | cr0 = read_cr0() | X86_CR0_CD; |
30 | wbinvd(); | 32 | wbinvd(); |
31 | write_cr0(cr0); | 33 | write_cr0(cr0); |
@@ -42,7 +44,7 @@ void set_mtrr_prepare_save(struct set_mtrr_context *ctxt) | |||
42 | 44 | ||
43 | void set_mtrr_cache_disable(struct set_mtrr_context *ctxt) | 45 | void set_mtrr_cache_disable(struct set_mtrr_context *ctxt) |
44 | { | 46 | { |
45 | if (use_intel()) | 47 | if (use_intel()) |
46 | /* Disable MTRRs, and set the default type to uncached */ | 48 | /* Disable MTRRs, and set the default type to uncached */ |
47 | mtrr_wrmsr(MTRRdefType_MSR, ctxt->deftype_lo & 0xf300UL, | 49 | mtrr_wrmsr(MTRRdefType_MSR, ctxt->deftype_lo & 0xf300UL, |
48 | ctxt->deftype_hi); | 50 | ctxt->deftype_hi); |
@@ -66,12 +68,12 @@ void set_mtrr_done(struct set_mtrr_context *ctxt) | |||
66 | else | 68 | else |
67 | /* Cyrix ARRs - everything else was excluded at the top */ | 69 | /* Cyrix ARRs - everything else was excluded at the top */ |
68 | setCx86(CX86_CCR3, ctxt->ccr3); | 70 | setCx86(CX86_CCR3, ctxt->ccr3); |
69 | 71 | ||
70 | /* Enable caches */ | 72 | /* Enable caches */ |
71 | write_cr0(read_cr0() & 0xbfffffff); | 73 | write_cr0(read_cr0() & 0xbfffffff); |
72 | 74 | ||
73 | /* Restore value of CR4 */ | 75 | /* Restore value of CR4 */ |
74 | if ( cpu_has_pge ) | 76 | if (cpu_has_pge) |
75 | write_cr4(ctxt->cr4val); | 77 | write_cr4(ctxt->cr4val); |
76 | } | 78 | } |
77 | /* Re-enable interrupts locally (if enabled previously) */ | 79 | /* Re-enable interrupts locally (if enabled previously) */ |