Index | Thread | Search

From:
"H. Hartzer" <h@hartzer.sh>
Subject:
Disable unnecessary CPU mitigations on Intel Bonnell+Saltwell
To:
<tech@openbsd.org>
Date:
Wed, 13 Aug 2025 20:56:43 +0000

Download raw body.

Thread
  • H. Hartzer:

    Disable unnecessary CPU mitigations on Intel Bonnell+Saltwell

Hi tech@,

The oldest Intel Atoms, Bonnel and Saltwell, are non-speculative
processors that by nature are immune to Meltdown and spectre-style
vulnerabilities.

This patch disables some of the mitigations, though it's incomplete.
Meltdown mitigations seem to be manually applied to all Intel processors
by default in sys/arch/amd64/amd64/locore0.S.

I think to remove the Meltdown mitigations, I have to call cpuid again,
this time with eax set to 1, and check for the applicable models at that
point. Does that seem correct? My assembly is very rusty.

Thanks!

-Henrich

diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c
index 1287c610344..a17a41293bb 100644
--- a/sys/arch/amd64/amd64/cpu.c
+++ b/sys/arch/amd64/amd64/cpu.c
@@ -193,6 +193,13 @@ replacemeltdown(void)

 		swapgs_vuln = 1;
 		if (family == 0x6 &&
+		    (model == 0x1c || model == 0x26 || model == 0x27 ||
+		     model == 0x35 || model == 0x36)) {
+			/* Bonnell and Saltwell are non-speculative processors,  */
+			/* immune to Meltdown and Spectre-style vulnerabilities. */
+			need_retpoline = 0;
+			swapgs_vuln = 0;
+		} else if (family == 0x6 &&
 		    (model == 0x37 || model == 0x4a || model == 0x4c ||
 		     model == 0x4d || model == 0x5a || model == 0x5d ||
 		     model == 0x6e || model == 0x65 || model == 0x75)) {