OrangePi_CM5/arch/x86/kernel/cpu
Borislav Petkov 2ab14625b8 x86/cpu: Load microcode during restore_processor_state()
commit f9e14dbbd454581061c736bf70bf5cbb15ac927c upstream.

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: e2a1256b17b1 ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-09 09:05:07 +02:00
..
mce x86/cpu: Add Xeon Icelake-D to list of CPUs that support PPIN 2022-02-05 12:37:55 +01:00
microcode x86/cpu: Load microcode during restore_processor_state() 2022-05-09 09:05:07 +02:00
mtrr x86/mtrr: Correct the range check before performing MTRR type lookups 2021-01-12 20:18:26 +01:00
resctrl x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails 2021-10-20 11:44:59 +02:00
.gitignore
…
Makefile kbuild: remove cc-option test of -fno-stack-protector 2020-07-07 11:13:10 +09:00
acrn.c x86/acrn: Remove redundant chars from ACRN signature 2020-08-07 01:32:00 +02:00
amd.c x86/cpu: Fix migration safety with X86_BUG_NULL_SEL 2021-11-18 14:03:40 +01:00
aperfmperf.c
…
bugs.c x86/speculation: Warn about eIBRS + LFENCE + Unprivileged eBPF + SMT 2022-03-11 12:11:50 +01:00
cacheinfo.c drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION() 2021-09-26 14:08:59 +02:00
centaur.c x86/cpu/centaur: Add Centaur family >=7 CPUs initialization support 2020-09-11 10:53:19 +02:00
common.c x86/cpu: Fix migration safety with X86_BUG_NULL_SEL 2021-11-18 14:03:40 +01:00
cpu.h x86/cpu: Fix migration safety with X86_BUG_NULL_SEL 2021-11-18 14:03:40 +01:00
cpuid-deps.c * Misc cleanups to the resctrl code in preparation for the ARM side, by 2020-10-12 10:53:32 -07:00
cyrix.c
…
feat_ctl.c
…
hygon.c x86/cpu: Fix migration safety with X86_BUG_NULL_SEL 2021-11-18 14:03:40 +01:00
hypervisor.c
…
intel.c x86/split_lock: Enable the split lock feature on another Alder Lake CPU 2021-02-17 11:02:23 +01:00
intel_epb.c
…
intel_pconfig.c
…
match.c
…
mkcapflags.sh
…
mshyperv.c x86/hyperv: fix for unwanted manipulation of sched_clock when TSC marked unstable 2021-09-18 13:40:17 +02:00
perfctr-watchdog.c x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs 2021-06-16 12:01:46 +02:00
powerflags.c
…
proc.c
…
rdrand.c
…
scattered.c This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
topology.c x86/topology: Make __max_die_per_package available unconditionally 2021-01-27 11:55:13 +01:00
transmeta.c
…
tsx.c
…
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: Add VMware-specific handling for VMMCALL under SEV-ES 2020-09-09 11:33:20 +02:00
zhaoxin.c x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup 2020-06-15 14:18:37 +02:00