[XEN PATCH] arm64/vfp: address MISRA C:2012 Dir 4.3

2023-08-23 Thread Nicola Vetrini
functional change. Signed-off-by: Nicola Vetrini --- A couple of remarks: - An inline function is another possible encapsulation technique - A #define wrapper() do { asm volatile (...) } while(0); is also allowed, but I don't think this is needed in the specific case. --- xen/arch/arm/arm64/

Re: [XEN PATCH v2 2/3] vpci/msix: make 'get_slot' static

2023-08-23 Thread Nicola Vetrini
On 17/08/2023 14:39, Nicola Vetrini wrote: The function can become static since it's used only within this file. This also resolves a violation of MISRA C:2012 Rule 8.4 due to the absence of a declaration before the function definition. Fixes: b177892d2d0e ("vpci/msix: handle acc

[RFC PATCH 0/3] docs/misra: add documentation to address MISRA C:2012 Dir 4.1

2023-08-21 Thread Nicola Vetrini
y: the one provided is just a basic skeleton that should be tailored to the project. Nicola Vetrini (3): docs/misra: add documentation for MISRA C:2012 Dir 4.1 docs: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR automation/eclair: build docs/misra to address MISRA C:2012 Dir 4.1

[RFC PATCH 3/3] automation/eclair: build docs/misra to address MISRA C:2012 Dir 4.1

2023-08-21 Thread Nicola Vetrini
The documentation pertaining Directive 4.1 is contained in docs/misra. The build script driving the analysis is amended to allow ECLAIR to find it and thus resolving violations of the directive. Signed-off-by: Nicola Vetrini --- automation/eclair_analysis/build.sh | 10 -- automation

[RFC PATCH 2/3] docs: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR

2023-08-21 Thread Nicola Vetrini
-by: Nicola Vetrini --- docs/Makefile | 7 ++- docs/misra/Makefile | 36 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 docs/misra/Makefile diff --git a/docs/Makefile b/docs/Makefile index 966a104490ac..ff991a0c3ca2 100644 --- a/docs

[RFC PATCH 1/3] docs/misra: add documentation for MISRA C:2012 Dir 4.1

2023-08-21 Thread Nicola Vetrini
The aforementioned directive requires the project to supply documentation on the measures taken towards the minimization of run-time failures. The 'rules.rst' file is updated accordingly to mention the newly added documentation. Signed-off-by: Nicola Vetrini --- docs/misra/C-runtime

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1

2023-08-18 Thread Nicola Vetrini
/rules.rst and other docs. Please send out to me a list of deviations/configurations and I'll make sure to reflect them under docs/misra so that they are in sync. Cheers, Stefano Sure, I'll let you know when I have it. Thanks, -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https

Re: [XEN PATCH v2 3/3] drivers/video: make declarations of defined functions available

2023-08-17 Thread Nicola Vetrini
I guess I can make a standalone patch with this modification if the other patches of this series go in as is. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH v2 3/3] drivers/video: make declarations of defined functions available

2023-08-17 Thread Nicola Vetrini
On 17/08/2023 15:28, Jan Beulich wrote: On 17.08.2023 14:39, Nicola Vetrini wrote: --- a/xen/include/xen/vga.h +++ b/xen/include/xen/vga.h @@ -15,4 +15,20 @@ extern struct xen_vga_console_info vga_console_info; #endif +int fill_console_start_info(struct dom0_vga_console_info *); + +#ifdef

[XEN PATCH v2 0/3] xen: fix inclusions and static storage duration

2023-08-17 Thread Nicola Vetrini
1,2,4 from the previous version have already been committed Nicola Vetrini (3): vm_event: rework inclusions to use arch-indipendent header vpci/msix: make 'get_slot' static drivers/video: make declarations of defined functions available xen/arch/arm/include/asm/vm_event.h | 1 - xe

[XEN PATCH v2 2/3] vpci/msix: make 'get_slot' static

2023-08-17 Thread Nicola Vetrini
The function can become static since it's used only within this file. This also resolves a violation of MISRA C:2012 Rule 8.4 due to the absence of a declaration before the function definition. Fixes: b177892d2d0e ("vpci/msix: handle accesses adjacent to the MSI-X table") Signed-off-

[XEN PATCH v2 1/3] vm_event: rework inclusions to use arch-indipendent header

