Skip to contentSkip to conversation

x86/CPU: extend is_forced_cpu_cap()'s "reach"

PATCH In review Jan Beulich 2 participants 2 messages Aug 4, 2025 – Jan 21

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/CPU: extend is_forced_cpu_cap()'s "reach"

"cpuid=no-rdrand" cannot actually be used to suppress the respective boot warning on certain AMD hardware. That's because cleared_caps[] are only applied after the ->c_init() hooks ran, i.e. cpu_has() still returns true in init_amd().

Fixes 93401e28a84b ("x86: clear RDRAND CPUID bit on AMD family 15h/16h")

---
TBD: It's not clear whether doing it this way is actually a good idea;
it may need to be two of the three call sites to be amended by a new is_cleared_cpu_cap().

Also relevant to "x86/AMD: disable RDSEED on Fam17 model 47 stepping 0".

xen/arch/x86/cpu/common.c +1 -1
@@ -108,7 +108,7 @@ void __init setup_force_cpu_cap(unsigned
 
 bool __init is_forced_cpu_cap(unsigned int cap)
 {
-	return test_bit(cap, forced_caps);
+	return test_bit(cap, forced_caps) || test_bit(cap, cleared_caps);
 }
 
 static void cf_check default_init(struct cpuinfo_x86 * c)
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

"cpuid=no-rdrand" cannot actually be used to suppress the respective boot warning on certain AMD hardware. That's because cleared_caps[] are only applied after the ->c_init() hooks ran, i.e. cpu_has() still returns true in init_amd().

Fixes 93401e28a84b ("x86: clear RDRAND CPUID bit on AMD family 15h/16h")