linux/arch/x86/kernel/cpu
Rong Zhang e6416c2dfe x86/CPU/AMD: Prevent reset reasons from being retained across reboot
The S5_RESET_STATUS register is parsed on boot and printed to kmsg.
However, this could sometimes be misleading and lead to users wasting a
lot of time on meaningless debugging for two reasons:

* Some bits are never cleared by hardware. It's the software's
responsibility to clear them as per the Processor Programming Reference
(see [1]).

* Some rare hardware-initiated platform resets do not update the
register at all.

In both cases, a previous reboot could leave its trace in the register,
resulting in users seeing unrelated reboot reasons while debugging random
reboots afterward.

Write the read value back to the register in order to clear all reason bits
since they are write-1-to-clear while the others must be preserved.

  [1]: https://bugzilla.kernel.org/show_bug.cgi?id=206537#attach_303991

  [ bp: Massage commit message. ]

Fixes: ab81310287 ("x86/CPU/AMD: Print the reason for the last reset")
Signed-off-by: Rong Zhang <i@rong.moe>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/all/20250913144245.23237-1-i@rong.moe/
2025-10-15 21:38:06 +02:00
..
mce x86/mce: Add a clear_bank() helper 2025-09-11 12:23:30 +02:00
microcode x86/microcode: Add microcode loader debugging functionality 2025-09-04 16:15:19 +02:00
mtrr x86/mtrr: Remove license boilerplate text with bad FSF address 2025-08-22 19:37:11 +02:00
resctrl x86/resctrl: Fix miscount of bandwidth event when reactivating previously unavailable RMID 2025-10-13 21:24:39 +02:00
sgx x86/sgx: Use ENCLS mnemonic in <kernel/cpu/sgx/encls.h> 2025-08-25 17:28:43 +02:00
.gitignore
Makefile x86/cpu: Detect FreeBSD Bhyve hypervisor 2025-09-15 14:06:44 +02:00
acrn.c
amd.c x86/CPU/AMD: Prevent reset reasons from being retained across reboot 2025-10-15 21:38:06 +02:00
amd_cache_disable.c x86/platform/amd: Move the <asm/amd_nb.h> header to <asm/amd/nb.h> 2025-04-14 09:34:14 +02:00
aperfmperf.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
bhyve.c x86/cpu: Detect FreeBSD Bhyve hypervisor 2025-09-15 14:06:44 +02:00
bugs.c x86/bugs: Report correct retbleed mitigation status 2025-09-16 13:32:18 +02:00
bus_lock.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
cacheinfo.c x86/cpu/cacheinfo: Simplify cacheinfo_amd_init_llc_id() using _cpuid4_info 2025-09-17 11:22:40 +02:00
centaur.c
common.c - Unify and refactor the MCA arch side and better separate code 2025-09-30 12:43:17 -07:00
cpu.h
cpuid-deps.c x86/cpufeatures: Add X86_FEATURE_APX 2025-04-16 09:44:13 +02:00
cpuid_0x2_table.c
cyrix.c
debugfs.c
feat_ctl.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
hygon.c x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper 2025-08-18 12:09:26 +02:00
hypervisor.c x86/cpu: Detect FreeBSD Bhyve hypervisor 2025-09-15 14:06:44 +02:00
intel.c x86/cpu/intel: Fix the constant_tsc model check for Pentium 4 2025-08-25 08:23:37 -07:00
intel_epb.c x86/msr: Rename 'wrmsrl_on_cpu()' to 'wrmsrq_on_cpu()' 2025-04-10 11:59:05 +02:00
match.c
mkcapflags.sh
mshyperv.c - Remove a bunch of asm implementing condition flags testing in KVM's 2025-10-11 11:19:16 -07:00
perfctr-watchdog.c
powerflags.c
proc.c
rdrand.c
scattered.c Generic: 2025-10-06 12:37:34 -07:00
topology.c x86/topology: Implement topology_is_core_online() to address SMT regression 2025-09-22 21:25:36 +02:00
topology.h
topology_amd.c x86/cpu/topology: Define AMD64_CPUID_EXT_FEAT MSR 2025-09-17 11:24:33 +02:00
topology_common.c
topology_ext.c
transmeta.c
tsx.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
umc.c
umwait.c x86/msr: Replace wrmsr(msr, low, 0) with wrmsrq(msr, low) 2025-05-02 10:36:36 +02:00
vmware.c
vortex.c
zhaoxin.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00