diff mbox series

[2/2] x86: move gds_ucode_mitigated() declaration to header

Message ID 20230809130530.1913368-2-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Arnd Bergmann Aug. 9, 2023, 1:05 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The declaration got placed in the .c file of the caller, but that
causes a warning for the definition:

arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

Move it to a header where both sides can observe it instead.

Fixes: 81ac7e5d74174 ("KVM: Add GDS_NO support to KVM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/processor.h | 2 ++
 arch/x86/kvm/x86.c               | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Sneddon Aug. 9, 2023, 4:54 p.m. UTC | #1
HI Arnd,

On 8/9/23 06:05, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The declaration got placed in the .c file of the caller, but that
> causes a warning for the definition:
> 
> arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]

When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even
without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

Thanks,
Dan
Arnd Bergmann Aug. 9, 2023, 6:26 p.m. UTC | #2
On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
> HI Arnd,
>
> On 8/9/23 06:05, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> The declaration got placed in the .c file of the caller, but that
>> causes a warning for the definition:
>> 
>> arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]
>
> When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even
> without this patch. I'm curious why you're seeing it and I'm not. Any ideas?

The warning is currently disabled by default, unless you build with
'make W=1'. I'm in the process of getting my last patches out to
change this so the warning is enabled by default though, so I was
phrasing this based on the future behavior. Sorry if this was confusing.

    Arnd
Daniel Sneddon Aug. 9, 2023, 7:16 p.m. UTC | #3
On 8/9/23 11:26, Arnd Bergmann wrote:
> On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
>> HI Arnd,
>>
>> On 8/9/23 06:05, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> The declaration got placed in the .c file of the caller, but that
>>> causes a warning for the definition:
>>>
>>> arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]
>>
>> When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even
>> without this patch. I'm curious why you're seeing it and I'm not. Any ideas?
> 
> The warning is currently disabled by default, unless you build with
> 'make W=1'. I'm in the process of getting my last patches out to
> change this so the warning is enabled by default though, so I was
> phrasing this based on the future behavior. Sorry if this was confusing.
> 
>     Arnd

That explains why I wasn't seeing it.

Feel free to add:
Tested-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>

Thanks,
Dan
Daniel Sneddon Aug. 9, 2023, 7:20 p.m. UTC | #4
On 8/9/23 12:16, Daniel Sneddon wrote:
> On 8/9/23 11:26, Arnd Bergmann wrote:
>> On Wed, Aug 9, 2023, at 18:54, Daniel Sneddon wrote:
>>> HI Arnd,
>>>
>>> On 8/9/23 06:05, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> The declaration got placed in the .c file of the caller, but that
>>>> causes a warning for the definition:
>>>>
>>>> arch/x86/kernel/cpu/bugs.c:682:6: error: no previous prototype for 'gds_ucode_mitigated' [-Werror=missing-prototypes]
>>>
>>> When I build with gcc 9.4 and the x86_64_defconfig I don't see this warning even
>>> without this patch. I'm curious why you're seeing it and I'm not. Any ideas?
>>
>> The warning is currently disabled by default, unless you build with
>> 'make W=1'. I'm in the process of getting my last patches out to
>> change this so the warning is enabled by default though, so I was
>> phrasing this based on the future behavior. Sorry if this was confusing.
>>
>>     Arnd
> 
> That explains why I wasn't seeing it.
> 
> Feel free to add:
> Tested-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
> 
> Thanks,
> Dan

To be clear, that applies to both patches in the series.

BR,
Dan
diff mbox series

Patch

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index e5b0e23a7a830..01786f3e289cb 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -731,4 +731,6 @@  bool arch_is_platform_page(u64 paddr);
 #define arch_is_platform_page arch_is_platform_page
 #endif
 
+extern bool gds_ucode_mitigated(void);
+
 #endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 17b1ee7f839c3..a7d97cde19678 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -318,8 +318,6 @@  u64 __read_mostly host_xcr0;
 
 static struct kmem_cache *x86_emulator_cache;
 
-extern bool gds_ucode_mitigated(void);
-
 /*
  * When called, it means the previous get/set msr reached an invalid msr.
  * Return true if we want to ignore/silent this failed msr access.