diff mbox series

[XEN,2/6] x86/setup: add missing headers

Message ID c4fbf7b2a763f1b8e700e2ed36628c047231cb46.1691676251.git.nicola.vetrini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series xen: fix missing headers and static storage duration | expand

Commit Message

Nicola Vetrini Aug. 11, 2023, 7:19 a.m. UTC
The missing headers declare variables 'xen_cpuidle' and 'use_invpcid'
that are then defined inside the file.
This is undesirable and also violates MISRA C:2012 Rule 8.4.
Adding suitable "#include"s resolves the issue.

The type of the variable 'xen_cpuidle' also changes according to
s/s8/int8_t/.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Fixes: 3eab82196b02 ("x86: PIT broadcast to fix local APIC timer stop issue for Deep C state")
Fixes: 63dc135aeaf9 ("x86: invpcid support")
---
 xen/arch/x86/setup.c      | 4 +++-
 xen/include/xen/cpuidle.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Aug. 11, 2023, 10:58 p.m. UTC | #1
On Fri, 11 Aug 2023, Nicola Vetrini wrote:
> The missing headers declare variables 'xen_cpuidle' and 'use_invpcid'
> that are then defined inside the file.
> This is undesirable and also violates MISRA C:2012 Rule 8.4.
> Adding suitable "#include"s resolves the issue.
> 
> The type of the variable 'xen_cpuidle' also changes according to
> s/s8/int8_t/.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> Fixes: 3eab82196b02 ("x86: PIT broadcast to fix local APIC timer stop issue for Deep C state")
> Fixes: 63dc135aeaf9 ("x86: invpcid support")

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/x86/setup.c      | 4 +++-
>  xen/include/xen/cpuidle.h | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 80ae973d64e4..2bfc1fd00f8c 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -47,10 +47,12 @@
>  #include <asm/mach-generic/mach_apic.h> /* for generic_apic_probe */
>  #include <asm/setup.h>
>  #include <xen/cpu.h>
> +#include <xen/cpuidle.h>
>  #include <asm/nmi.h>
>  #include <asm/alternative.h>
>  #include <asm/mc146818rtc.h>
>  #include <asm/cpu-policy.h>
> +#include <asm/invpcid.h>
>  #include <asm/spec_ctrl.h>
>  #include <asm/guest.h>
>  #include <asm/microcode.h>
> @@ -88,7 +90,7 @@ boolean_param("noapic", skip_ioapic_setup);
>  
>  /* **** Linux config option: propagated to domain0. */
>  /* xen_cpuidle: xen control cstate. */
> -s8 __read_mostly xen_cpuidle = -1;
> +int8_t __read_mostly xen_cpuidle = -1;
>  boolean_param("cpuidle", xen_cpuidle);
>  
>  #ifndef NDEBUG
> diff --git a/xen/include/xen/cpuidle.h b/xen/include/xen/cpuidle.h
> index 521a8deb04c2..705d0c1135f0 100644
> --- a/xen/include/xen/cpuidle.h
> +++ b/xen/include/xen/cpuidle.h
> @@ -86,7 +86,7 @@ struct cpuidle_governor
>      void (*reflect)         (struct acpi_processor_power *dev);
>  };
>  
> -extern s8 xen_cpuidle;
> +extern int8_t xen_cpuidle;
>  extern struct cpuidle_governor *cpuidle_current_governor;
>  
>  bool cpuidle_using_deep_cstate(void);
> -- 
> 2.34.1
>
Jan Beulich Aug. 14, 2023, 7:38 a.m. UTC | #2
On 12.08.2023 00:58, Stefano Stabellini wrote:
> On Fri, 11 Aug 2023, Nicola Vetrini wrote:
>> The missing headers declare variables 'xen_cpuidle' and 'use_invpcid'
>> that are then defined inside the file.
>> This is undesirable and also violates MISRA C:2012 Rule 8.4.
>> Adding suitable "#include"s resolves the issue.
>>
>> The type of the variable 'xen_cpuidle' also changes according to
>> s/s8/int8_t/.
>>
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>> Fixes: 3eab82196b02 ("x86: PIT broadcast to fix local APIC timer stop issue for Deep C state")
>> Fixes: 63dc135aeaf9 ("x86: invpcid support")

One request: Please can you get used to putting the Fixes: tags first,
so one doesn't need to (try to) remember to move them in the course of
committing?

> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Nicola Vetrini Aug. 14, 2023, 7:43 a.m. UTC | #3
>>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>>> Fixes: 3eab82196b02 ("x86: PIT broadcast to fix local APIC timer stop 
>>> issue for Deep C state")
>>> Fixes: 63dc135aeaf9 ("x86: invpcid support")
> 
> One request: Please can you get used to putting the Fixes: tags first,
> so one doesn't need to (try to) remember to move them in the course of
> committing?
> 

Sure. Sorry, I didn't notice the ordering in other commits.
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 80ae973d64e4..2bfc1fd00f8c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -47,10 +47,12 @@ 
 #include <asm/mach-generic/mach_apic.h> /* for generic_apic_probe */
 #include <asm/setup.h>
 #include <xen/cpu.h>
+#include <xen/cpuidle.h>
 #include <asm/nmi.h>
 #include <asm/alternative.h>
 #include <asm/mc146818rtc.h>
 #include <asm/cpu-policy.h>
+#include <asm/invpcid.h>
 #include <asm/spec_ctrl.h>
 #include <asm/guest.h>
 #include <asm/microcode.h>
@@ -88,7 +90,7 @@  boolean_param("noapic", skip_ioapic_setup);
 
 /* **** Linux config option: propagated to domain0. */
 /* xen_cpuidle: xen control cstate. */
-s8 __read_mostly xen_cpuidle = -1;
+int8_t __read_mostly xen_cpuidle = -1;
 boolean_param("cpuidle", xen_cpuidle);
 
 #ifndef NDEBUG
diff --git a/xen/include/xen/cpuidle.h b/xen/include/xen/cpuidle.h
index 521a8deb04c2..705d0c1135f0 100644
--- a/xen/include/xen/cpuidle.h
+++ b/xen/include/xen/cpuidle.h
@@ -86,7 +86,7 @@  struct cpuidle_governor
     void (*reflect)         (struct acpi_processor_power *dev);
 };
 
-extern s8 xen_cpuidle;
+extern int8_t xen_cpuidle;
 extern struct cpuidle_governor *cpuidle_current_governor;
 
 bool cpuidle_using_deep_cstate(void);