x86/microcode: refuse to load the same revision ucode
authorSergey Dyasli <sergey.dyasli@citrix.com>
Wed, 27 Nov 2019 10:04:30 +0000 (10:04 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Nov 2019 12:53:41 +0000 (12:53 +0000)
commit72580a8d3c7ac70859437b69570de67dab668d9f
tree7ed979cf1c122caaa02facb46a068f4a8ae1d954
parent195b79a97e6721ba8830036f47d2454545f32e44
x86/microcode: refuse to load the same revision ucode

Currently if a user tries to live-load the same or older ucode revision
than CPU already has, he will get a single message in Xen log like:

    (XEN) 128 cores are to update their microcode

No actual ucode loading will happen and this situation can be quite
confusing. Fix this by starting ucode update only when the provided
ucode revision is higher than the currently cached one (if any).
This is based on the property that if microcode_cache exists, all CPUs
in the system should have at least that ucode revision.

Additionally, print a user friendly message if no matching or newer
ucode can be found in the provided blob. This also requires ignoring
-ENODATA in AMD-side code, otherwise the message given to the user is:

    (XEN) Parsing microcode blob error -61

Which actually means that a ucode blob was parsed fine, but no matching
ucode was found.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/microcode.c
xen/arch/x86/microcode_amd.c