From patchwork Tue Jul 25 12:17:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 125588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2433248vqg; Tue, 25 Jul 2023 05:29:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkmvtj72c7GUX6I0ijTbraWPE4KSJeaFYENON0ka1SI9JXniIFUfoDzPS/SPNiTuPXBk0J X-Received: by 2002:a05:6808:14c5:b0:3a4:1f0f:d108 with SMTP id f5-20020a05680814c500b003a41f0fd108mr17488390oiw.46.1690288186675; Tue, 25 Jul 2023 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690288186; cv=none; d=google.com; s=arc-20160816; b=FolFzwOMxaE9Wk3CxueD9SbOP15lsxHWQbcOgH0WoYdInT569XskKMmETUxZGY6g59 cDfZk3GP4UOj4mRdSymXi9qFetPCkx5sMpIdHvSCWdrGFGS9cB5lSA5VUb3GtpqkeC++ 7nWYmDOGIn8UgPiNwd1ixCv0vlotVJRZ1TDrZwTvKylkeEXae+jCpbrGu/v/HIIcS442 xsju9Dwq8yV8IDxfr/qkr/leM8x/mWeo/X4f7pE9q4l6Nce4x3wJEyCFJcetBw9r6orN hnjV2/0RGHrbHXu6a4c/7hu4JwKNcIXrzhd12N/DL1GYvqlr/+wUHO5j6wzn0a0orax2 OAIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=toS+KRwEr9UiwZLldWLEweBrYb0ceWiJgsFjbsJVFu4=; fh=8+x06zg9f86VJhzaDMtsLq8Ft3nrFvFOtHLbO9ZbbNw=; b=bBeGm328OoB9TLj1/VlLd3aiQzsWN9+0q1ycl7TVNByK7iGklS7z4Yo8ot36AWFS6M ZoqjybKNIsCTrVVJDuz0CIaZRn5TnF3ju0v1mmXq+pS2yiyH7f9tVZrXZWg7oyFsSUkq 9zFRl7RLxF6al96yPAKXctpz693UOKUGmGSL9JsPFJh1QhN0uYvARmvSsq/27bQlRsFk ohxlHHs3sY9ZecbTKzVN1fAkgLqJulOMWvA3oPY4mIxleXoIJ5aC7lT9Q4RavbaY2f79 vc5N/4cKBKYTfuEGrd5YFb+AD5sJhTjnMkODsVBZfVbRQvzc5sS5TcYCM7TeB6JRfYPP +j7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UdsoyzUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np16-20020a17090b4c5000b0025bec4468c2si12542912pjb.167.2023.07.25.05.29.33; Tue, 25 Jul 2023 05:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UdsoyzUq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233344AbjGYMSB (ORCPT + 99 others); Tue, 25 Jul 2023 08:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbjGYMR7 (ORCPT ); Tue, 25 Jul 2023 08:17:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A79A3 for ; Tue, 25 Jul 2023 05:17:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29D44616B1 for ; Tue, 25 Jul 2023 12:17:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B415EC433C8; Tue, 25 Jul 2023 12:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690287477; bh=gGj+zZodhcrEkfzZJQhzs82i0JBSqzhqMChNJmcVRpI=; h=From:To:Cc:Subject:Date:From; b=UdsoyzUqtMd/JeI8MWIcIhaqGCGpVKMTBQF+IxJlfs5UhEGvWYHXUpi3Mrbeq5O8R dBJNxlUah03PdcObRyZkwAcVLgKNFsRTInOyCX4X8qch72ArPXi8MxBZ8nWyo0woeW tkU32fdAHHEeSGHXOMBWrkuqnsEmG+d5t9bfZ1OAG3mDZ95X8EiKI3sb+vtgwJVRgt foxh3Ym/Cl8QjS2NLg2iAFVEkXc/8ZBJqsZNwKH0v3ODkSlJCe6MFbESSk7MDwuvDw qR8deFcxaIhUtKDcs45DBpwYtTRMNH0yNgIJ4U2ZQDK7MCaLO9yS//T1DNeh5sNF1H owyb/s0+N1TRg== From: Arnd Bergmann To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: Arnd Bergmann , "H. Peter Anvin" , "Peter Zijlstra (Intel)" , David Woodhouse , Brian Gerst , Ashok Raj , Kefeng Wang , linux-kernel@vger.kernel.org Subject: [PATCH] [v2] x86: Fix amd_check_microcode() declaration Date: Tue, 25 Jul 2023 14:17:39 +0200 Message-Id: <20230725121751.2007665-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772395625447916450 X-GMAIL-MSGID: 1772395625447916450 From: Arnd Bergmann The newly added amd_check_microcode() function has two conflicting definitions if CONFIG_CPU_SUP_AMD is enabled and CONFIG_MICROCODE_AMD is disabled. Since the header with the stub definition is not included in cpu/amd.c, this only causes a -Wmissing-prototype warning with W=1 arch/x86/kernel/cpu/amd.c:1289:6: error: no previous prototype for 'amd_check_microcode' [-Werror=missing-prototypes] Adding the missing #include shows the other problem: arch/x86/kernel/cpu/amd.c:1290:6: error: redefinition of 'amd_check_microcode' arch/x86/include/asm/microcode_amd.h:58:20: note: previous definition of 'amd_check_microcode' with type 'void(void)' Move the declaration into a more appropriate header that is already included, with the #ifdef check changed to match the definition's. Fixes: 522b1d69219d8 ("x86/cpu/amd: Add a Zenbleed fix") Signed-off-by: Arnd Bergmann --- arch/x86/include/asm/microcode_amd.h | 3 +-- arch/x86/include/asm/processor.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h index 9675c621c1ca4..2ed09a1da4a27 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -48,13 +48,12 @@ extern void __init load_ucode_amd_bsp(unsigned int family); extern void load_ucode_amd_ap(unsigned int family); extern int __init save_microcode_in_initrd_amd(unsigned int family); void reload_ucode_amd(unsigned int cpu); -extern void amd_check_microcode(void); #else static inline void __init load_ucode_amd_bsp(unsigned int family) {} static inline void load_ucode_amd_ap(unsigned int family) {} static inline int __init save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; } static inline void reload_ucode_amd(unsigned int cpu) {} -static inline void amd_check_microcode(void) {} #endif + #endif /* _ASM_X86_MICROCODE_AMD_H */ diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index d46300e94f853..36d52075fdade 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -682,9 +682,11 @@ extern u16 get_llc_id(unsigned int cpu); #ifdef CONFIG_CPU_SUP_AMD extern u32 amd_get_nodes_per_socket(void); extern u32 amd_get_highest_perf(void); +extern void amd_check_microcode(void); #else static inline u32 amd_get_nodes_per_socket(void) { return 0; } static inline u32 amd_get_highest_perf(void) { return 0; } +static inline void amd_check_microcode(void) { } #endif extern unsigned long arch_align_stack(unsigned long sp);