Skip to content

Commit 566ffa3

Browse files
arndbbp3tk0v
authored andcommitted
x86/cpu: Fix amd_check_microcode() declaration
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: 522b1d6 ("x86/cpu/amd: Add a Zenbleed fix") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5d0c230 commit 566ffa3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/x86/include/asm/microcode_amd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,12 @@ extern void __init load_ucode_amd_bsp(unsigned int family);
4848
extern void load_ucode_amd_ap(unsigned int family);
4949
extern int __init save_microcode_in_initrd_amd(unsigned int family);
5050
void reload_ucode_amd(unsigned int cpu);
51-
extern void amd_check_microcode(void);
5251
#else
5352
static inline void __init load_ucode_amd_bsp(unsigned int family) {}
5453
static inline void load_ucode_amd_ap(unsigned int family) {}
5554
static inline int __init
5655
save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
5756
static inline void reload_ucode_amd(unsigned int cpu) {}
58-
static inline void amd_check_microcode(void) {}
5957
#endif
58+
6059
#endif /* _ASM_X86_MICROCODE_AMD_H */

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,11 @@ extern u16 get_llc_id(unsigned int cpu);
682682
#ifdef CONFIG_CPU_SUP_AMD
683683
extern u32 amd_get_nodes_per_socket(void);
684684
extern u32 amd_get_highest_perf(void);
685+
extern void amd_check_microcode(void);
685686
#else
686687
static inline u32 amd_get_nodes_per_socket(void) { return 0; }
687688
static inline u32 amd_get_highest_perf(void) { return 0; }
689+
static inline void amd_check_microcode(void) { }
688690
#endif
689691

690692
extern unsigned long arch_align_stack(unsigned long sp);

0 commit comments

Comments
 (0)