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@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Andrew Cooper committed 2024-05-09 18:19:49 +01:00
1 parent 3c228e24b2
commit 648db37a15
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -125,8 +125,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));
+1 -1
View File
@@ -640,7 +640,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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.