aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/cpu/mtrr/generic.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2005-07-07 20:56:38 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:23:42 -0400
commit3b520b238e018ef0e9d11c9115d5e7d9419c4ef9 (patch)
tree8b9bf3ccf2dd13dbbbcb4a3ff5028a351817b657 /arch/i386/kernel/cpu/mtrr/generic.c
parent01d299367fe868851a632cfbdb606845f57682aa (diff)
[PATCH] MTRR suspend/resume cleanup
There has been some discuss about solving the SMP MTRR suspend/resume breakage, but I didn't find a patch for it. This is an intent for it. The basic idea is moving mtrr initializing into cpu_identify for all APs (so it works for cpu hotplug). For BP, restore_processor_state is responsible for restoring MTRR. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu/mtrr/generic.c')
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index 64d91f73a0a4..169ac8e0db68 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -67,13 +67,6 @@ void __init get_mtrr_state(void)
67 mtrr_state.enabled = (lo & 0xc00) >> 10; 67 mtrr_state.enabled = (lo & 0xc00) >> 10;
68} 68}
69 69
70/* Free resources associated with a struct mtrr_state */
71void __init finalize_mtrr_state(void)
72{
73 kfree(mtrr_state.var_ranges);
74 mtrr_state.var_ranges = NULL;
75}
76
77/* Some BIOS's are fucked and don't set all MTRRs the same! */ 70/* Some BIOS's are fucked and don't set all MTRRs the same! */
78void __init mtrr_state_warn(void) 71void __init mtrr_state_warn(void)
79{ 72{
@@ -334,6 +327,9 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
334*/ 327*/
335{ 328{
336 unsigned long flags; 329 unsigned long flags;
330 struct mtrr_var_range *vr;
331
332 vr = &mtrr_state.var_ranges[reg];
337 333
338 local_irq_save(flags); 334 local_irq_save(flags);
339 prepare_set(); 335 prepare_set();
@@ -342,11 +338,15 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
342 /* The invalid bit is kept in the mask, so we simply clear the 338 /* The invalid bit is kept in the mask, so we simply clear the
343 relevant mask register to disable a range. */ 339 relevant mask register to disable a range. */
344 mtrr_wrmsr(MTRRphysMask_MSR(reg), 0, 0); 340 mtrr_wrmsr(MTRRphysMask_MSR(reg), 0, 0);
341 memset(vr, 0, sizeof(struct mtrr_var_range));
345 } else { 342 } else {
346 mtrr_wrmsr(MTRRphysBase_MSR(reg), base << PAGE_SHIFT | type, 343 vr->base_lo = base << PAGE_SHIFT | type;
347 (base & size_and_mask) >> (32 - PAGE_SHIFT)); 344 vr->base_hi = (base & size_and_mask) >> (32 - PAGE_SHIFT);
348 mtrr_wrmsr(MTRRphysMask_MSR(reg), -size << PAGE_SHIFT | 0x800, 345 vr->mask_lo = -size << PAGE_SHIFT | 0x800;
349 (-size & size_and_mask) >> (32 - PAGE_SHIFT)); 346 vr->mask_hi = (-size & size_and_mask) >> (32 - PAGE_SHIFT);
347
348 mtrr_wrmsr(MTRRphysBase_MSR(reg), vr->base_lo, vr->base_hi);
349 mtrr_wrmsr(MTRRphysMask_MSR(reg), vr->mask_lo, vr->mask_hi);
350 } 350 }
351 351
352 post_set(); 352 post_set();