x86/ucode/amd: Move check_final_patch_levels() to apply_microcode()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Mar 2020 12:14:01 +0000 (13:14 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 Apr 2020 13:00:12 +0000 (14:00 +0100)
commit0c770820a792a7ab7450fac58e404ce2b9dd40a1
tree10a5a82462e911394f6332050b1bcd1604cb0a8e
parent718d1432000079ea7120f6cb770372afe707ce27
x86/ucode/amd: Move check_final_patch_levels() to apply_microcode()

The microcode revision of whichever CPU runs cpu_request_microcode() is not
necessarily applicable to other CPUs.

If the BIOS left us with asymmetric microcode, rejecting updates in
cpu_request_microcode() would prevent us levelling the system even if only up
to the final level.  Also, failing to cache microcode misses an opportunity to
get beyond the final level via the S3 path.

Move check_final_patch_levels() earlier and use it in apply_microcode().
Reword the error message to be more informative, and use -ENXIO as this corner
case has nothing to do with permissions.

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