[PATCH] x86/CPU: Fix FPDSS on Hygon
From: 罗善策
Date: Thu Nov 19 2026 - 02:54:01 EST
From: Luoshance <luoshance@xxxxxxxx>
Hygon family 0x18 CPUs are affected by the same floating-point divider
issue as AMD Zen1: the divider can leave partial results of previous
operations behind, which another attacker thread can sample.
The Zen1 fix, commit e55d98e77561 ("x86/CPU: Fix FPDSS on Zen1"), sets
MSR_AMD64_FP_CFG bit 9 in init_amd_zen1(). Hygon CPUs are family 0x18
and do not go through that path, so set the same chicken bit at the end
of init_hygon().
Signed-off-by: Luoshance <luoshance@xxxxxxxx>
---
arch/x86/kernel/cpu/hygon.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
index ec51c2b..0bccb93 100644
--- a/arch/x86/kernel/cpu/hygon.c
+++ b/arch/x86/kernel/cpu/hygon.c
@@ -228,6 +228,9 @@ static void init_hygon(struct cpuinfo_x86 *c)
/* Hygon CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */
clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE);
+
+ pr_notice_once("Hygon FPDSS bug detected, enabling mitigation.\n");
+ msr_set_bit(MSR_AMD64_FP_CFG, MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT);
}
static void cpu_detect_tlb_hygon(struct cpuinfo_x86 *c)
--
2.34.1