]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
x86/ucode: Distinguish "ucode already up to date"
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 May 2024 09:59:36 +0000 (11:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 May 2024 09:59:36 +0000 (11:59 +0200)
Right now, Xen returns -ENOENT for both "the provided blob isn't correct for
this CPU", and "the blob isn't newer than what's loaded".

This in turn causes xen-ucode to exit with an error, when "nothing to do" is
more commonly a success condition.

Handle EEXIST specially and exit cleanly.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 648db37a155aca6f66d4cf3bb118417a728c3579
master date: 2024-05-09 18:19:49 +0100

tools/misc/xen-ucode.c
xen/arch/x86/cpu/microcode/core.c

index ad32face2b5ecd3c70f7dd1766981529da584a63..de31c393f0dfe5bda1b1fe83c9a4b542c32e794b 100644 (file)
@@ -60,8 +60,11 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
+    errno = 0;
     ret = xc_microcode_update(xch, buf, len);
-    if ( ret )
+    if ( ret == -1 && errno == EEXIST )
+        printf("Microcode already up to date\n");
+    else if ( ret )
     {
         fprintf(stderr, "Failed to update microcode. (err: %s)\n",
                 strerror(errno));
index b204b95f8fec384a955e66b71d3f9e8c8dfdea5b..667b1baf915a55114158a17ade5f0fc3d4294838 100644 (file)
@@ -637,7 +637,7 @@ static long cf_check microcode_update_helper(void *data)
                    "microcode: couldn't find any newer%s revision in the provided blob!\n",
                    opt_ucode_allow_same ? " (or the same)" : "");
             microcode_free_patch(patch);
-            ret = -ENOENT;
+            ret = -EEXIST;
 
             goto put;
         }