mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/microcode/amd: fix the return value when microcode has no update
@ 2025-04-29  8:43 Annie Li
  2025-04-29  9:22 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Annie Li @ 2025-04-29  8:43 UTC (permalink / raw)
  To: Borislav Petkov, Thomas Gleixner, Ingo Molnar
  Cc: Dave Hansen, H. Peter Anvin, Nikolay Borisov, x86, linux-kernel,
	Annie Li

In commit 6f059e634dcd("x86/microcode: Clarify the late load logic"), the
return value is UCODE_OK if the load is up-to-date in amd platform, which
leads to load_late_locked() returning -EBADFD.

This is different from the intel platform, which will return UCODE_NFOUND
and is more reasonable.

Fix the return to UCODE_NFOUND to avoid -EBADFD error.

Fixes: 6f059e634dcd ("x86/microcode: Clarify the late load logic")
Signed-off-by: Annie Li <jiayanli@google.com>
---
 arch/x86/kernel/cpu/microcode/amd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index b61028cf5c8a3..f90779dc1cac5 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -1074,6 +1074,8 @@ static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t siz
 	if (ret != UCODE_OK)
 		return ret;
 
+	ret = UCODE_NFOUND;
+
 	for_each_node_with_cpus(nid) {
 		cpu = cpumask_first(cpumask_of_node(nid));
 		c = &cpu_data(cpu);
-- 
2.49.0.901.g37484f566f-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/microcode/amd: fix the return value when microcode has no update
  2025-04-29  8:43 [PATCH] x86/microcode/amd: fix the return value when microcode has no update Annie Li
@ 2025-04-29  9:22 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2025-04-29  9:22 UTC (permalink / raw)
  To: Annie Li
  Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, H. Peter Anvin,
	Nikolay Borisov, x86, linux-kernel

On Tue, Apr 29, 2025 at 08:43:16AM +0000, Annie Li wrote:
> In commit 6f059e634dcd("x86/microcode: Clarify the late load logic"), the
> return value is UCODE_OK if the load is up-to-date in amd platform, which
> leads to load_late_locked() returning -EBADFD.
> 
> This is different from the intel platform, which will return UCODE_NFOUND
> and is more reasonable.
> 
> Fix the return to UCODE_NFOUND to avoid -EBADFD error.

... and return -ENOENT instead?

Is that better?

Or would it be even better for the switch-case to handle UCODE_OK too?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-29  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-29  8:43 [PATCH] x86/microcode/amd: fix the return value when microcode has no update Annie Li
2025-04-29  9:22 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®