2023-08-17 Thread Nicola Vetrini
when defining functions in 'xen/arch/x86/vm_event.c' Signed-off-by: Nicola Vetrini --- Changes in v2: - Include the arch-specific header in the common one, and only include the latter in source files. The following functions have been mainly touched by the following commits, but the present

[XEN PATCH v2 3/3] drivers/video: make declarations of defined functions available

2023-08-17 Thread Nicola Vetrini
violations of MISRA C:2012 Rule 8.4. Fixes: 6d9199bd0f22 ("x86-64: enable hypervisor output on VESA frame buffer") Signed-off-by: Nicola Vetrini --- Changes in v2: - Moved fill_console_start_info to vga.h (21bee1787021 introduced this function) --- xen/arch/x86/include/asm/setup.h | 6 -

Re: Remove unused function 'do_trap_fiq'

2023-08-17 Thread Nicola Vetrini
On 16/08/2023 17:28, Julien Grall wrote: On 16/08/2023 16:18, Nicola Vetrini wrote: Hi, Hi, the function mentioned in the subject, defined in 'xen/arch/arm/traps.c' seems to have no caller (either from C code or from asm code), so I think it can be safely removed, unless there's a reason

Re: Placing of the documentation for MISRA C:2012 Directive 4.1

2023-08-17 Thread Nicola Vetrini
On 16/08/2023 21:41, Stefano Stabellini wrote: On Wed, 16 Aug 2023, Nicola Vetrini wrote: Hi, it has been agreed during past MISRA meetings that Directive 4.1 ("Run-time failures shall be minimized") shall be dealt with by documenting how in Xen such runtime failures are pre

Placing of the documentation for MISRA C:2012 Directive 4.1

2023-08-16 Thread Nicola Vetrini
ropriately. As a side note, the directive should be added to docs/misra/rules.rst. It can be part of the patch addressing the violations, tough. [1] https://github.com/BUGSENG/eclair_demo/blob/main/ECLAIR/MISRA_C_2012_doc.h -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Remove unused function 'do_trap_fiq'

2023-08-16 Thread Nicola Vetrini
Hi, the function mentioned in the subject, defined in 'xen/arch/arm/traps.c' seems to have no caller (either from C code or from asm code), so I think it can be safely removed, unless there's a reason for it to remain in Xen. Regards, -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1

2023-08-16 Thread Nicola Vetrini
On 16/08/2023 13:23, Jan Beulich wrote: On 16.08.2023 12:47, Nicola Vetrini wrote: On 16/08/2023 12:31, Jan Beulich wrote: On 16.08.2023 12:01, Nicola Vetrini wrote: On 08/08/2023 11:03, Nicola Vetrini wrote: On 04/08/2023 08:42, Jan Beulich wrote: On 04.08.2023 01:50, Stefano Stabellini

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1

2023-08-16 Thread Nicola Vetrini
On 16/08/2023 12:31, Jan Beulich wrote: On 16.08.2023 12:01, Nicola Vetrini wrote: Hi, On 08/08/2023 11:03, Nicola Vetrini wrote: On 04/08/2023 08:42, Jan Beulich wrote: On 04.08.2023 01:50, Stefano Stabellini wrote: On Thu, 3 Aug 2023, Jan Beulich wrote: On 02.08.2023 16:38, Nicola

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1

2023-08-16 Thread Nicola Vetrini
Hi, On 08/08/2023 11:03, Nicola Vetrini wrote: On 04/08/2023 08:42, Jan Beulich wrote: On 04.08.2023 01:50, Stefano Stabellini wrote: On Thu, 3 Aug 2023, Jan Beulich wrote: On 02.08.2023 16:38, Nicola Vetrini wrote: Rule 2.1 states: "A project shall not contain unreachable

Re: [XEN PATCH 3/6] x86/vm_event: add missing include

2023-08-14 Thread Nicola Vetrini
CC-ing the missing maintainers here, both from x86 and vm_event -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH 3/6] x86/vm_event: add missing include

2023-08-14 Thread Nicola Vetrini
Hi, On 14/08/2023 13:01, Julien Grall wrote: Hi, On 14/08/2023 11:33, Nicola Vetrini wrote: On 14/08/2023 09:39, Jan Beulich wrote: On 11.08.2023 09:19, Nicola Vetrini wrote: The missing header included by this patch provides declarations for the functions 'vm_event_{fill_regs

