Re: [PATCH v6 8/8] x86/microcode/AMD: Don't scan past the CPU equivalence table data

From: Maciej S. Szmigiero
Date: Mon Jun 18 2018 - 14:12:02 EST


On 18.06.2018 18:44, Borislav Petkov wrote:
> On Tue, Jun 12, 2018 at 11:08:31PM +0200, Maciej S. Szmigiero wrote:
>> That was the solution before this patch series version (6) - there was
>> a variable holding the CPU equivalence table size for the late loader,
>> but you didn't like it:> Instead of adding yet another global var which needs handling too,
>>> and touching so many places, just do all checks and preparations in
>>> install_equiv_cpu_table() so that the rest of the code can get what it
>>> expects: terminating zero entry and proper size.
>
> So what's wrong with computing the size in the late loader just like you
> do in parse_container()?
>

The equivalence table size can be computed in the late loader - there is
no problem there.

However, this computed size needs to be passed somehow to functions
scanning the equivalence table.

One of such functions, __find_equiv_id() can be called from
->collect_cpu_info() and ->apply_microcode() microcode_ops callbacks
which do not allow passing any specific state to the microcode update
driver.

This means that the size would need to be stored in a global variable,
just like a pointer to the equivalence table itself is.

Maciej