Skip to contentSkip to conversation

x86/ucode: log blob date also for AMD

PATCH In review Jan Beulich 2 participants 2 messages Apr 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ucode: log blob date also for AMD

Like Intel, AMD also records the date in their blobs. The field was merely misnamed as "data_code" so far; this was perhaps meant to be "date_code". Split it into individual fields, just like we did for Intel some time ago, and extend the message logged after a successful update.

xen/arch/x86/cpu/microcode/amd.c +6 -3
@@ -33,7 +33,9 @@ struct equiv_cpu_entry {
 };
 
 struct microcode_patch {
-    uint32_t data_code;
+    uint16_t year;
+    uint8_t  day;
+    uint8_t  month;
     uint32_t patch_id;
     uint8_t  mc_patch_data_id[2];
     uint8_t  mc_patch_data_len;
@@ -251,8 +253,9 @@ static int apply_microcode(const struct
         return -EIO;
     }
 
-    printk(XENLOG_WARNING "microcode: CPU%u updated from revision %#x to %#x\n",
-           cpu, old_rev, rev);
+    printk(XENLOG_WARNING
+           "microcode: CPU%u updated from revision %#x to %#x, date = %04x-%02x-%02x\n",
+           cpu, old_rev, rev, patch->year, patch->month, patch->day);
 
     return 0;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Beulich

Like Intel, AMD also records the date in their blobs. The field was merely misnamed as "data_code" so far; this was perhaps meant to be "date_code". Split it into individual fields, just like we did for Intel some time ago, and extend the message logged after a successful update.

This was on my todo list, but I'd not got around to it yet.  There are several legitimate microcode blobs with incorrect dates.

One has a date with a year earlier than its predecessor or successor, and two have day/month transpositions.  One transposition is obvious, having a 13 in it, while the other is ambiguous and guessed based on when the ucode was available.

I wasn't going to bother doing anything about this, but it is something to be aware of if we get queries of wonky looking dates.

~Andrew