Re: [PATCH] x86/microcode: Allow early loading without initrd

Henrique de Moraes Holschuh
2015-04-30T13:18:16Z

On Sun, Apr 26, 2015, at 13:16, Borislav Petkov wrote:
> * the early loader was done with initrd in mind and it was/still is its
> main source for microcode blobs early in the boot. So if we want to
> make it not-mandatory, then the driver needs to be reorganized so that
> builtin blobs and initrd blobs loading paths are cleanly untangled. The
> ifdeffery thing might work now but is certainly not future-proof so it
> would need to be designed in a cleaner way.
>
> Perhaps something like a microcode cache of patches the AMD loader has,
> all decoupled from the loading paths or so... I don't have a good idea
> right now. I'll have to think about it.

Well, the *early* Intel driver does have a cache of sorts. It could use (a lot of) love, though...

The "cache" in the early intel microcode update driver is implemented by mc_saved_in_initrd[]. It is currently sub-optimal, in that it has MAX_UCODE_COUNT slots (128 slots).

The worst-case real-world fill of this cache is, currently, 7 slots (processor signature 0x6FB). The typical fill would be 1-4 slots.

If we change the code to store at maximum one microcode per pfmask bit plus some other details to handle the "processor does not support pfmask, so it is all zeroes" special case, we can safely change MAX_UCODE_COUNT to either 8 or 9, depending on implementation details.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh