aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2015-11-23 05:59:24 -0500
committerIngo Molnar <mingo@kernel.org>2015-11-24 03:18:33 -0500
commit42baa2581c92f8d07e7260506c8d41caf14b0fc3 (patch)
tree2e0151e4c2219f03c11aae4a034db1c3c5721daa
parent2fde46b79e2fdbc90d0d97cf992782732b5a371c (diff)
x86/apic: Fix the saving and restoring of lapic vectors during suspend/resume
Saving and restoring lapic vectors in lapic_suspend() and lapic_resume() is not consistent: the thmr vector saving is guarded by a different config option than the restore part. The cmci vector isn't handled at all. Those inconsistencies are not very critical, as the missing cmci vector will be set via mce resume handling, the wrong config option used for restoring the thmr vector can't be configured differently than the one which should be used. Nevertheless correct the thmr vector restore and add cmci vector handling. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1448276364-31334-1-git-send-email-jgross@suse.com [ Minor code edits. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/apic/apic.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2f69e3b184f6..8d7df7478d84 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2270,6 +2270,7 @@ static struct {
2270 unsigned int apic_tmict; 2270 unsigned int apic_tmict;
2271 unsigned int apic_tdcr; 2271 unsigned int apic_tdcr;
2272 unsigned int apic_thmr; 2272 unsigned int apic_thmr;
2273 unsigned int apic_cmci;
2273} apic_pm_state; 2274} apic_pm_state;
2274 2275
2275static int lapic_suspend(void) 2276static int lapic_suspend(void)
@@ -2299,6 +2300,10 @@ static int lapic_suspend(void)
2299 if (maxlvt >= 5) 2300 if (maxlvt >= 5)
2300 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR); 2301 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
2301#endif 2302#endif
2303#ifdef CONFIG_X86_MCE_INTEL
2304 if (maxlvt >= 6)
2305 apic_pm_state.apic_cmci = apic_read(APIC_LVTCMCI);
2306#endif
2302 2307
2303 local_irq_save(flags); 2308 local_irq_save(flags);
2304 disable_local_APIC(); 2309 disable_local_APIC();
@@ -2355,10 +2360,14 @@ static void lapic_resume(void)
2355 apic_write(APIC_SPIV, apic_pm_state.apic_spiv); 2360 apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
2356 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); 2361 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
2357 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); 2362 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
2358#if defined(CONFIG_X86_MCE_INTEL) 2363#ifdef CONFIG_X86_THERMAL_VECTOR
2359 if (maxlvt >= 5) 2364 if (maxlvt >= 5)
2360 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr); 2365 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
2361#endif 2366#endif
2367#ifdef CONFIG_X86_MCE_INTEL
2368 if (maxlvt >= 6)
2369 apic_write(APIC_LVTCMCI, apic_pm_state.apic_cmci);
2370#endif
2362 if (maxlvt >= 4) 2371 if (maxlvt >= 4)
2363 apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc); 2372 apic_write(APIC_LVTPC, apic_pm_state.apic_lvtpc);
2364 apic_write(APIC_LVTT, apic_pm_state.apic_lvtt); 2373 apic_write(APIC_LVTT, apic_pm_state.apic_lvtt);