We do the microcode code update in two steps - the presmp:
'microcode_presmp_init' and when CPUs are brought up: 'microcode_init'.
The earlier performs the microcode update on the BSP - but
unfortunately it does not check whether the update failed. Which means
that we might try later to update a incorrect payload on the rest of
CPUs.
This patch handles this odd situation.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
{
void *data;
size_t len;
+ int rc = 0;
if ( ucode_blob.size )
{
data = ucode_mod_map(&ucode_mod);
}
if ( data )
- microcode_update_cpu(data, len);
+ rc = microcode_update_cpu(data, len);
+ else
+ rc = -ENOMEM;
if ( !ucode_blob.size )
ucode_mod_map(NULL);
+
+ if ( rc )
+ {
+ if ( ucode_blob.size )
+ {
+ xfree(ucode_blob.data);
+ ucode_blob.size = 0;
+ ucode_blob.data = NULL;
+ }
+ else
+ ucode_mod.mod_end = 0;
+ }
}
register_cpu_notifier(µcode_percpu_nfb);