Re: [XEN PATCH 3/6] x86/vm_event: add missing include

2023-08-14 Thread Nicola Vetrini
On 14/08/2023 09:39, Jan Beulich wrote: On 11.08.2023 09:19, Nicola Vetrini wrote: The missing header included by this patch provides declarations for the functions 'vm_event_{fill_regs,set_registers,monitor_next_interrupt}' that are defined in the source file. This also resolves violations

Re: [XEN PATCH 6/6] drivers/video: make declarations of defined functions available

2023-08-14 Thread Nicola Vetrini
On 14/08/2023 10:12, Jan Beulich wrote: On 14.08.2023 09:56, Nicola Vetrini wrote: On 14/08/2023 09:47, Jan Beulich wrote: On 11.08.2023 09:19, Nicola Vetrini wrote: --- a/xen/drivers/video/vga.c +++ b/xen/drivers/video/vga.c @@ -9,6 +9,7 @@ #include #include #include +#include xen

[XEN PATCH v2] x86: address MISRA C:2012 Rule 5.3

2023-08-14 Thread Nicola Vetrini
' as a parameter, which is defined in the same file as the function, thus it does not need that parameter, which is a cause of shadowing, as explained above. Signed-off-by: Nicola Vetrini --- Changes in v2: - Mention 'kexec_reserve_area' in the commit message. Other occurrences of shadowing on the same

[XEN PATCH v2] xen/arm: traps: remove unused function 'dump_guest_s1_walk'

2023-08-14 Thread Nicola Vetrini
The function has no uses in the codebase, and can be removed. This also avoids the violation of MISRA C:2012 Rule 8.4 and Rule 2.1 because it has no declaration and the function's code is unreachable. Suggested-by: Julien Grall Signed-off-by: Nicola Vetrini --- Changes in v2: - Modified commit

Re: [XEN PATCH 6/6] drivers/video: make declarations of defined functions available

2023-08-14 Thread Nicola Vetrini
On 14/08/2023 09:47, Jan Beulich wrote: On 11.08.2023 09:19, Nicola Vetrini wrote: --- a/xen/drivers/video/vga.c +++ b/xen/drivers/video/vga.c @@ -9,6 +9,7 @@ #include #include #include +#include xen/vga.h, which you move the declarations to, is already included here. Why the need

Re: [XEN PATCH 5/6] vpic/msix: make 'get_slot' static

2023-08-14 Thread Nicola Vetrini
On 14/08/2023 09:44, Jan Beulich wrote: On 11.08.2023 09:19, Nicola Vetrini wrote: The function can become static since it's used only within this file. This also resolves a violation of MISRA C:2012 Rule 8.4 due to the absence of a declaration before the function definition. Signed-off

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

2023-08-14 Thread Nicola Vetrini
Signed-off-by: Nicola Vetrini 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

Re: [XEN PATCH 3/6] x86/vm_event: add missing include

2023-08-12 Thread Nicola Vetrini
, as done in the patch? -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

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

2023-08-11 Thread Nicola Vetrini
/s8/int8_t/. Signed-off-by: Nicola Vetrini 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

[XEN PATCH 4/6] cpufreq: add missing include of header 'pmstat.h'

