mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 罗善策 <luoshance@hygon.cn>
To: Borislav Petkov <bp@alien8.de>, <x86@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
	<luoshance@hygon.cn>
Subject: [PATCH] x86/CPU: Fix FPDSS on Hygon
Date: Thu, 19 Nov 2026 15:53:30 +0800	[thread overview]
Message-ID: <20261119075330.961-1-luoshance@hygon.cn> (raw)

From: Luoshance <luoshance@hygon.cn>

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@hygon.cn>
---
 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



             reply	other threads:[~2026-11-19  7:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:53 罗善策 [this message]
2026-11-24  3:34 ` Borislav Petkov
2026-11-24  4:36 ` [tip: x86/urgent] " tip-bot2 for Shance Luo
2026-11-24  4:08 [PATCH] " Shance Luo
2026-11-24  4:15 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119075330.961-1-luoshance@hygon.cn \
    --to=luoshance@hygon.cn \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®