x86/ucode/amd: Rework parsing logic in cpu_request_microcode()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Mar 2020 18:39:08 +0000 (19:39 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 Apr 2020 13:00:12 +0000 (14:00 +0100)
commit4de936a38aa96c946f5d39b2760abb8a9853cba3
tree364e5840c4879d25615ecf0d5d47c1dae4073f92
parent6f56491911a6a11ec94db36aca791a23e3cc75b6
x86/ucode/amd: Rework parsing logic in cpu_request_microcode()

cpu_request_microcode() is still a confusing mess to follow, with sub
functions responsible for maintaining offset.  Rewrite it so all container
structure handling is in this one function.

Rewrite struct mpbhdr as struct container_equiv_table to aid parsing.  Drop
container_fast_forward() entirely, and shrink scan_equiv_cpu_table() to just
its searching/caching logic.

container_fast_forward() gets logically folded into the microcode blob
scanning loop, except that a skip path is inserted, which is conditional on
whether scan_equiv_cpu_table() thinks there is appropriate microcode to find.

With this change, we now scan to the end of all provided microcode containers,
and no longer give up at the first applicable one.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/microcode/amd.c