[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.17] x86/ucode: Distinguish "ucode already up to date"



commit df095962ac6c07d40a3ad855f3f533e127490691
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue May 21 11:59:36 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue May 21 11:59:36 2024 +0200

    x86/ucode: Distinguish "ucode already up to date"
    
    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@xxxxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    master commit: 648db37a155aca6f66d4cf3bb118417a728c3579
    master date: 2024-05-09 18:19:49 +0100
---
 tools/misc/xen-ucode.c            | 5 ++++-
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index ad32face2b..de31c393f0 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -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));
diff --git a/xen/arch/x86/cpu/microcode/core.c 
b/xen/arch/x86/cpu/microcode/core.c
index b204b95f8f..667b1baf91 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -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;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.