From nobody Mon Feb 9 17:21:42 2026 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 BAB80C00528 for ; Thu, 3 Aug 2023 08:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234264AbjHCI3V (ORCPT ); Thu, 3 Aug 2023 04:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbjHCI2k (ORCPT ); Thu, 3 Aug 2023 04:28:40 -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 758CA3AA6 for ; Thu, 3 Aug 2023 01:26:28 -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 09C6D61CC3 for ; Thu, 3 Aug 2023 08:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C95F4C433C8; Thu, 3 Aug 2023 08:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051187; bh=b22i5cpRysAWrYuPGapjjvgN3RpBjJ402hZ7Cjh+W4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Axcri0FcevtjIyWyFRy1a5qFFZrd6vzwOCz7Z/ps+RSYFEkk6uR+HwBgl3iUiEN8m kSDnYyucz2WNCaq5yd7QWY2BugIJ2A5r4gURnx7g2gITpghL/758+eLqNcYA5EppB2 zGVOjJLJ+kbGE/l57DBHLxXIBkjzgyTMFTojw5OfPP9rVcO1ZvsTCsl7XlDH1qfe3E jnps5jXNojeeD71yRcULYbtdX4lqcvUDpPaWcM0dgRpUEtM7422mPg86xa45S+Hsl1 CPNt/abaVBEE2yyD0/3j6HaLs4HSI7JWpRa6Vc0ORhT5OMW6gC/jYK4sWTPKMYphSR 441cjFyFx48yg== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 1/7] x86: Fix amd_check_microcode() declaration Date: Thu, 3 Aug 2023 10:26:13 +0200 Message-Id: <20230803082619.1369127-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The newly added amd_check_microcode() function has two conflicting definiti= ons 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=3D1 arch/x86/kernel/cpu/amd.c:1289:6: error: no previous prototype for 'amd_che= ck_microcode' [-Werror=3Dmissing-prototypes] Adding the missing #include shows the other problem: arch/x86/kernel/cpu/amd.c:1290:6: error: redefinition of 'amd_check_microco= de' arch/x86/include/asm/microcode_amd.h:58:20: note: previous definition of 'a= md_check_microcode' with type 'void(void)' Move the declaration into a more appropriate header that is already include= d, 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/mi= crocode_amd.h index a9b3f9635727e..81d3294b2b5e2 100644 --- a/arch/x86/include/asm/microcode_amd.h +++ b/arch/x86/include/asm/microcode_amd.h @@ -47,12 +47,11 @@ struct microcode_amd { extern void load_ucode_amd_early(unsigned int cpuid_1_eax); 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 load_ucode_amd_early(unsigned int cpuid_1_eax) {} 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/proces= sor.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 =20 extern unsigned long arch_align_stack(unsigned long sp); --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 9977CC0015E for ; Thu, 3 Aug 2023 08:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234595AbjHCI30 (ORCPT ); Thu, 3 Aug 2023 04:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbjHCI2l (ORCPT ); Thu, 3 Aug 2023 04:28:41 -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 958BB3AAC for ; Thu, 3 Aug 2023 01:26:30 -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 2955161CC6 for ; Thu, 3 Aug 2023 08:26:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC7B5C433C7; Thu, 3 Aug 2023 08:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051189; bh=hMCNeSXwQytHGCgIoVl9q90tknzoEJ95XhZLTksbe2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AuxYNCGQKNCXWTWgqyDHBWFCFoMrZ5izJ5PJiOCdXR+7iXP1x+RO4EWU5RMJ7wJC0 k4Cm+vzZvn39TkxcUa0I9DuCaFb7ckZ/gjA0IkQAk4IRqAvzxSpmDgQ469Eq/oLGIf YWw7F2fIbwFLviztYUcUq7NSI39x1ksjTAt4wc3RDHWidtdCiCe9pNPD5uyx2SpSIl fHeYga/UWaiY/lrFCRgXwiZCyj4zbpwznqZB6h2jQ0jTIlkUNcwm8kPyTH4CcUIS1e 6NwDXGbm1Ij1HwzSwHbYLaxrNxsCP2eDLd7vKmNjpcB/LMMeryZkzbOXeC0tOXDX6U 2tWBn39fnGSzg== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 2/7] x86: apic: hide unused safe_smp_processor_id on UP Date: Thu, 3 Aug 2023 10:26:14 +0200 Message-Id: <20230803082619.1369127-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann When CONFIG_SMP is disabled, the prototype for safe_smp_processor_id() is hidden, which causes a W=3D1 warning: /home/arnd/arm-soc/arch/x86/kernel/apic/ipi.c:316:5: error: no previous pro= totype for 'safe_smp_processor_id' [-Werror=3Dmissing-prototypes] Since there are no callers in this configuration, just hide the definition as well. Signed-off-by: Arnd Bergmann --- arch/x86/kernel/apic/ipi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c index 2a6509e8c840d..9bfd6e3973845 100644 --- a/arch/x86/kernel/apic/ipi.c +++ b/arch/x86/kernel/apic/ipi.c @@ -301,6 +301,7 @@ void default_send_IPI_mask_logical(const struct cpumask= *cpumask, int vector) local_irq_restore(flags); } =20 +#ifdef CONFIG_SMP /* must come after the send_IPI functions above for inlining */ static int convert_apicid_to_cpu(int apic_id) { @@ -329,3 +330,4 @@ int safe_smp_processor_id(void) return cpuid >=3D 0 ? cpuid : 0; } #endif +#endif --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 CBAC4C0015E for ; Thu, 3 Aug 2023 08:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234635AbjHCI3e (ORCPT ); Thu, 3 Aug 2023 04:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232170AbjHCI2m (ORCPT ); Thu, 3 Aug 2023 04:28:42 -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 A0D533AB6 for ; Thu, 3 Aug 2023 01:26:32 -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 3402E61CC6 for ; Thu, 3 Aug 2023 08:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0034DC43391; Thu, 3 Aug 2023 08:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051191; bh=fjxWdl9NmQdDwhM5ZKtH0mdm+UmjLs4KGMTSYInCLOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YeExSGNArapYCallEIwOX8qDGOPGJMI4G2dmUxh7c9DdfS75Ur5qdYJR8JBD91ihm ZXRv9YT8Al2voUbmcnhm7LWBPS7yEkAEBB0nr/k9pU2eKx3Lotp1SRVdTdu5z0WmBj p81RUKDKFk3UEaUbgfl5IBsMIoYAjqDfGoz8AoC0a/ALAma/6FZLx2wpVAvEQ5xW0l MTYe7vYOKuSn8s5iGdpJHBGp/FoTLS7D16o8/BozLBmmMzCVFg/RNx0s6rGNrhG+La QlERLC9JjmAFOX22dxWsST2nH2S5uYK2Z6CXASk6cpAeKp9Ls0kJnRseaZCQKLdQS+ 4zNXOTBP5eevg== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 3/7] x86: avoid unneeded __div64_32 function definition Date: Thu, 3 Aug 2023 10:26:15 +0200 Message-Id: <20230803082619.1369127-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The __div64_32() function is provided for 32-bit architectures that don't have a custom do_div() implementation. x86_32 has one, and does not use the header file that declares the function prototype, so the definition causes a W=3D1 warning: lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Wer= ror=3Dmissing-prototypes] Define an empty macro to prevent the function definition from getting built, which avoids the warning and saves a little .text space. Signed-off-by: Arnd Bergmann --- v3: improve code comment --- arch/x86/include/asm/div64.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h index b8f1dc0761e4b..9931e4c7d73f3 100644 --- a/arch/x86/include/asm/div64.h +++ b/arch/x86/include/asm/div64.h @@ -71,6 +71,12 @@ static inline u64 mul_u32_u32(u32 a, u32 b) } #define mul_u32_u32 mul_u32_u32 =20 +/* + * __div64_32() is never called on x86, so prevent the + * generic definition from getting built. + */ +#define __div64_32 + #else # include =20 --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 43C47C0015E for ; Thu, 3 Aug 2023 08:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbjHCI3n (ORCPT ); Thu, 3 Aug 2023 04:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232399AbjHCI2n (ORCPT ); Thu, 3 Aug 2023 04:28:43 -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 C8E233ABB for ; Thu, 3 Aug 2023 01:26:34 -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 5D42E61CCA for ; Thu, 3 Aug 2023 08:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13A1BC433CB; Thu, 3 Aug 2023 08:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051193; bh=rn5AmJ5E/u7lh73YUSkNYYV834iPfRhN7MTY5kuEYCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CbezDcat3shX2zfrmg6PkoJ/65zTYhPlOAtKfzmczIszpdh+JJml7scBrPVvcoOBP VflOIGvOE+x3y/7ylXmDYH5QGx1ukl18ef4zTfG6zukIE0pqwcvb3MiUX1Ye1IOfcj 8k1bvJZq20Dw0EnVx46+yu5hxKnBuAmawbS/UctWBlB1G7ihVMQZfXDaSQsV6Prd5P E446Xl+ZKzEme2A/O523tgSQmQL8aeuI5ImnG3u7YAdx8MDmNq86c4n+R//xEFF5QV dfltEeXhaNlptcUWYfbKqRoAn67xxKgKOKUsMlYJrpFV8lQ4/6xHZa3qsr6cOrmfb7 G/Cx63Bg3dUCQ== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 4/7] x86: purgatory: include header for warn() declaration Date: Thu, 3 Aug 2023 10:26:16 +0200 Message-Id: <20230803082619.1369127-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The purgatory code has uses parts of the decompressor and provides its own warn() function, but has to include the corresponding header file to avoid a -Wmissing-prototypes warning. It turns out that this the function prototype actually differs from the declaration, so change it to get a constant pointer in the declaration and the other definition as well. Signed-off-by: Arnd Bergmann --- arch/x86/boot/compressed/error.c | 2 +- arch/x86/boot/compressed/error.h | 2 +- arch/x86/purgatory/purgatory.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/error.c b/arch/x86/boot/compressed/er= ror.c index 5313c5cb2b802..19a8251de506a 100644 --- a/arch/x86/boot/compressed/error.c +++ b/arch/x86/boot/compressed/error.c @@ -7,7 +7,7 @@ #include "misc.h" #include "error.h" =20 -void warn(char *m) +void warn(const char *m) { error_putstr("\n\n"); error_putstr(m); diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/er= ror.h index 86fe33b937154..31f9e080d61a8 100644 --- a/arch/x86/boot/compressed/error.h +++ b/arch/x86/boot/compressed/error.h @@ -4,7 +4,7 @@ =20 #include =20 -void warn(char *m); +void warn(const char *m); void error(char *m) __noreturn; void panic(const char *fmt, ...) __noreturn __cold; =20 diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c index 7558139920f8c..aea47e7939637 100644 --- a/arch/x86/purgatory/purgatory.c +++ b/arch/x86/purgatory/purgatory.c @@ -14,6 +14,7 @@ #include #include =20 +#include "../boot/compressed/error.h" #include "../boot/string.h" =20 u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory= "); --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 5F94CC04A6A for ; Thu, 3 Aug 2023 08:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234647AbjHCI3q (ORCPT ); Thu, 3 Aug 2023 04:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjHCI2n (ORCPT ); Thu, 3 Aug 2023 04:28:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D058D3C1F for ; Thu, 3 Aug 2023 01:26:36 -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 6E48D61CBE for ; Thu, 3 Aug 2023 08:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 373A7C43142; Thu, 3 Aug 2023 08:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051195; bh=KR4z8QRNi4pU35qpz87mdf60pT5ISebScYvNacq6P6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OMIMPZoTbbhICTxT8qGKxBU7CW4vQK1sUfp0/QvJbHEaATPtfrAplsfuLIECI0RP1 GiTcPGBEyG3uzuQI99dsh4/OQ294FO5bGnmIgCHGS+cerlwCMv4qNswLyiZeYDwXoC OxGeEoU23O2mRaRoYnD/NMJZX3n+KL30gd4KpQxVxvCfACnvx75rv2ioDlK/lmnQYV nViI0vCqYEfnPMFeSrkuwWNyFCH7ic+L8EfA6aGdFjsn31Q8mBeSikyP2pfFAXgD2e z9o60UMna7JsQ6gYbsnM+JVWPtAkdcj/hgxSf4UoUgVVWBsTTk6IZrD0l5XSGQYL97 dfxqGtZUVJ40Q== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 5/7] x86: alternative: add __alt_reloc_selftest prototype Date: Thu, 3 Aug 2023 10:26:17 +0200 Message-Id: <20230803082619.1369127-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The newly introduced selftest function causes a warning when -Wmissing-prot= otypes is enabled: arch/x86/kernel/alternative.c:1461:32: error: no previous prototype for '__= alt_reloc_selftest' [-Werror=3Dmissing-prototypes] Since it's only used locally, add the prototype directly in front of it. Fixes: 270a69c4485d ("x86/alternative: Support relocations in alternatives") Signed-off-by: Arnd Bergmann --- arch/x86/kernel/alternative.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 2dcf3a06af090..934c23f24a3f8 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1531,6 +1531,7 @@ static noinline void __init int3_selftest(void) =20 static __initdata int __alt_reloc_selftest_addr; =20 +extern void __init __alt_reloc_selftest(void *arg); __visible noinline void __init __alt_reloc_selftest(void *arg) { WARN_ON(arg !=3D &__alt_reloc_selftest_addr); --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 5B23BC00528 for ; Thu, 3 Aug 2023 08:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234448AbjHCIaA (ORCPT ); Thu, 3 Aug 2023 04:30:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234395AbjHCI2u (ORCPT ); Thu, 3 Aug 2023 04:28:50 -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 883D64C0D for ; Thu, 3 Aug 2023 01:26:39 -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 8126B61C4B for ; Thu, 3 Aug 2023 08:26:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F554C43391; Thu, 3 Aug 2023 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051197; bh=ePyKU1YMopmwzc/Oe51J6v27McxWIDUV7ds7IsNZfvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6tC89azknyzgPThJCu65qkNSwtEz1ekEYAX3ftbBQPgorFF3eBj11bLO8pX8H5Jf CGXvde0vej1G0RlhG0HGIxWKFthslelFSC7Zi4jowqvePOWcrRpFp7zEI3h+p4YdqN ptXZGP2rW/W4uK8dbwrpSU1g9wbWqjDapv0lrlBvjW57vsipb/IsmgSIhWc9Dja52y Rgp3zReGzWZRgIWjE+852ndbVuLRHRnTPuleNTwDPSNEV9XGQ71qUiPaG6hL/8hxm7 ymY0aWaVESezPTTOuY+dWkJucxZFAQqst0VG7bJ1ekjLNRYzEH8ZgiOKeplNs23xYE wOVHNhUJK73dg== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning Date: Thu, 3 Aug 2023 10:26:18 +0200 Message-Id: <20230803082619.1369127-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The native_pv_lock_init function is only used in SMP configurations and declared in asm/qspinlock.h, which is not used in UP kernels, but the function is still defined for both, which causes a warning: arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'nat= ive_pv_lock_init' [-Werror=3Dmissing-prototypes] Move the declaration to asm/paravirt.h so it is visible even with CONFIG_SMP but short-circuit the definition to turn it into an empty function. Signed-off-by: Arnd Bergmann --- v3: new patch to avoid adding another #ifdef to paravirt.c --- arch/x86/include/asm/paravirt.h | 7 +++++++ arch/x86/include/asm/qspinlock.h | 7 +------ arch/x86/kernel/paravirt.c | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravir= t.h index b49778664d2be..6c8ff12140aea 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -739,6 +739,7 @@ static __always_inline unsigned long arch_local_irq_sav= e(void) ".popsection") =20 extern void default_banner(void); +void native_pv_lock_init(void) __init; =20 #else /* __ASSEMBLY__ */ =20 @@ -778,6 +779,12 @@ extern void default_banner(void); #endif /* __ASSEMBLY__ */ #else /* CONFIG_PARAVIRT */ # define default_banner x86_init_noop + +#ifndef __ASSEMBLY__ +static inline void native_pv_lock_init(void) +{ +} +#endif #endif /* !CONFIG_PARAVIRT */ =20 #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinl= ock.h index d87451df480bd..cde8357bb226d 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -74,8 +74,6 @@ static inline bool vcpu_is_preempted(long cpu) */ DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key); =20 -void native_pv_lock_init(void) __init; - /* * Shortcut for the queued_spin_lock_slowpath() function that allows * virt to hijack it. @@ -103,10 +101,7 @@ static inline bool virt_spin_lock(struct qspinlock *lo= ck) =20 return true; } -#else -static inline void native_pv_lock_init(void) -{ -} + #endif /* CONFIG_PARAVIRT */ =20 #include diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 89842bb7ec9cc..066fc19d2568e 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -75,7 +75,8 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key); =20 void __init native_pv_lock_init(void) { - if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) + if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && + !boot_cpu_has(X86_FEATURE_HYPERVISOR)) static_branch_disable(&virt_spin_lock_key); } =20 --=20 2.39.2 From nobody Mon Feb 9 17:21:42 2026 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 EBB64C0015E for ; Thu, 3 Aug 2023 08:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234661AbjHCIaE (ORCPT ); Thu, 3 Aug 2023 04:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234490AbjHCI24 (ORCPT ); Thu, 3 Aug 2023 04:28:56 -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 DEBBB4C2F for ; Thu, 3 Aug 2023 01:26:41 -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 BCC1661CD4 for ; Thu, 3 Aug 2023 08:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66696C433CD; Thu, 3 Aug 2023 08:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051200; bh=/5Ij7ujq3SxzByX7XQp0Gjei+Rmrmwgg4FsA45zy5sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRsMA1ccRGGIZ5bW7Jgg/PC+AW1waWhnTB5EBUcccrvjfSFj8d/LkWVPN+YsjcEvA R7BoldjnVdKvqSBayxMibqpXCTAelxJsdDF6gm/zBJldSCtvVS6XR4HiI1uStsilWv CzrWwsy6k4g3f8TPxL02XOHsHZE+UR1kOM9adh6iYh2sUP4F7MbFzBgCidhTt3dzhI xrVr/tVNRlkW9WlWQb5U6KrtbceyM/uugO0EsPE6/jbdWaxXoua9c70SMTWseN1Ij6 HO1eswgBdb/Cceg+IP18DivnAl3DVAbupN9mIgHaIdp6QtlxRJ/3R6X/7GKrVQ4dgc JgM4f3J23Q+3Q== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 7/7] x86: qspinlock-paravirt: fix mising-prototype warning Date: Thu, 3 Aug 2023 10:26:19 +0200 Message-Id: <20230803082619.1369127-8-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann __pv_queued_spin_unlock_slowpath is defined in a header file as a global function, and designed to be called from an inline asm, but there is no prototype visible in the definition: kernel/locking/qspinlock_paravirt.h:493:1: error: no previous prototype for= '__pv_queued_spin_unlock_slowpath' [-Werror=3Dmissing-prototypes] Add this to the x86 header that contains the inline asm calling it, and ensure this gets included before the definition, rather than after it. Signed-off-by: Arnd Bergmann --- v3: split out native_pv_lock_init() changes into a separate patch, keeping only __pv_queued_spin_unlock_slowpath here --- arch/x86/include/asm/qspinlock_paravirt.h | 2 ++ kernel/locking/qspinlock_paravirt.h | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/a= sm/qspinlock_paravirt.h index 42b17cf10b10e..85b6e3609cb92 100644 --- a/arch/x86/include/asm/qspinlock_paravirt.h +++ b/arch/x86/include/asm/qspinlock_paravirt.h @@ -4,6 +4,8 @@ =20 #include =20 +void __lockfunc __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u= 8 locked); + /* * For x86-64, PV_CALLEE_SAVE_REGS_THUNK() saves and restores 8 64-bit * registers. For i386, however, only 1 32-bit register needs to be saved diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock= _paravirt.h index 6afc249ce697d..6a0184e9c2348 100644 --- a/kernel/locking/qspinlock_paravirt.h +++ b/kernel/locking/qspinlock_paravirt.h @@ -485,6 +485,16 @@ pv_wait_head_or_lock(struct qspinlock *lock, struct mc= s_spinlock *node) return (u32)(atomic_read(&lock->val) | _Q_LOCKED_VAL); } =20 +/* + * Include the architecture specific callee-save thunk of the + * __pv_queued_spin_unlock(). This thunk is put together with + * __pv_queued_spin_unlock() to make the callee-save thunk and the real un= lock + * function close to each other sharing consecutive instruction cachelines. + * Alternatively, architecture specific version of __pv_queued_spin_unlock= () + * can be defined. + */ +#include + /* * PV versions of the unlock fastpath and slowpath functions to be used * instead of queued_spin_unlock(). @@ -533,16 +543,6 @@ __pv_queued_spin_unlock_slowpath(struct qspinlock *loc= k, u8 locked) pv_kick(node->cpu); } =20 -/* - * Include the architecture specific callee-save thunk of the - * __pv_queued_spin_unlock(). This thunk is put together with - * __pv_queued_spin_unlock() to make the callee-save thunk and the real un= lock - * function close to each other sharing consecutive instruction cachelines. - * Alternatively, architecture specific version of __pv_queued_spin_unlock= () - * can be defined. - */ -#include - #ifndef __pv_queued_spin_unlock __visible __lockfunc void __pv_queued_spin_unlock(struct qspinlock *lock) { --=20 2.39.2