linux/arch/x86/kernel/cpu
Pawan Gupta 6606515742 x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3
The "force" argument to write_spec_ctrl_current() is currently ambiguous
as it does not guarantee the MSR write. This is due to the optimization
that writes to the MSR happen only when the new value differs from the
cached value.

This is fine in most cases, but breaks for S3 resume when the cached MSR
value gets out of sync with the hardware MSR value due to S3 resetting
it.

When x86_spec_ctrl_current is same as x86_spec_ctrl_base, the MSR write
is skipped. Which results in SPEC_CTRL mitigations not getting restored.

Move the MSR write from write_spec_ctrl_current() to a new function that
unconditionally writes to the MSR. Update the callers accordingly and
rename functions.

  [ bp: Rework a bit. ]

Fixes: caa0ff24d5 ("x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value")
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/806d39b0bfec2fe8f50dc5446dff20f5bb24a959.1669821572.git.pawan.kumar.gupta@linux.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-12-02 15:45:33 -08:00
..
mce x86/mce: Retrieve poison range from hardware 2022-08-29 09:33:42 +02:00
microcode x86/microcode/AMD: Apply the patch early on every logical thread 2022-10-18 11:03:27 +02:00
mtrr x86/mtrr: Replace deprecated CPU-hotplug functions. 2021-08-10 14:46:27 +02:00
resctrl x86/resctrl: Fix min_cbm_bits for AMD 2022-10-18 20:25:16 +02:00
sgx x86/sgx: Add overflow check in sgx_validate_offset_length() 2022-11-08 20:34:05 +01:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
acrn.c x86/acrn: Set up timekeeping 2022-08-04 11:11:59 +02:00
amd.c x86/cpu: Restore AMD's DE_CFG MSR after resume 2022-11-15 10:15:58 -08:00
aperfmperf.c x86/aperfmperf: Integrate the fallback code from show_cpuinfo() 2022-04-27 20:22:20 +02:00
bugs.c x86/bugs: Make sure MSR_SPEC_CTRL is updated properly upon resume from S3 2022-12-02 15:45:33 -08:00
cacheinfo.c x86/cacheinfo: move shared cache map definitions 2022-07-17 17:31:40 -07:00
centaur.c x86/cpu/centaur: Add Centaur family >=7 CPUs initialization support 2020-09-11 10:53:19 +02:00
common.c x86/bugs: Add "unknown" reporting for MMIO Stale Data 2022-08-18 15:35:22 +02:00
cpu.h x86/cpu/amd: Add Spectral Chicken 2022-06-27 10:34:00 +02:00
cpuid-deps.c x86/fpu: Optimize out sigframe xfeatures when in init state 2021-11-03 22:42:35 +01:00
cyrix.c x86/cyrix: include header linux/isa-dma.h 2022-07-26 14:03:12 -05:00
feat_ctl.c x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype 2022-09-26 17:06:27 +02:00
hygon.c x86/cpu: Restore AMD's DE_CFG MSR after resume 2022-11-15 10:15:58 -08:00
hypervisor.c
intel_epb.c x86: intel_epb: Allow model specific normal EPB value 2022-01-04 16:37:23 +01:00
intel_pconfig.c
intel.c x86/bus_lock: Don't assume the init value of DEBUGCTLMSR.BUS_LOCK_DETECT to be zero 2022-08-02 13:42:00 +02:00
Makefile x86: kmsan: disable instrumentation of unsupported code 2022-10-03 14:03:24 -07:00
match.c x86/cpu: Add a steppings field to struct x86_cpu_id 2020-04-20 12:19:21 +02:00
mkcapflags.sh
mshyperv.c hyperv-next for 5.19 2022-05-28 11:39:01 -07:00
perfctr-watchdog.c x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs 2021-06-10 10:04:40 +02:00
powerflags.c
proc.c x86/aperfmperf: Integrate the fallback code from show_cpuinfo() 2022-04-27 20:22:20 +02:00
rdrand.c x86/rdrand: Remove "nordrand" flag in favor of "random.trust_cpu" 2022-07-18 15:04:04 +02:00
scattered.c x86/cpufeatures: Add LbrExtV2 feature bit 2022-08-27 00:05:42 +02:00
topology.c x86/topology: Fix duplicated core ID within a package 2022-10-17 11:58:52 -07:00
transmeta.c
tsx.c x86/tsx: Add a feature bit for TSX control MSR support 2022-11-21 14:08:20 +01:00
umc.c
umwait.c KVM: VMX: Stop context switching MSR_IA32_UMWAIT_CONTROL 2020-06-22 20:54:57 -04:00
vmware.c x86/vmware: Use BIT() macro for shifting 2022-06-22 11:23:14 +02:00
vortex.c x86/CPU: Add support for Vortex CPUs 2021-10-21 15:49:07 +02:00
zhaoxin.c x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup 2020-06-15 14:18:37 +02:00