linux-loongson/arch/x86/kernel/cpu
Li RongQing d4932a1b14 x86/bugs: Fix GDS mitigation selecting when mitigation is off
The current GDS mitigation logic incorrectly returns early when the
attack vector mitigation is turned off, which leads to two problems:

1. CPUs without ARCH_CAP_GDS_CTRL support are incorrectly marked with
   GDS_MITIGATION_OFF when they should be marked as
   GDS_MITIGATION_UCODE_NEEDED.

2. The mitigation state checks and locking verification that follow are
   skipped, which means:
   - fail to detect if the mitigation was locked
   - miss the warning when trying to disable a locked mitigation

Remove the early return to ensure proper mitigation state handling. This
allows:
- Proper mitigation classification for non-ARCH_CAP_GDS_CTRL CPUs
- Complete mitigation state verification

This also addresses the failed MSR 0x123 write attempt at boot on
non-ARCH_CAP_GDS_CTRL CPUs:

  unchecked MSR access error: WRMSR to 0x123 (tried to write 0x0000000000000010) at rIP: ... (update_gds_msr)
  Call Trace:
   identify_secondary_cpu
   start_secondary
   common_startup_64
   WARNING: CPU: 1 PID: 0 at arch/x86/kernel/cpu/bugs.c:1053 update_gds_msr

  [ bp: Massage, zap superfluous braces. ]

Fixes: 8c7261abcb ("x86/bugs: Add attack vector controls for GDS")
Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Link: https://lore.kernel.org/20250819023356.2012-1-lirongqing@baidu.com
2025-08-19 10:38:04 +02:00
..
mce x86/mce: Make sure CMCI banks are cleared during shutdown on Intel 2025-06-28 12:45:48 +02:00
microcode - Switch the microcode loader from using the fake platform device to 2025-07-29 17:16:26 -07:00
mtrr x86/mtrr: Check if fixed-range MTRRs exist in mtrr_save_fixed_ranges() 2025-05-12 13:04:40 +02:00
resctrl x86,fs/resctrl: Remove inappropriate references to cacheinfo in the resctrl subsystem 2025-06-16 21:06:12 +02:00
sgx mm: update architecture and driver code to use vm_flags_t 2025-07-09 22:42:14 -07:00
.gitignore
acrn.c x86/traps: Add sysvec_install() to install a system interrupt handler 2024-01-31 22:02:36 +01: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
amd.c x86/CPU/AMD: Ignore invalid reset reason value 2025-08-18 16:36:59 +02:00
aperfmperf.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
bugs.c x86/bugs: Fix GDS mitigation selecting when mitigation is off 2025-08-19 10:38:04 +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/cacheinfo: Rename CPUID(0x2) descriptors iterator parameter 2025-05-16 10:49:55 +02:00
centaur.c x86/cpu: Use common topology code for Centaur and Zhaoxin 2024-02-15 22:07:37 +01:00
common.c x86/boot changes for v6.17: 2025-07-29 18:58:22 -07:00
cpu.h x86/cacheinfo: Move AMD cache_disable_0/1 handling to separate file 2025-03-25 10:22:39 +01:00
cpuid_0x2_table.c x86/cpu: Consolidate CPUID leaf 0x2 tables 2025-03-25 10:23:04 +01:00
cpuid-deps.c x86/cpufeatures: Add X86_FEATURE_APX 2025-04-16 09:44:13 +02:00
cyrix.c x86/CPU: Fix warm boot hang regression on AMD SC1100 SoC systems 2025-02-25 22:44:01 +01:00
debugfs.c x86/cpu: Prefix hexadecimal values with 0x in cpu_debug_show() 2025-02-27 13:26:53 +01:00
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
intel_epb.c x86/msr: Rename 'wrmsrl_on_cpu()' to 'wrmsrq_on_cpu()' 2025-04-10 11:59:05 +02:00
intel.c x86/cpu/intel: Rename CPUID(0x2) descriptors iterator parameter 2025-05-16 10:49:55 +02:00
Makefile x86/cpu: Consolidate CPUID leaf 0x2 tables 2025-03-25 10:23:04 +01:00
match.c x86/cpu: Update x86_match_cpu() to also use cpu-type 2025-03-19 11:17:11 +01:00
mkcapflags.sh x86/cpufeatures: Flip the /proc/cpuinfo appearance logic 2024-06-20 21:04:22 +02:00
mshyperv.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
perfctr-watchdog.c
powerflags.c
proc.c cpufreq: Allow arch_freq_get_on_cpu to return an error 2025-02-17 18:09:20 +00:00
rdrand.c x86/msr: Prepare for including <linux/percpu.h> into <asm/msr.h> 2024-03-04 12:01:39 +01:00
scattered.c x86/sev: Evict cache lines during SNP memory validation 2025-08-06 19:17:22 +02:00
topology_amd.c Merge branch 'x86/msr' into x86/core, to resolve conflicts 2025-05-13 10:42:06 +02:00
topology_common.c x86/topology: Introduce topology_logical_core_id() 2024-12-02 12:01:35 +01:00
topology_ext.c x86/cpu/topology: Add support for the AMD 0x80000026 leaf 2024-03-22 11:22:14 +01:00
topology.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
topology.h x86/cpu/topology: Retrieve cores per package from topology bitmaps 2024-02-15 22:07:45 +01:00
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 x86/vmware: Parse MP tables for SEV-SNP enabled guests under VMware hypervisors 2025-03-13 19:01:09 +01:00
vortex.c
zhaoxin.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00