xen: address MISRA C:2012 Rule 8.4
cover xen: address MISRA C:2012 Rule 8.4
Rule states the following:
"A compatible declaration shall be visible when an object or function with external linkage is defined".
This series deals with violations concerning functions and variables used by C code (thus not used only within asm). The resolution strategies are as follows:
1. make the functions/variables static
2. include the header that contains the compatible declaration, or add one in the header if that's not the case.
No functional change.
Additional notes:
- other cases, such as functions/variables used only in asm code will be possibly dealt with in future patches.
- functions in 'gcov_base.c' are deviated, since they are called only from code generated by gcc in a particular non-release build configuration;
- variables in 'xen/include/acpi/acglobal.h' are deviated temporarily, since it's uncertain whether modifying the include pattern to be compliant with the rule would introduce subtle bugs.
Nicola Vetrini (8):
arm/efi: address MISRA C:2012 Rule 8.4
xen/memory: address MISRA C:2012 Rule 8.4
xen: address MISRA C:2012 Rule 8.4
xen/arm: address MISRA C:2012 Rule 8.4
x86: address MISRA C:2012 Rule 8.4
xen/arm: mm: address MISRA C:2012 Rule 8.4
x86/i8259: address MISRA C:2012 Rule 8.4
x86/nmi: address MISRA C:2012 Rule 8.4
xen/arch/arm/efi/efi-boot.h | 2 +- xen/arch/arm/include/asm/mm.h | 3 +++ xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce_amd.c | 2 +- xen/arch/x86/cpu/microcode/core.c | 2 +- xen/arch/x86/i8259.c | 1 + xen/arch/x86/nmi.c | 3 ++- xen/arch/x86/spec_ctrl.c | 4 ++-- xen/common/kernel.c | 2 +- xen/common/memory.c | 2 +- xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 14 files changed, 18 insertions(+), 11 deletions(-)
--
2.34.1
PATCH 1/8 arm/efi: address MISRA C:2012 Rule 8.4
the function 'fdt_add_uefi_nodes' can be defined static, as its only callers are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.
No functional change.
--- xen/arch/arm/efi/efi-boot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/efi/efi-boot.h +1 -1
@@ -227,7 +227,7 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR ** of the System table address, the address of the final EFI memory map, * and memory map information. */ -EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, +static EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, void *fdt, EFI_MEMORY_DESCRIPTOR *memory_map, UINTN map_size,
Signature · 1 line
2.34.1
Re: [XEN PATCH 1/8] arm/efi: address MISRA C:2012 Rule 8.4
Quoted 11 lines · Nicola Vetrini
the function '
fdt_add_uefi_nodes' can be defined static, as its only callers are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>
With
Stefano Stabellini
Acked-byRe: [XEN PATCH 1/8] arm/efi: address MISRA C:2012 Rule 8.4
Quoted 8 lines · Luca Fancellu
Quoted 8 lines · Nicola Vetrini
the function '
fdt_add_uefi_nodes' can be defined static, as its only callers are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.No functional change.
Quoted 7 lines
Quoted 1 line
Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Luca Fancellu <[email protected]>With
Fixes 6d70ea10d49f ("Add ARM EFI boot support”)
PATCH 2/8 xen/memory: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniThe function 'ioreq_server_max_frames' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.
No functional change.
--- xen/common/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/memory.c +1 -1
@@ -1120,7 +1120,7 @@ static long xatp_permission_check(struct domain *d, unsigned int space)return xsm_add_to_physmap (XSM_TARGET , current->domain, d); } -unsigned int ioreq_server_max_frames (const struct domain *d) +static unsigned int ioreq_server_max_frames (const struct domain *d) {unsigned int nr =0 ;
Signature · 1 line
2.34.1
Re: [XEN PATCH 2/8] xen/memory: address MISRA C:2012 Rule 8.4
Quoted 11 lines · Nicola Vetrini
The function '
ioreq_server_max_frames' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>
Makes sense,
Maybe it’s also better adding this:
If the maintainers agree
Re: [XEN PATCH 2/8] xen/memory: address MISRA C:2012 Rule 8.4
Quoted 10 lines · Luca Fancellu
Quoted 9 lines · Nicola Vetrini
The function '
ioreq_server_max_frames' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>
Quoted 8 lines
Makes sense,
Reviewed-by Luca Fancellu <[email protected]>Maybe it’s also better adding this:
Fixes 9244528955de ("xen/memory: Fix acquire_resource size semantics”)If the maintainers agree
I for one agree; in fact I did ask for Fixes: tags throughout this series, but in the context of another patch. As said there I also think titles and descriptions want writing differently here.
Jan
Stefano Stabellini
Acked-byRe: [XEN PATCH 2/8] xen/memory: address MISRA C:2012 Rule 8.4
In reply to Luca FancelluQuoted 6 lines · Luca Fancellu
Quoted 6 lines · Nicola Vetrini
The function '
ioreq_server_max_frames' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.
Quoted 7 lines
Quoted 3 lines
No functional change.
Signed-off-by Nicola Vetrini <[email protected]>Makes sense,
Reviewed-by Luca Fancellu <[email protected]>
Quoted 4 lines
Maybe it’s also better adding this:
Fixes 9244528955de ("xen/memory: Fix acquire_resource size semantics”)If the maintainers agree
Yes
PATCH 3/8 xen: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniThe variable 'saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.
--- xen/common/kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/kernel.c +1 -1
@@ -28,7 +28,7 @@ CHECK_feature_info;enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;static const char __initconst opt_builtin_cmdline[] =CONFIG_CMDLINE ;static int assign_integer_param (const struct kernel_param *param,uint64_t val)
Signature · 1 line
2.34.1
Quoted 18 lines · Nicola Vetrini
The variable '
saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.Signed-off-by Nicola Vetrini <[email protected]>---
xen/common/kernel.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/common/kernel.c +0
-0
xen/common/kernel.c CHECK_feature_info; · line 31
Quoted 5 lines
xen/common/kernel.c +1
-1@@ -28,7 +28,7 @@ CHECK_feature_info;enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;
I see this line was touched by fa97833ae18e4a42c0e5ba4e781173457b5d3397, have you checked that making it static was not affecting anything else?
Quoted 7 lines
xen/common/kernel.c +0
-0static const char __initconst opt_builtin_cmdline[] =CONFIG_CMDLINE ;static int assign_integer_param (const struct kernel_param *param,uint64_t val)Signature · 1 line
2.34.1
Quoted 17 lines · Luca Fancellu
Quoted 17 lines · Nicola Vetrini
The variable '
saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.Signed-off-by Nicola Vetrini <[email protected]>---
xen/common/kernel.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/common/kernel.c +0
-0@@ -28,7 +28,7 @@ CHECK_feature_info;
Quoted 7 lines
xen/common/kernel.c CHECK_feature_info; · line 31
Quoted 4 lines
xen/common/kernel.c +1
-1enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;I see this line was touched by
fa97833ae18e4a42c0e5ba4e781173457b5d3397, have you checked that making it static was not affecting anything else?
The code requiring the symbol to be non-static went away in e6ee01ad24b6 ("xen/version: Drop compat/kernel.c"). That's where the symbol would have wanted to become static. But that was very easy to overlook.
Jan
Luca Fancellu
Reviewed-byQuoted 30 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
Quoted 17 lines · Nicola Vetrini
The variable '
saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.Signed-off-by Nicola Vetrini <[email protected]>---
xen/common/kernel.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/common/kernel.c +0
-0@@ -28,7 +28,7 @@ CHECK_feature_info;Quoted 7 lines
xen/common/kernel.c CHECK_feature_info; · line 31
Quoted 4 lines
xen/common/kernel.c +1
-1enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;I see this line was touched by
fa97833ae18e4a42c0e5ba4e781173457b5d3397, have you checked that making it static was not affecting anything else?
Quoted 3 lines
The code requiring the symbol to be non-static went away in
e6ee01ad24b6("xen/version: Dropcompat/kernel.c"). That's where the symbol would have wanted to become static. But that was very easy to overlook.
Yes you are right Jan,
Possibly with the Fixes tag
Cheers,
Luca
Stefano Stabellini
Reviewed-byQuoted 32 lines · Luca Fancellu
Quoted 28 lines · Jan Beulich
Quoted 17 lines · Luca Fancellu
Quoted 17 lines · Nicola Vetrini
The variable '
saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.Signed-off-by Nicola Vetrini <[email protected]>---
xen/common/kernel.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/common/kernel.c +0
-0@@ -28,7 +28,7 @@ CHECK_feature_info;Quoted 7 lines
xen/common/kernel.c CHECK_feature_info; · line 31
Quoted 4 lines
xen/common/kernel.c +1
-1enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;I see this line was touched by
fa97833ae18e4a42c0e5ba4e781173457b5d3397, have you checked that making it static was not affecting anything else?Quoted 3 lines
The code requiring the symbol to be non-static went away in
e6ee01ad24b6("xen/version: Dropcompat/kernel.c"). That's where the symbol would have wanted to become static. But that was very easy to overlook.
Quoted 5 lines
Yes you are right Jan,
Reviewed-by Luca Fancellu <[email protected]>Possibly with the Fixes tag
Quoted 17 lines · Luca Fancellu
Quoted 17 lines · Nicola Vetrini
The variable '
saved_cmdline' can be defined static, as its only uses are within the same file. This in turn avoids violating Rule 8.4 because no declaration is present.Signed-off-by Nicola Vetrini <[email protected]>---
xen/common/kernel.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/common/kernel.c +0
-0@@ -28,7 +28,7 @@ CHECK_feature_info;
Quoted 9 lines
xen/common/kernel.c CHECK_feature_info; · line 31
Quoted 4 lines
xen/common/kernel.c +1
-1enum system_state system_state = SYS_STATE_early_boot; -xen_commandline_t saved_cmdline; +static xen_commandline_t saved_cmdline;I see this line was touched by
fa97833ae18e4a42c0e5ba4e781173457b5d3397, have you checked that making it static was not affecting anything else?
Though Jan already replied on this, the commit(s) were tested by patchew and our pipeline. This is normally our process, apart from MISRA checks.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
PATCH 4/8 xen/arm: address MISRA C:2012 Rule 8.4
In reply to Nicola Vetrini'xen/hypercall.h' is included in 'xen/arch/arm/setup.c' to allow the declaration of 'arch_get_xen_caps' to be visible when defining the function.
The header 'xen/delay.h' is included in 'xen/arch/arm/time.c' to allow the declaration of 'udelay' to be visible.
At the same time, a declaration for 'get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particular cper.h).
--- xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -0
@@ -32,6 +32,7 @@#include <xen/libfdt/libfdt-xen.h> #include <xen/acpi.h> #include <xen/warning.h> +#include <xen/hypercall.h> #include <asm/alternative.h> #include <asm/page.h> #include <asm/current.h>
xen/arch/arm/time.c +1 -0
@@ -17,6 +17,7 @@#include <xen/softirq.h> #include <xen/sched.h> #include <xen/time.h> +#include <xen/delay.h> #include <xen/sched.h> #include <xen/event.h> #include <xen/acpi.h>
xen/include/xen/cper.h +1 -2
@@ -23,8 +23,7 @@#include <xen/types.h> #include <xen/string.h> - -extern unsigned long get_sec (void ); +#include <xen/time.h> typedef struct { uint8_t b[16];
xen/include/xen/time.h +1 -0
@@ -36,6 +36,7 @@ s_time_t get_s_time_fixed(u64 at_tick);s_time_t get_s_time (void );unsigned long get_localtime (struct domain *d);uint64_t get_localtime_us (struct domain *d); +unsigned long get_sec (void );struct tm {int tm_sec;/* seconds */
Signature · 1 line
2.34.1
Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4
Quoted 11 lines · Nicola Vetrini
'
xen/hypercall.h' is included in 'xen/arch/arm/setup.c' to allow the declaration of 'arch_get_xen_caps' to be visible when defining the function.The header '
xen/delay.h' is included in 'xen/arch/arm/time.c' to allow the declaration of 'udelay' to be visible.At the same time, a declaration for '
get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particularcper.h).
Quoted 7 lines
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
I would have almost put this off as Arm-only, but then saw this diffstat. How come you consider cper.h Arm-related? This is used only by APEI source files, which in turn are used only by x86 afaics. So I think you want to split off the movement of the get_sec() declaration.
As to title and description (perhaps affecting more than just this patch):
Failing to have declarations in scope where definitions appear is an at least latent bug. We fix these as we find them anyway, so Misra is secondary here. Hence I'd like to suggest that you declare any such change as an actual bugfix, ideally including a Fixes: tag. It is of course fine to mention that this then also addresses Misra rule 8.4.
Jan
Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4
Quoted 29 lines · Jan Beulich
Quoted 11 lines · Nicola Vetrini
'
xen/hypercall.h' is included in 'xen/arch/arm/setup.c' to allow the declaration of 'arch_get_xen_caps' to be visible when defining the function.The header '
xen/delay.h' is included in 'xen/arch/arm/time.c' to allow the declaration of 'udelay' to be visible.At the same time, a declaration for '
get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particularcper.h).Quoted 7 lines
Signed-off-by Nicola Vetrini <[email protected]>---
xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)I would have almost put this off as Arm-only, but then saw this diffstat. How come you consider
cper.hArm-related? This is used only by APEI source files, which in turn are used only by x86 afaics. So I think you want to split off the movement of theget_sec()declaration.
Quoted 5 lines
As to title and description (perhaps affecting more than just this patch):
Failing to have declarations in scope where definitions appear is an at least latent bug. We fix these as we find them anyway, so Misra is secondary here. Hence I'd like to suggest that you declare any such change as an actual bugfix, ideally including a Fixes: tag.
To prevent back and forth I would suggest also to have a look in sending-patches.pandoc, ### Fixes section, on the expected syntax for the tag
Quoted 5 lines
It is of
course fine to mention that this then also addresses Misra rule 8.4.Jan
Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4
Quoted 4 lines
To prevent back and forth I would suggest also to have a look in sending-patches.pandoc,
### Fixes section, on the expected syntax for the tag
Thanks
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4
In reply to Jan BeulichQuoted 20 lines · Jan Beulich
Quoted 11 lines · Nicola Vetrini
'
xen/hypercall.h' is included in 'xen/arch/arm/setup.c' to allow the declaration of 'arch_get_xen_caps' to be visible when defining the function.The header '
xen/delay.h' is included in 'xen/arch/arm/time.c' to allow the declaration of 'udelay' to be visible.At the same time, a declaration for '
get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particularcper.h).Quoted 7 lines
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
Quoted 5 lines
I would have almost put this off as Arm-only, but then saw this diffstat. How come you consider
cper.hArm-related? This is used only by APEI source files, which in turn are used only by x86 afaics. So I think you want to split off the movement of theget_sec()declaration.
My mistake, I squashed the arm and the cper part together to avoid touching the time headers twice, but the old tag remained.
Quoted 8 lines
As to title and description (perhaps affecting more than just this patch):
Failing to have declarations in scope where definitions appear is an at least latent bug. We fix these as we find them anyway, so Misra is secondary here. Hence I'd like to suggest that you declare any such change as an actual bugfix, ideally including a Fixes: tag. It is of course fine to mention that this then also addresses Misra rule 8.4.Jan
Ok
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4
In reply to Jan BeulichQuoted 25 lines · Jan Beulich
Quoted 11 lines · Nicola Vetrini
'
xen/hypercall.h' is included in 'xen/arch/arm/setup.c' to allow the declaration of 'arch_get_xen_caps' to be visible when defining the function.The header '
xen/delay.h' is included in 'xen/arch/arm/time.c' to allow the declaration of 'udelay' to be visible.At the same time, a declaration for '
get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particularcper.h).Quoted 7 lines
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/arm/setup.c | 1 + xen/arch/arm/time.c | 1 + xen/include/xen/cper.h | 3 +-- xen/include/xen/time.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)I would have almost put this off as Arm-only, but then saw this diffstat. How come you consider
cper.hArm-related? This is used only by APEI source files, which in turn are used only by x86 afaics. So I think you want to split off the movement of theget_sec()declaration.
Quoted 6 lines
As to title and description (perhaps affecting more than just this patch):
Failing to have declarations in scope where definitions appear is an at least latent bug. We fix these as we find them anyway, so Misra is secondary here. Hence I'd like to suggest that you declare any such change as an actual bugfix, ideally including a Fixes: tag. It is of course fine to mention that this then also addresses Misra rule 8.4.
As you split the patches moving cper.h out, and fixing the commit message, please add my Reviewed-by for the setup.c/time.c/time.h changes.
PATCH 5/8 x86: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniThe functions and variables touched by this commit can be static, as they are only used within the same unit. This in turn addresses the absence of declarations that violates Rule 8.4.
--- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce_amd.c | 2 +- xen/arch/x86/cpu/microcode/core.c | 2 +- xen/arch/x86/nmi.c | 2 +- xen/arch/x86/spec_ctrl.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -599,7 +599,7 @@ unsigned int mce_firstbank(struct cpuinfo_x86 *c) c->x86_vendor ==X86_VENDOR_INTEL && c->x86_model <0x1a ; } -int show_mca_info (int inited,struct cpuinfo_x86 *c) +static int show_mca_info (int inited,struct cpuinfo_x86 *c) {static enum mcheck_type g_type = mcheck_unset;
xen/arch/x86/cpu/mcheck/mce_amd.c +1 -1
@@ -87,7 +87,7 @@ enum mc_ec_type { MC_EC_BUS_TYPE = 0x0800, }; -enum mc_ec_type +static enum mc_ec_type mc_ec2type (uint16_t errorcode) {if ( errorcode &MC_EC_BUS_TYPE )
xen/arch/x86/cpu/microcode/core.c +1 -1
@@ -149,7 +149,7 @@ static int __init cf_check parse_ucode(const char *s) }custom_param ("ucode" , parse_ucode); -void __init microcode_scan_module ( +static void __init microcode_scan_module (unsigned long *module_map,const multiboot_info_t *mbi) {
xen/arch/x86/nmi.c +1 -1
@@ -108,7 +108,7 @@ static unsigned int lapic_nmi_owner;* be enabled * -1: the lapic NMI watchdog is disabled, but can be enabled */ -int nmi_active; +static int nmi_active;#define K7_EVNTSEL_ENABLE (1 << 22)#define K7_EVNTSEL_INT (1 << 20)
xen/arch/x86/spec_ctrl.c +2 -2
@@ -43,9 +43,9 @@ static enum ind_thunk { } opt_thunk__initdata =THUNK_DEFAULT ;static int8_t __initdata opt_ibrs =-1 ; -int8_t __initdata opt_stibp =-1 ; +static int8_t __initdata opt_stibp =-1 ;bool __ro_after_init opt_ssbd; -int8_t __initdata opt_psfd =-1 ; +static int8_t __initdata opt_psfd =-1 ;int8_t __ro_after_init opt_ibpb_ctxt_switch =-1 ;int8_t __read_mostly opt_eager_fpu =-1 ;
Signature · 1 line
2.34.1
Re: [XEN PATCH 5/8] x86: address MISRA C:2012 Rule 8.4
Quoted 5 lines · Nicola Vetrini
The functions and variables touched by this commit can be static, as they are only used within the same unit. This in turn addresses the absence of declarations that violates Rule 8.4.
Signed-off-by Nicola Vetrini <[email protected]>
I'm happy with the code changes here and also in patch 3, but please make the titles meaningful (in patch 3 the prefix also wants to be more specific). As mentioned, the Misra rule is secondary here, and hence doesn't need to be present in the titles.
Jan
PATCH 6/8 xen/arm: mm: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniAdd a declaration for the variable 'init_ttbr' to resolve the violation of Rule 8.4 present in the associated source file 'mm.c'.
No functional changes.
--- xen/arch/arm/include/asm/mm.h | 3 +++ 1 file changed, 3 insertions(+)
xen/arch/arm/include/asm/mm.h +3 -0
@@ -165,6 +165,9 @@ struct page_info#define _PGC_need_scrub _PGC_allocated#define PGC_need_scrub PGC_allocated +/* Non-boot CPUs use this to find the correct pagetables. */ +extern uint64_t init_ttbr; +extern mfn_t directmap_mfn_start, directmap_mfn_end;extern vaddr_t directmap_virt_end;#ifdef CONFIG_ARM_64
Signature · 1 line
2.34.1
Re: [XEN PATCH 6/8] xen/arm: mm: address MISRA C:2012 Rule 8.4
Quoted 11 lines · Nicola Vetrini
Add a declaration for the variable '
init_ttbr' to resolve the violation of Rule 8.4 present in the associated source file 'mm.c'.No functional changes.
Signed-off-by Nicola Vetrini <[email protected]>---
With:
If maintainers are ok
Quoted 21 lines
xen/arch/arm/include/asm/mm.h| 3 +++1 file changed, 3 insertions(+)xen/arch/arm/include/asm/mm.h +3
-0@@ -165,6 +165,9 @@ struct page_info#define _PGC_need_scrub _PGC_allocated#define PGC_need_scrub PGC_allocated +/* Non-boot CPUs use this to find the correct pagetables. */ +extern uint64_t init_ttbr; +extern mfn_t directmap_mfn_start, directmap_mfn_end;extern vaddr_t directmap_virt_end;#ifdef CONFIG_ARM_64 Signature · 1 line
2.34.1
Stefano Stabellini
Reviewed-byRe: [XEN PATCH 6/8] xen/arm: mm: address MISRA C:2012 Rule 8.4
Quoted 10 lines · Luca Fancellu
Quoted 9 lines · Nicola Vetrini
Add a declaration for the variable '
init_ttbr' to resolve the violation of Rule 8.4 present in the associated source file 'mm.c'.No functional changes.
Signed-off-by Nicola Vetrini <[email protected]>---
Quoted 7 lines
Reviewed-by Luca Fancellu <[email protected]>With:
Fixes 4557c2292854 ("xen: arm: rewrite start of day page table and cpu bring up")If maintainers are ok
Yes
PATCH 7/8 x86/i8259: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniThe additional header file makes the declaration for the function 'init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.
No functional change.
--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)
xen/arch/x86/i8259.c +1 -0
@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h>
Signature · 1 line
2.34.1
Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4
Quoted 16 lines · Nicola Vetrini
The additional header file makes the declaration for the function '
init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)xen/arch/x86/i8259.c +0
-0
xen/arch/x86/i8259.c line 24
Quoted 6 lines
xen/arch/x86/i8259.c +1
-0@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h>
A patch adding this #include has been pending for almost 3 months:
https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html
Jan
Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4
Quoted 27 lines · Jan Beulich
Quoted 16 lines · Nicola Vetrini
The additional header file makes the declaration for the function '
init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)xen/arch/x86/i8259.c +0
-0xen/arch/x86/i8259.c line 24
Quoted 6 lines
xen/arch/x86/i8259.c +1
-0@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h> A patch adding this #include has been pending for almost 3 months:
https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html
Quoted 1 line
Jan
So do you prefer going forward with that patch or this one (mentioning it in the additional commit context of course)?
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4
Quoted 28 lines · Nicola Vetrini
Quoted 12 lines · Jan Beulich
Quoted 11 lines · Nicola Vetrini
The additional header file makes the declaration for the function '
init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)Quoted 14 lines
xen/arch/x86/i8259.c line 24
Quoted 11 lines
xen/arch/x86/i8259.c +1
-0@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h> A patch adding this #include has been pending for almost 3 months:
https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html
Quoted 3 lines
So do you prefer going forward with that patch or this one (mentioning it
in the additional commit context of course)?
I would prefer using the much older patch, but of course this requires someone providing R-b or A-b.
Jan
Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4
Quoted 29 lines · Jan Beulich
Quoted 28 lines · Nicola Vetrini
Quoted 26 lines · Jan Beulich
Quoted 16 lines · Nicola Vetrini
The additional header file makes the declaration for the function '
init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)xen/arch/x86/i8259.c +0
-0xen/arch/x86/i8259.c line 24
Quoted 6 lines
xen/arch/x86/i8259.c +1
-0@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h> A patch adding this #include has been pending for almost 3 months:
https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html
Quoted 6 lines
Quoted 3 lines
So do you prefer going forward with that patch or this one (mentioning it
in the additional commit context of course)?I would prefer using the much older patch, but of course this requires someone providing R-b or A-b.
Hi Jan, normally I'd be happy to do that but that patch makes other changes that I don't feel confident enough to Ack.
For instance:
+ for ( offs = 0, i = pic_alias_mask & -pic_alias_mask ?: 2;
+ offs <= pic_alias_mask; offs += i )
pic_alias_mask is declared as unsigned int.
Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4
Quoted 34 lines · Stefano Stabellini
Quoted 33 lines · Jan Beulich
Quoted 31 lines · Nicola Vetrini
Quoted 12 lines · Jan Beulich
Quoted 11 lines · Nicola Vetrini
The additional header file makes the declaration for the function '
init_IRQ', defined in this file visible, thereby resolving the violation of Rule 8.4.No functional change.
Signed-off-by Nicola Vetrini <[email protected]>--- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+)Quoted 14 lines
xen/arch/x86/i8259.c line 24
Quoted 11 lines
xen/arch/x86/i8259.c +1
-0@@ -19,6 +19,7 @@#include <xen/delay.h> #include <asm/apic.h> #include <asm/asm_defns.h> +#include <asm/setup.h> #include <io_ports.h> #include <irq_vectors.h> A patch adding this #include has been pending for almost 3 months:
https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.htmlSo do you prefer going forward with that patch or this one (mentioning it
in the additional commit context of course)?
Quoted 5 lines
Quoted 2 lines
I would prefer using the much older patch, but of course this requires someone providing R-b or A-b.
Hi Jan, normally I'd be happy to do that but that patch makes other changes that I don't feel confident enough to Ack.
I understand that in general, but for this specific case ...
Quoted 6 lines
For instance:
(quoted diff) +2
-0+ for ( offs = 0, i = pic_alias_mask & -pic_alias_mask ?: 2; + offs <= pic_alias_mask; offs += i )
pic_alias_maskis declared as unsigned int.
... you're concerned of me negating it? That's a common pattern to determine the largest power-of-2 factor. I'm unaware of a good alternative.
Jan
PATCH 8/8 x86/nmi: address MISRA C:2012 Rule 8.4
In reply to Nicola VetriniInclude an additional header to make the declarations for functions 'watchdog_*' visible prior to their definition in the file, thereby resolving the violations of Rule 8.4.
No functional change.
--- xen/arch/x86/nmi.c | 1 + 1 file changed, 1 insertion(+)
xen/arch/x86/nmi.c +1 -0
@@ -24,6 +24,7 @@#include <xen/console.h> #include <xen/smp.h> #include <xen/keyhandler.h> +#include <xen/watchdog.h> #include <xen/cpu.h> #include <asm/current.h> #include <asm/mc146818rtc.h>
Signature · 1 line
2.34.1
Re: [XEN PATCH 8/8] x86/nmi: address MISRA C:2012 Rule 8.4
Quoted 5 lines · Nicola Vetrini
Include an additional header to make the declarations for functions 'watchdog_*' visible prior to their definition in the file, thereby resolving the violations of Rule 8.4.
No functional change.
Quoted 1 line
Signed-off-by Nicola Vetrini <[email protected]>