1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Tim Chen <tim.c.chen@linux.intel.com>
3 Date: Wed, 15 Nov 2017 12:24:19 -0800
4 Subject: [PATCH] x86/idle: Disable IBRS when offlining cpu and re-enable on
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
13 Clear IBRS when cpu is offlined and set it when brining it back online.
15 Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
16 Signed-off-by: Andy Whitcroft <apw@canonical.com>
17 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
18 (cherry picked from commit 9bcf662c1690880b2464fe99d0f58dce53c0d89f)
19 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 arch/x86/kernel/smpboot.c | 7 +++++++
22 1 file changed, 7 insertions(+)
24 diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
25 index 398e8324fea4..a652bff7add4 100644
26 --- a/arch/x86/kernel/smpboot.c
27 +++ b/arch/x86/kernel/smpboot.c
29 #include <asm/i8259.h>
30 #include <asm/realmode.h>
32 +#include <asm/microcode.h>
34 /* Number of siblings per CPU package */
35 int smp_num_siblings = 1;
36 @@ -1692,9 +1693,15 @@ void native_play_dead(void)
38 tboot_shutdown(TB_SHUTDOWN_WFS);
40 + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
41 + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0);
43 mwait_play_dead(); /* Only returns on failure */
44 if (cpuidle_play_dead())
47 + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
48 + native_wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS);
51 #else /* ... !CONFIG_HOTPLUG_CPU */