Page MenuHomeFreeBSD

ucode: use wrmsr_early_safe() for early CPU microcode update
ClosedPublic

Authored by glebius on Sep 20 2025, 7:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 10, 11:11 PM
Unknown Object (File)
Mon, Nov 10, 12:47 AM
Unknown Object (File)
Sat, Nov 8, 3:05 AM
Unknown Object (File)
Tue, Nov 4, 1:46 AM
Unknown Object (File)
Tue, Nov 4, 1:43 AM
Unknown Object (File)
Tue, Nov 4, 1:43 AM
Unknown Object (File)
Tue, Nov 4, 1:42 AM
Unknown Object (File)
Tue, Nov 4, 1:42 AM
Subscribers
None

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

glebius created this revision.

Am I right that this version would avoid loading ucode on AP is BSP early load failed?

sys/x86/x86/ucode.c
108
133

Why not use wrmsr_early_safe() there as well?

sys/x86/x86/ucode.c
280

This should be only used for UEFI boot ATM if (efi_boot) {...}. If really wanted, I can make it work with bios boot as well, by reusing system gdt.

In D52643#1202525, @kib wrote:

Am I right that this version would avoid loading ucode on AP is BSP early load failed?

Yes, if attempt on BSP sets ucode_error to LOAD_FAILED, then ucode_load_ap() will skip.

sys/x86/x86/ucode.c
133

I don't want to touch Intel with this patch, cause I can't test it.

sys/x86/x86/ucode.c
280

Yes, I kept this in mind, but forgot. I'd probably not change it here, rather in ucode_load_bsp() I will make the function argument efi_boot ? EARLY : UNSAFE.

  • Fix typo in printf.
  • ucode_bsp_load() sets how with efi_boot ? EARLY : UNSAFE.
kib added inline comments.
sys/x86/x86/ucode.c
108

Please fix this.

This revision is now accepted and ready to land.Sep 20 2025, 8:53 PM

Make it compilable on i386.

This revision now requires review to proceed.Sep 25 2025, 9:07 AM
sys/x86/x86/ucode.c
133

So it will be tested in wild.

450

efi_boot check is no longer neccessary

This revision is now accepted and ready to land.Sep 26 2025, 4:54 AM
sys/x86/x86/ucode.c
133

I'm with kib@ on this. Let's do the same for Intel and get someone to test (although I don't see why this would not work?)

  • Update Intel
  • Remove efi_boot check
This revision now requires review to proceed.Sep 27 2025, 9:55 AM
glebius retitled this revision from ucode: try Kostik's wrmsr_early_safe() to ucode: use wrmsr_early_safe() for early CPU microcode update.Sep 27 2025, 2:29 PM
This revision was not accepted when it landed; it landed in state Needs Review.Sep 27 2025, 2:31 PM
This revision was automatically updated to reflect the committed changes.