Re: [PATCH] x86/fred: Fix early boot failures on SEV-ES/SNP guests

From: Sohil Mehta

Date: Thu Feb 19 2026 - 15:50:27 EST


On 2/19/2026 12:22 PM, Dave Hansen wrote:
> On 2/19/26 11:27, Sohil Mehta wrote:
>> On 2/15/2026 9:16 PM, Nikunj A. Dadhania wrote:
>>> @@ -502,7 +517,7 @@ void cr4_init(void)
>>>
>>> if (boot_cpu_has(X86_FEATURE_PCID))
>>> cr4 |= X86_CR4_PCIDE;
>>> - if (static_branch_likely(&cr_pinning))
>>> + if (cr_pinning_enabled())
>>> cr4 = (cr4 & ~cr4_pinned_mask) | cr4_pinned_bits;
>>>
>> Maybe I am missing something, but is there a reason to keep this check
>> anymore?
>>
>> AFAIU, cr_pinning_enabled() will always be false during cr4_init().
>> cr4_init() always happens during early bringup when the cpu is marked
>> offline.
> Yeah, that should be dead code now.
>

With that change,

Reviewed-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>

> It wouldn't hurt to say:
>
> WARN_ON_ONCE(cr_pinning_enabled());
>
> to kinda document that this code doesn't work with CR pinning.