From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E3B8CDB474 for ; Tue, 17 Oct 2023 21:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344385AbjJQVZE (ORCPT ); Tue, 17 Oct 2023 17:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344272AbjJQVYc (ORCPT ); Tue, 17 Oct 2023 17:24:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C93ED10E5 for ; Tue, 17 Oct 2023 14:23:53 -0700 (PDT) Message-ID: <20231017211723.074939820@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697577831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=MlY9vNxYaPkZBTjl1vPw4VNof43qV6pbee+MSxw01wA=; b=yjc/FqRpzap5/+q5puPwOhuS46yEgu+mzgRJSU+NmSkeZjlO31PGoF0uwuU8dexWF/4OtC RtzB4UCBCl8wAlkf5y8M5NKStatXyWT9g102i7XIqetlEg+zGs2TeFqeRdWYThphYpSu1J JPV6ErX80cE2PjjYIsMhkjtu4pJLC3nGAMyyKa//ABhh4HgiUGmThyDLKaLEKW2vd0CUEG IWUEez+bpA8gwbRR40r+ebD+HYONJQnG388H8a2Ffpky95cLqnC7PRQpX3wy5eF/8btpRA YAuwP2YWQMkViqmnfFuXC4NjBXWXRaYMZLF2s1NmHBXwBgKNOtEphvajO9wfew== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697577831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=MlY9vNxYaPkZBTjl1vPw4VNof43qV6pbee+MSxw01wA=; b=zBVqXmxAMua3u1QFXNfwJeOvtL3Z0dFP1k/JuzncmsWB5uuzw9WGzLhNgsnY/FIioachtG ERxAZZfw1N5jSPDw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Borislav Petkov Subject: [patch V5 20/39] x86/microcode/amd: Use correct per CPU ucode_cpu_info References: <20231017200758.877560658@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 17 Oct 2023 23:23:51 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner find_blobs_in_containers() is invoked on every CPU but overwrites unconditionally ucode_cpu_info of CPU0. Fix this by using the proper CPU data and move the assignment into the call site apply_ucode_from_containers() so that the function can be reused. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/microcode/amd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index a2776f2af93b..f6ed2c5be932 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -503,9 +503,6 @@ static void find_blobs_in_containers(unsigned int cpuid_1_eax, struct cpio_data if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax))) cp = find_microcode_in_initrd(ucode_path); - /* Needed in load_microcode_amd() */ - ucode_cpu_info->cpu_sig.sig = cpuid_1_eax; - *ret = cp; } @@ -513,6 +510,9 @@ static void apply_ucode_from_containers(unsigned int cpuid_1_eax) { struct cpio_data cp = { }; + /* Needed in load_microcode_amd() */ + ucode_cpu_info[smp_processor_id()].cpu_sig.sig = cpuid_1_eax; + find_blobs_in_containers(cpuid_1_eax, &cp); if (!(cp.data && cp.size)) return;