linux/arch/x86/kernel/cpu
Borislav Petkov f9e14dbbd4 x86/cpu: Load microcode during restore_processor_state()
When resuming from system sleep state, restore_processor_state()
restores the boot CPU MSRs. These MSRs could be emulated by microcode.
If microcode is not loaded yet, writing to emulated MSRs leads to
unchecked MSR access error:

  ...
  PM: Calling lapic_suspend+0x0/0x210
  unchecked MSR access error: WRMSR to 0x10f (tried to write 0x0...0) at rIP: ... (native_write_msr)
  Call Trace:
    <TASK>
    ? restore_processor_state
    x86_acpi_suspend_lowlevel
    acpi_suspend_enter
    suspend_devices_and_enter
    pm_suspend.cold
    state_store
    kobj_attr_store
    sysfs_kf_write
    kernfs_fop_write_iter
    new_sync_write
    vfs_write
    ksys_write
    __x64_sys_write
    do_syscall_64
    entry_SYSCALL_64_after_hwframe
   RIP: 0033:0x7fda13c260a7

To ensure microcode emulated MSRs are available for restoration, load
the microcode on the boot CPU before restoring these MSRs.

  [ Pawan: write commit message and productize it. ]

Fixes: e2a1256b17 ("x86/speculation: Restore speculation related MSRs during S3 resume")
Reported-by: Kyle D. Pelton <kyle.d.pelton@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Tested-by: Kyle D. Pelton <kyle.d.pelton@intel.com>
Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215841
Link: https://lore.kernel.org/r/4350dfbf785cd482d3fafa72b2b49c83102df3ce.1650386317.git.pawan.kumar.gupta@linux.intel.com
2022-04-19 19:37:05 +02:00
..
mce - More noinstr fixes 2022-03-25 12:34:53 -07:00
microcode x86/cpu: Load microcode during restore_processor_state() 2022-04-19 19:37:05 +02:00
mtrr x86/mtrr: Replace deprecated CPU-hotplug functions. 2021-08-10 14:46:27 +02:00
resctrl kernfs: move struct kernfs_root out of the public view. 2022-02-23 15:46:34 +01:00
sgx x86/sgx: Free backing memory after faulting the enclave page 2022-03-11 10:31:06 -08:00
.gitignore
acrn.c
amd.c x86/cpu: Clear SME feature flag when not in use 2022-02-16 19:45:53 +01:00
aperfmperf.c sched/isolation: Use single feature type while referring to housekeeping cpumask 2022-02-16 15:57:55 +01:00
bugs.c x86/speculation: Warn about eIBRS + LFENCE + Unprivileged eBPF + SMT 2022-03-05 09:30:47 +01:00
cacheinfo.c sched: Add cluster scheduler level for x86 2021-10-15 11:25:16 +02:00
centaur.c
common.c x86/tsx: Disable TSX development mode at boot 2022-04-11 09:58:40 +02:00
cpu.h x86/tsx: Disable TSX development mode at boot 2022-04-11 09:58:40 +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
feat_ctl.c
hygon.c x86/cpu: Fix migration safety with X86_BUG_NULL_SEL 2021-10-21 20:49:16 +02: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/tsx: Disable TSX development mode at boot 2022-04-11 09:58:40 +02:00
Makefile x86/CPU: Add support for Vortex CPUs 2021-10-21 15:49:07 +02:00
match.c
mkcapflags.sh
mshyperv.c hyperv-next for 5.18 2022-03-24 12:30:37 -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
rdrand.c
scattered.c x86/cpu: X86_FEATURE_INTEL_PPIN finally has a CPUID bit 2022-02-01 16:15:19 +01:00
topology.c
transmeta.c
tsx.c x86/tsx: Disable TSX development mode at boot 2022-04-11 09:58:40 +02:00
umc.c
umwait.c
vmware.c
vortex.c x86/CPU: Add support for Vortex CPUs 2021-10-21 15:49:07 +02:00
zhaoxin.c