2023-08-11 Thread Nicola Vetrini
The missing header included by this patch provides a declaration for 'set_px_pminfo' that is visible prior to the definition in this file. This also resolves a violation of MISRA C:2012 Rule 8.4. Signed-off-by: Nicola Vetrini Fixes: 452119c09420 ("x86 and ia64: move cpufreq notify

[XEN PATCH 0/6] xen: fix missing headers and static storage duration

2023-08-11 Thread Nicola Vetrini
t the case. No functional change. Additional notes: - This series is a continuation of the work done here [1], so the same additional notes apply. [1] https://lore.kernel.org/xen-devel/cover.1691655814.git.nicola.vetr...@bugseng.com/T/#m28da1b5ef8d9a7683937bfc345765e3438b89977 Nicola Vetrini (6):

[XEN PATCH 5/6] vpic/msix: make 'get_slot' static

2023-08-11 Thread Nicola Vetrini
The function can become static since it's used only within this file. This also resolves a violation of MISRA C:2012 Rule 8.4 due to the absence of a declaration before the function definition. Signed-off-by: Nicola Vetrini Fixes: b177892d2d0e ("vpci/msix: handle accesses adjacent to the

[XEN PATCH 6/6] drivers/video: make declarations of defined functions available

2023-08-11 Thread Nicola Vetrini
Signed-off-by: Nicola Vetrini Fixes: ebb26b509f1a ("xen/x86: make VGA support selectable") Fixes: 6d9199bd0f22 ("x86-64: enable hypervisor output on VESA frame buffer") --- xen/arch/x86/include/asm/setup.h | 6 -- xen/drivers/video/vga.c | 9 + xen/inc

[XEN PATCH 3/6] x86/vm_event: add missing include

2023-08-11 Thread Nicola Vetrini
The missing header included by this patch provides declarations for the functions 'vm_event_{fill_regs,set_registers,monitor_next_interrupt}' that are defined in the source file. This also resolves violations of MISRA C:2012 Rule 8.4. Signed-off-by: Nicola Vetrini Fixes: adc75eba8b15 (&quo

[XEN PATCH 1/6] x86/hpet: make variable 'per_cpu__cpu_bc_channel' static

2023-08-11 Thread Nicola Vetrini
The variable is only ever used inside the file where it's defined, therefore it can have static storage. This also resolves a violation of MISRA C:2012 Rule 8.4 due to the absence of a declaration prior to the definition. Signed-off-by: Nicola Vetrini Fixes: 3ba523ff957c ("CPUIDLE: enabl

[XEN PATCH] x86: address MISRA C:2012 Rule 5.3

2023-08-10 Thread Nicola Vetrini
both are defined in the same file (mentioned above). This in turn causes several other functions to lose their parameter 'e820' because they are involved in the call chain that leads to 'e820_add_range'. Signed-off-by: Nicola Vetrini --- Other occurrences of shadowing on the same global

Re: [XEN PATCH 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3

2023-08-10 Thread Nicola Vetrini
On 09/08/2023 14:45, Jan Beulich wrote: On 09.08.2023 09:55, Nicola Vetrini wrote: The local variables 'irq_desc' shadow the homonymous global variable, declared in 'xen/arch/x86/include/asm/irq.h', therefore they are renamed 'irqd' for consistency. Perhaps with "for consistency&quo

Re: [XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'

2023-08-10 Thread Nicola Vetrini
On 10/08/2023 11:29, Nicola Vetrini wrote: The function in question has no callers and its removal has already been proposed (and acked) as part of this larger series [1]. There have been further bugfixes to that function [2], but they do not add any caller, hence it can be removed. [1

[XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'

2023-08-10 Thread Nicola Vetrini
-27-git-send-email-julien.gr...@linaro.org/ [2] https://lore.kernel.org/xen-devel/20160720161017.4508-1-...@galois.com/ Signed-off-by: Nicola Vetrini Suggested-by: Julien Grall --- xen/arch/arm/traps.c | 57 1 file changed, 57 deletions(-) diff --git

[XEN PATCH v2 6/7] xen/arm: mm: add missing extern variable declaration

2023-08-10 Thread Nicola Vetrini
Add a declaration for the variable 'init_ttbr' to resolve the violation of Rule 8.4 present the relative source file 'mm.c'. No functional changes. Signed-off-by: Nicola Vetrini Fixes: 4557c2292854 ("xen: arm: rewrite start of day page table and cpu bring up") Reviewed-by: Luc

[XEN PATCH v2 2/7] xen: make 'saved_cmdline' static

2023-08-10 Thread 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 Fixes: e6ee01ad24b6 ("xen/version: Drop compat/kernel.c") Reviewed-by: Luca Fancellu

[XEN PATCH v2 5/7] x86: make some functions and variables static rather than extern

2023-08-10 Thread 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 Fixes: 741367e77d6c ("mce: Clean-up mcheck_init handler") Fixes: 45

[XEN PATCH v2 4/7] xen/arm: make declarations visible before function definitions

2023-08-10 Thread 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. Signed-off-by: Nicola Vetrini Fixes

[XEN PATCH v2 7/7] x86/nmi: include missing header with declarations for 'watchdog_*'

2023-08-10 Thread 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. Signed-off-by: Nicola Vetrini Fixes: c8177e691f0f ("watchdog: Move watchdog from being x86 spe

[XEN PATCH v2 0/7] fix missing headers and static storage duration

2023-08-10 Thread Nicola Vetrini
ot; tags and mention that these are bugfixes - Split patch 4/8 of the previous version - Drop patch 7/8 of the previous version, because it's already addressed by this patch [1] [1] https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html Nicola Vetrini (7): xen/memory: make 'ioreq_server_max_

[XEN PATCH v2 1/7] xen/memory: make 'ioreq_server_max_frames' static

2023-08-10 Thread 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 Fixes: 9244528955de ("xen/memory: Fix acquire_resource

[XEN PATCH v2 3/7] xen/include: make a declaration of 'get_sec' visible where needed

2023-08-10 Thread Nicola Vetrini
A declaration for 'get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particular 'cper.h'). This also resolves a violation of MISRA C:2012 Rule 8.4. Signed-off-by: Nicola Vetrini Fixes: c8cb30cfc87a ("mce: Provide ERST interface") --- Changes in v2:

Re: [XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
On 09/08/2023 14:52, Jan Beulich wrote: On 09.08.2023 13:02, Nicola Vetrini wrote: 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

Re: [XEN PATCH 3/8] xen: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
On 09/08/2023 15:50, Luca Fancellu wrote: On 9 Aug 2023, at 12:02, Nicola Vetrini wrote: 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

Re: [XEN PATCH 2/2] xen/delay: address MISRA C:2012 Rule 5.3.

2023-08-09 Thread Nicola Vetrini
On 09/08/2023 15:56, Luca Fancellu wrote: On 9 Aug 2023, at 08:55, Nicola Vetrini wrote: The variable 'msec' declared in the macro shadows the local variable in 'ehci_dbgp_bios_handoff', but to prevent any future clashes with other functions the macro is converted to a static inline function

Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
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 -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
On 09/08/2023 14:42, Jan Beulich wrote: On 09.08.2023 13:02, Nicola Vetrini wrote: '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

[XEN PATCH 1/8] arm/efi: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/arch/arm/efi/efi-boot.h | 2 +- 1 file changed, 1

[XEN PATCH 7/8] x86/i8259: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/arch/x86/i8259.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86

[XEN PATCH 8/8] x86/nmi: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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. Signed-off-by: Nicola Vetrini --- xen/arch/x86/nmi.c | 1 + 1 file changed, 1 insertion(+) diff

[XEN PATCH 5/8] x86: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce_amd.c

[XEN PATCH 6/8] xen/arm: mm: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/arch/arm/include/asm/mm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/include

[XEN PATCH 0/8] xen: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
de 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: m

[XEN PATCH 4/8] xen/arm: address MISRA C:2012 Rule 8.4

2023-08-09 Thread Nicola Vetrini
for 'get_sec' is added in 'xen/include/xen/time.h' to be available for every call site (in particular cper.h). Signed-off-by: Nicola Vetrini --- 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

[XEN PATCH 2/8] xen/memory: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/common/memory.c | 2 +- 1 file changed, 1 insertion

[XEN PATCH 3/8] xen: address MISRA C:2012 Rule 8.4

2023-08-09 Thread 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 --- xen/common/kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen

[XEN PATCH 0/2] xen: address MISRA C:2012 Rule 5.3

2023-08-09 Thread Nicola Vetrini
://lore.kernel.org/xen-devel/cover.1691492441.git.nicola.vetr...@bugseng.com/ [2] https://lore.kernel.org/xen-devel/cover.1691488505.git.nicola.vetr...@bugseng.com/ Nicola Vetrini (2): x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3 xen/delay: address MISRA C:2012 Rule 5.3. xen/arch

[XEN PATCH 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3

2023-08-09 Thread Nicola Vetrini
The local variables 'irq_desc' shadow the homonymous global variable, declared in 'xen/arch/x86/include/asm/irq.h', therefore they are renamed 'irqd' for consistency. Signed-off-by: Nicola Vetrini --- xen/arch/x86/hvm/vmsi.c | 22 +++--- 1 file changed, 11 insertions(+), 11

[XEN PATCH 2/2] xen/delay: address MISRA C:2012 Rule 5.3.

2023-08-09 Thread Nicola Vetrini
The variable 'msec' declared in the macro shadows the local variable in 'ehci_dbgp_bios_handoff', but to prevent any future clashes with other functions the macro is converted to a static inline function. No functional change. Signed-off-by: Nicola Vetrini --- xen/include/xen/delay.h | 8

Re: [XEN PATCH v2 1/5] x86: address MISRA C:2012 Rule 5.3

2023-08-09 Thread Nicola Vetrini
On 08/08/2023 15:46, Jan Beulich wrote: On 08.08.2023 13:08, Nicola Vetrini wrote: --- a/xen/arch/x86/e820.c +++ b/xen/arch/x86/e820.c @@ -543,27 +543,27 @@ static void __init machine_specific_memory_setup(struct e820map *raw) clip_to_limit(top_of_ram, "MTRRs do not cove

Re: [XEN PATCH 10/11] xen/sched: add ASSERT_UNREACHABLE() to address MISRA C:2012 Rule 2.1

2023-08-08 Thread Nicola Vetrini
at break should indeed go away. However, the main thing that's holding me back from doing a slimmed-down v2 here is that evidently there's no consensus even on the ASSERT_UNREACHABLE() patches. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH v3 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
l go for the latter (it's quicker) as a separate patch, since hopefully the other patch in the series can go in unmodified. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: [XEN PATCH v3 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
On 08/08/2023 15:22, Jan Beulich wrote: On 08.08.2023 14:22, Nicola Vetrini wrote: The local variables 'irq_desc' shadow the homonymous global variable, declared in 'xen/arch/x86/include/asm/irq.h', therefore they are renamed 'irqd' for consistency with ARM code. Other variables of the same

[XEN PATCH v3 2/2] x86/setup: address MISRA C:2012 Rule 5.3 and 8.3

2023-08-08 Thread Nicola Vetrini
uched by this commit. No functional changes. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v2: - Clarified commit message As mentioned in the preivious iteration's thread: the declaration itself is a scope and shadowing can happen, as in: int x; void f(int x, int arr[x]

[XEN PATCH v3 0/2] x86: address MISRA C:2012 Rule 5.3 and 8.3

2023-08-08 Thread Nicola Vetrini
This series is the part of series [1] that needed further adjustments. The first two patches of that series are already committed. The changes in this version are detailed in the individual commit messages. [1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg00492.html Nicola

[XEN PATCH v3 1/2] x86/vmsi: rename variables to address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
The local variables 'irq_desc' shadow the homonymous global variable, declared in 'xen/arch/x86/include/asm/irq.h', therefore they are renamed 'irqd' for consistency with ARM code. Other variables of the same type in the file are also renamed 'irqd' for consistency. Signed-off-by: Nicola Vetrini

Re: [XEN PATCH v2 5/5] x86: refactor macros in 'xen-mca.h'

2023-08-08 Thread Nicola Vetrini
On 08/08/2023 13:08, Nicola Vetrini wrote: The macros defined 'xen/include/public/arch-x86/xen-mca.h' are revised to address the following concerns: - needless underscore prefixes for parameter names; - the variable 'i' in function 'mce_action' that is shadowed by the local variable

[XEN PATCH v2 3/5] x86/include: address MISRA C:2012 Rule 5.3.

2023-08-08 Thread Nicola Vetrini
Variable 'mpc_default_type' in 'xen/arch/x86/include/asm/mpspec.h' has no uses and causes shadowing with function parameter names in 'mpparse.c'. Therefore, it is removed. No functional changes. Signed-off-by: Nicola Vetrini --- Changes in v2: - Removed the variable. --- xen/arch/x86/include

[XEN PATCH v2 5/5] x86: refactor macros in 'xen-mca.h'

2023-08-08 Thread Nicola Vetrini
to resolve present shadowing issues, which violate MISRA C:2012 Rule 5.3, and lessen the probability of future ones with some renames. No functional change. Signed-off-by: Nicola Vetrini --- Changes in v2: - Added missing parentheses. - Clarified commit message. --- xen/include/public/arch-x86/xen-mca.h

[XEN PATCH v2 4/5] x86/xstate: address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
Rename the local variables s/xsave/xstate/ to avoid clashing with function 'xsave' defined in 'xen/arch/x86/include/asm/xstate.h'. No functional changes. Signed-off-by: Nicola Vetrini --- Changes in v2: - s/xsave_area/xstate/, since that is the newest common name, also used in other parts

[XEN PATCH v2 1/5] x86: address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
visible from their definitions in 'e820.c'. Signed-off-by: Nicola Vetrini --- Changes in v2: - Reworked the patch to remove the parameter e820 where possible and consequential changes to the involved functions. --- xen/arch/x86/e820.c | 36 ++--- xen/arch

[XEN PATCH v2 2/5] xen/delay: address MISRA C:2012 Rule 5.3.

2023-08-08 Thread Nicola Vetrini
The variable 'msec' declared in the macro shadows the local variable in 'ehci_dbgp_bios_handoff', but to prevent any future clashes with other functions the macro is converted to a static inline function. No functional change. Signed-off-by: Nicola Vetrini --- Changes in v2: - Switched

[XEN PATCH v2 0/5] x86: address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
-- Changes in v2: - Addressed numerous review comments - Dropped patch 2/6 [2], as that has already been committed [1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg00538.html [2] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg00539.html Nicola Vetrini (5): x8

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1

2023-08-08 Thread Nicola Vetrini
On 04/08/2023 08:42, Jan Beulich wrote: On 04.08.2023 01:50, Stefano Stabellini wrote: On Thu, 3 Aug 2023, Jan Beulich wrote: On 02.08.2023 16:38, Nicola Vetrini wrote: Rule 2.1 states: "A project shall not contain unreachable code". The functions - machine_halt - ma

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3

2023-08-08 Thread Nicola Vetrini
On 07/08/2023 11:10, Jan Beulich wrote: On 07.08.2023 10:59, Nicola Vetrini wrote: On 07/08/2023 10:09, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: The variable declared in the header file 'xen/arch/x86/include/asm/e820.h' is shadowed by many function parameters, so

Re: [XEN PATCH v2 2/4] x86/mtrr: address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 14:48, Jan Beulich wrote: On 04.08.2023 22:45, Stefano Stabellini wrote: On Fri, 4 Aug 2023, Nicola Vetrini wrote: Rename variables to avoid shadowing and thus address MISRA C:2012 Rule 5.3: "An identifier declared in an inner scope shall not hide an identifier dec

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 10:09, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: The variable declared in the header file 'xen/arch/x86/include/asm/e820.h' is shadowed by many function parameters, so it is renamed to avoid these violations. No functional changes. Signed-off-by: Nicola

Re: [XEN PATCH v2 4/4] x86/setup: address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 15:42, Jan Beulich wrote: On 07.08.2023 15:18, Nicola Vetrini wrote: On 07/08/2023 15:05, Jan Beulich wrote: On 04.08.2023 10:03, Nicola Vetrini wrote: The parameters renamed in the function declaration caused shadowing with the homonymous variable in 'xen/common/efi/boot.c

Re: [XEN PATCH v2 4/4] x86/setup: address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 15:05, Jan Beulich wrote: On 04.08.2023 10:03, Nicola Vetrini wrote: The parameters renamed in the function declaration caused shadowing with the homonymous variable in 'xen/common/efi/boot.c'. Renaming them also addresses Rule 8.3: "All declarations of an object or function

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
not the preferred alternative (as the global may be dropped or the callers may use a e820map other than the global one, but here I recognize my lack of knowledge on the internals of Xen). -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

Re: Address MISRA C:2012 Rule 8.4

2023-08-07 Thread Nicola Vetrini
, since they are not called by Xen code. Imo it should be the compiler to provide a prototype for these (much like it does for builtins), thus ensuring that an implementation actually matches the compiler's expectations. Yet afaics it doesn't. Jan Then it's perhaps best to deviate them. -- Nicola

Re: [XEN PATCH 6/6] x86: refactor macros in 'xen-mca.h' to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 10:31, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: The macros defined 'xen/include/public/arch-x86/xen-mca.h' have needless underscore prefixes for parameter names and variable names that cause shadowing with e.g. the variable 'i' in function 'mce_action

Re: [XEN PATCH 3/6] xen/delay: address MISRA C:2012 Rule 5.3.

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 11:15, Jan Beulich wrote: On 07.08.2023 11:01, Julien Grall wrote: On 07/08/2023 09:14, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: --- a/xen/include/xen/delay.h +++ b/xen/include/xen/delay.h @@ -5,6 +5,6 @@ #include #define mdelay(n) (\ - {unsigned

Re: [XEN PATCH 5/6] x86/xstate: address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 10:23, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: Rename the local variables to avoid clashing with function 'xstate' defined below, but declared in the corresponding header file. Hmm, there are two functions with such a local variable, but you don't change

Re: [XEN PATCH 2/6] libelf: address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 10:11, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: The types u{8,16,32,64} defined in 'xen/arch/x86/include/asm/types.h' shadow the variables in the modified function, hence violating Rule 5.3. Therefore, the rename takes care of the shadowing. No functional

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 07/08/2023 10:09, Jan Beulich wrote: On 04.08.2023 17:27, Nicola Vetrini wrote: The variable declared in the header file 'xen/arch/x86/include/asm/e820.h' is shadowed by many function parameters, so it is renamed to avoid these violations. No functional changes. Signed-off-by: Nicola

Re: [XEN PATCH 10/11] xen/sched: add ASSERT_UNREACHABLE() to address MISRA C:2012 Rule 2.1

2023-08-07 Thread Nicola Vetrini
On 03/08/2023 11:17, Jan Beulich wrote: On 02.08.2023 16:38, Nicola Vetrini wrote: --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2233,6 +2233,7 @@ static bool sched_tasklet_check_cpu(unsigned int cpu) /* fallthrough */ case TASKLET_enqueued|TASKLET_scheduled

Re: [XEN PATCH v2 3/4] x86/irq: rename variable to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 04/08/2023 22:47, Stefano Stabellini wrote: On Fri, 4 Aug 2023, Nicola Vetrini wrote: The extern variable 'irq_desc' defined in 'irq.h' is shadowed by local variables in the changed file. To avoid this, the variable is renamed to 'irq_description'. No functional change. Signed-off

Re: [XEN PATCH 4/6] x86/include: address MISRA C:2012 Rule 5.3.

2023-08-07 Thread Nicola Vetrini
On 04/08/2023 23:24, Stefano Stabellini wrote: On Fri, 4 Aug 2023, Nicola Vetrini wrote: s/mpc_default_type/mpc_default in 'xen/arch/x86/include/asm/mpspec.h' to avoid clashing with function parameter names in 'mpparse.c'. No functional changes. Signed-off-by: Nicola Vetrini --- Even though

Re: [XEN PATCH 1/6] x86: rename variable 'e820' to address MISRA C:2012 Rule 5.3

2023-08-07 Thread Nicola Vetrini
On 04/08/2023 23:19, Stefano Stabellini wrote: On Fri, 4 Aug 2023, Nicola Vetrini wrote: The variable declared in the header file 'xen/arch/x86/include/asm/e820.h' is shadowed by many function parameters, so it is renamed to avoid these violations. No functional changes. Signed-off

Re: [XEN PATCH 6/6] x86: refactor macros in 'xen-mca.h' to address MISRA C:2012 Rule 5.3

2023-08-04 Thread Nicola Vetrini
? mic_ : NULL;\ } while (0) -- 2.34.1 Stray blanks here, sorry. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)

[XEN PATCH 2/6] libelf: address MISRA C:2012 Rule 5.3

2023-08-04 Thread Nicola Vetrini
The types u{8,16,32,64} defined in 'xen/arch/x86/include/asm/types.h' shadow the variables in the modified function, hence violating Rule 5.3. Therefore, the rename takes care of the shadowing. No functional changes. Signed-off-by: Nicola Vetrini --- xen/common/libelf/libelf-tools.c | 24

[XEN PATCH 6/6] x86: refactor macros in 'xen-mca.h' to address MISRA C:2012 Rule 5.3

2023-08-04 Thread Nicola Vetrini
of future ones. No functional change. Signed-off-by: Nicola Vetrini --- The spirit of this patch is similar to this one [1] made by Jan that arose from a violation of this rule. [1] https://gitlab.com/xen-project/xen/-/commit/c0579c65f6bef794cd449fbc946feacccf485f2e --- xen/include/public/arch

<    3   4   5   6   7   8   9   10   >