arm: address some violations of MISRA C:2012 Rule 8.2
cover arm: address some violations of MISRA C:2012 Rule 8.2
This patch series addresses some of the violations of Rule 8.2 adding the missing parameter names.
Federico Serafini (10):
arm/gic: address violations of MISRA C:2012 Rule 8.2 arm/cpufeature: address violations of MISRA C:2012 Rule 8.2 arm/smpboot: address violations of MISRA C:2012 Rule 8.2 arm/setup: address violations of MISRA C:2012 Rule 8.2 arm/p2m: address a violation of MISRA C:2012 Rule 8.2 arm/cmpxchg: address violations of MISRA C:2012 Rule 8.2 arm/traps: address a violation of MISRA C:2012 Rule 8.2 arm/vgic-v3: address a violation of MISRA C:2012 Rule 8.2 arm/domain: address violations of MISRA C:2012 Rule 8.2 arm/smmu: address violation of MISRA C:2012 Rule 8.2
xen/arch/arm/arm64/smpboot.c | 2 +- xen/arch/arm/include/asm/arm32/cmpxchg.h | 2 +- xen/arch/arm/include/asm/arm64/cmpxchg.h | 2 +- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- xen/arch/arm/include/asm/domain.h | 4 ++-- xen/arch/arm/include/asm/gic.h | 12 ++++++------ xen/arch/arm/include/asm/p2m.h | 2 +- xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/arm/setup.c | 4 ++-- xen/arch/arm/traps.c | 2 +- xen/arch/arm/vgic-v3.c | 2 +- xen/drivers/passthrough/arm/smmu.c | 6 +++--- 12 files changed, 26 insertions(+), 25 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/10 arm/gic: address violations of MISRA C:2012 Rule 8.2
Add missing parameter names, no functional change.
--- xen/arch/arm/include/asm/gic.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/include/asm/gic.h +6 -6
@@ -246,7 +246,7 @@ void gic_set_irq_type(struct irq_desc *desc, unsigned int type);/* Program the GIC to route an interrupt */ extern void gic_route_irq_to_xen (struct irq_desc *desc,unsigned int priority); -extern int gic_route_irq_to_guest (struct domain *,unsigned int virq, +extern int gic_route_irq_to_guest (struct domain *d,unsigned int virq,struct irq_desc *desc,unsigned int priority);
@@ -330,11 +330,11 @@ struct gic_hw_operations {/* Initialize the GIC and the boot CPU */ int (*init)(void );/* Save GIC registers */ -void (*save_state)(struct vcpu *); +void (*save_state)(struct vcpu *v);/* Restore GIC registers */ -void (*restore_state)(const struct vcpu *); +void (*restore_state)(const struct vcpu *v);/* Dump GIC LR register information */ -void (*dump_state)(const struct vcpu *); +void (*dump_state)(const struct vcpu *v);/* hw_irq_controller to enable/disable/eoi host irq */ hw_irq_controller *gic_host_irq_type;
@@ -369,9 +369,9 @@ struct gic_hw_operations {/* Clear LR register */ void (*clear_lr)(int lr);/* Read LR register and populate gic_lr structure */ -void (*read_lr)(int lr,struct gic_lr *); +void (*read_lr)(int lr,struct gic_lr *lr_reg);/* Write LR register from gic_lr structure */ -void (*write_lr)(int lr,const struct gic_lr *); +void (*write_lr)(int lr,const struct gic_lr *lr_reg);/* Read VMCR priority */ unsigned int (*read_vmcr_priority)(void );/* Read APRn register */
Signature · 1 line
2.34.1
Re: [XEN PATCH 01/10] arm/gic: address violations of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>
Re: [XEN PATCH 01/10] arm/gic: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniHi,
Quoted 36 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/gic.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)xen/arch/arm/include/asm/gic.h +4
-4@@ -246,7 +246,7 @@ void gic_set_irq_type(struct irq_desc *desc, unsigned int type);/* Program the GIC to route an interrupt */ extern void gic_route_irq_to_xen (struct irq_desc *desc,unsigned int priority); -extern int gic_route_irq_to_guest (struct domain *,unsigned int virq, +extern int gic_route_irq_to_guest (struct domain *d,unsigned int virq,struct irq_desc *desc,unsigned int priority);@@ -330,11 +330,11 @@ struct gic_hw_operations {/* Initialize the GIC and the boot CPU */ int (*init)(void );/* Save GIC registers */ -void (*save_state)(struct vcpu *); +void (*save_state)(struct vcpu *v);/* Restore GIC registers */ -void (*restore_state)(const struct vcpu *); +void (*restore_state)(const struct vcpu *v);/* Dump GIC LR register information */ -void (*dump_state)(const struct vcpu *); +void (*dump_state)(const struct vcpu *v);/* hw_irq_controller to enable/disable/eoi host irq */ hw_irq_controller *gic_host_irq_type;
xen/arch/arm/include/asm/gic.h struct gic_hw_operations { · line 374
Quoted 8 lines
xen/arch/arm/include/asm/gic.h +2
-2@@ -369,9 +369,9 @@ struct gic_hw_operations {/* Clear LR register */ void (*clear_lr)(int lr);/* Read LR register and populate gic_lr structure */ -void (*read_lr)(int lr,struct gic_lr *); +void (*read_lr)(int lr,struct gic_lr *lr_reg);/* Write LR register from gic_lr structure */ -void (*write_lr)(int lr,const struct gic_lr *); +void (*write_lr)(int lr,const struct gic_lr *lr_reg);
Are the parameters name meant to match the declaration of the callbacks?
I am asking it because I see there are some inconsistencies between the declaration in GICv3 and GICv2. So this may want to be harmonized.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 01/10] arm/gic: address violations of MISRA C:2012 Rule 8.2
Quoted 49 lines · Julien Grall
Hi,
Quoted 34 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>---
xen/arch/arm/include/asm/gic.h| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)xen/arch/arm/include/asm/gic.h +4
-4@@ -246,7 +246,7 @@ void gic_set_irq_type(struct irq_desc *desc, unsigned int type); /* Program the GIC to route an interrupt */ extern void gic_route_irq_to_xen(struct irq_desc *desc, unsigned int priority); -extern int gic_route_irq_to_guest (struct domain *,unsigned int virq, +extern int gic_route_irq_to_guest (struct domain *d,unsigned int virq, struct irq_desc *desc, unsigned int priority);@@ -330,11 +330,11 @@ struct gic_hw_operations { /* Initialize the GIC and the boot CPU */ int (*init)(void); /* Save GIC registers */ - void (*save_state)(struct vcpu *); + void (*save_state)(struct vcpu *v); /* Restore GIC registers */ - void (*restore_state)(const struct vcpu *); + void (*restore_state)(const struct vcpu *v); /* Dump GIC LR register information */ - void (*dump_state)(const struct vcpu *); + void (*dump_state)(const struct vcpu *v); /* hw_irq_controller to enable/disable/eoi host irq */ hw_irq_controller *gic_host_irq_type;xen/arch/arm/include/asm/gic.h struct gic_hw_operations { · line 374
Quoted 8 lines
xen/arch/arm/include/asm/gic.h +2
-2@@ -369,9 +369,9 @@ struct gic_hw_operations { /* Clear LR register */ void (*clear_lr)(int lr); /* Read LR register and populate gic_lr structure */ - void (*read_lr)(int lr, struct gic_lr *); + void (*read_lr)(int lr, struct gic_lr *lr_reg); /* Write LR register from gic_lr structure */ - void (*write_lr)(int lr, const struct gic_lr *); + void (*write_lr)(int lr, const struct gic_lr *lr_reg);Are the parameters name meant to match the declaration of the callbacks?
I am asking it because I see there are some inconsistencies between the declaration in GICv3 and GICv2. So this may want to be harmonized.
Quoted 2 lines
Cheers,
I can propose another patch that also changes parameter names of gicv3_write_lr() as well as adding the missing ones in gic.h.
Signature · 3 lines
Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)
PATCH 2/10 arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter names, no functional change.
--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/include/asm/cpufeature.h +4 -4
@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num) struct arm_cpu_capabilities { const char *desc; u16 capability; - bool (*matches)(const struct arm_cpu_capabilities *); - int (*enable)(void *); /* Called on every active CPUs */ + bool (*matches)(const struct arm_cpu_capabilities *caps); + int (*enable)(void *ptr); /* Called on every active CPUs */ union { struct { /* To be used for eratum handling only */ u32 midr_model;
@@ -448,10 +448,10 @@ struct cpuinfo_arm {extern struct cpuinfo_arm system_cpuinfo; -extern void identify_cpu (struct cpuinfo_arm *); +extern void identify_cpu (struct cpuinfo_arm *c);#ifdef CONFIG_ARM_64 -extern void update_system_features (const struct cpuinfo_arm *); +extern void update_system_features (const struct cpuinfo_arm *new);#else static inline void update_system_features (const struct cpuinfo_arm *cpuinfo) {
Signature · 1 line
2.34.1
Re: [XEN PATCH 02/10] arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
Quoted 12 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/include/asm/cpufeature.h +0
-0
xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 130
Quoted 6 lines
xen/arch/arm/include/asm/cpufeature.h +1
-2@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num)struct arm_cpu_capabilities {const char *desc;u16 capability; -bool (*matches)(const struct arm_cpu_capabilities *); -int (*enable)(void *);/* Called on every active CPUs */ +bool (*matches)(const struct arm_cpu_capabilities *caps);
all the implementations of matches I found in xen/arch/arm/cpuerrata.c actually call the parameter "entry"
xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 131
Quoted 1 line
xen/arch/arm/include/asm/cpufeature.h +1
-0+int (*enable)(void *ptr);/* Called on every active CPUs */
this one instead is "data"
Quoted 19 lines
xen/arch/arm/include/asm/cpufeature.h +2
-2union { struct { /* To be used for eratum handling only */ u32 midr_model;@@ -448,10 +448,10 @@ struct cpuinfo_arm {extern struct cpuinfo_arm system_cpuinfo; -extern void identify_cpu (struct cpuinfo_arm *); +extern void identify_cpu (struct cpuinfo_arm *c);#ifdef CONFIG_ARM_64 -extern void update_system_features (const struct cpuinfo_arm *); +extern void update_system_features (const struct cpuinfo_arm *new);#else static inline void update_system_features (const struct cpuinfo_arm *cpuinfo) {Signature · 1 line
2.34.1
Re: [XEN PATCH 02/10] arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
Quoted 24 lines · Stefano Stabellini
Quoted 12 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/include/asm/cpufeature.h +0
-0xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 130
Quoted 6 lines
xen/arch/arm/include/asm/cpufeature.h +1
-2@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num)struct arm_cpu_capabilities {const char *desc;u16 capability; -bool (*matches)(const struct arm_cpu_capabilities *); -int (*enable)(void *);/* Called on every active CPUs */ +bool (*matches)(const struct arm_cpu_capabilities *caps);all the implementations of matches I found in
xen/arch/arm/cpuerrata.cactually call the parameter "entry"
Quoted 3 lines
xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 131
Quoted 1 line
xen/arch/arm/include/asm/cpufeature.h +1
-0+int (*enable)(void *ptr);/* Called on every active CPUs */ this one instead is "data"
I committed all the other patches in this series to the my for-4.19 branch
Re: [XEN PATCH 02/10] arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
Quoted 25 lines · Stefano Stabellini
Quoted 24 lines · Stefano Stabellini
Quoted 12 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/include/asm/cpufeature.h +0
-0xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 130
Quoted 6 lines
xen/arch/arm/include/asm/cpufeature.h +1
-2@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num)struct arm_cpu_capabilities {const char *desc;u16 capability; -bool (*matches)(const struct arm_cpu_capabilities *); -int (*enable)(void *);/* Called on every active CPUs */ +bool (*matches)(const struct arm_cpu_capabilities *caps);all the implementations of matches I found in
xen/arch/arm/cpuerrata.cactually call the parameter "entry"
Quoted 5 lines
Quoted 3 lines
xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 131
Quoted 1 line
xen/arch/arm/include/asm/cpufeature.h +1
-0+int (*enable)(void *ptr);/* Called on every active CPUs */ this one instead is "data"
I committed all the other patches in this series to the my for-4.19 branch
I have left some comments in patch #1. Given this is not the latest master, I think we should consider to remove/replace the patch rather than introducing a follow-up.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 02/10] arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
Quoted 29 lines · Julien Grall
Quoted 28 lines · Stefano Stabellini
Quoted 27 lines · Stefano Stabellini
Quoted 13 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/include/asm/cpufeature.h +0
-0xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 130
Quoted 6 lines
xen/arch/arm/include/asm/cpufeature.h +1
-2@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num)struct arm_cpu_capabilities {const char *desc;u16 capability; -bool (*matches)(const struct arm_cpu_capabilities *); -int (*enable)(void *);/* Called on every active CPUs */ +bool (*matches)(const struct arm_cpu_capabilities *caps);all the implementations of matches I found in
xen/arch/arm/cpuerrata.cactually call the parameter "entry"Quoted 1 line
xen/arch/arm/include/asm/cpufeature.h +1
-0+int (*enable)(void *ptr);/* Called on every active CPUs */
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
this one instead is "data"
I committed all the other patches in this series to the my for-4.19 branch
I have left some comments in patch #1. Given this is not the latest master, I think we should consider to remove/replace the patch rather than introducing a follow-up.
Makes sense. I took out patch #1 of this series and also took the opportunity to rebase 4.19 on the latest staging
Re: [XEN PATCH 02/10] arm/cpufeature: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniHi,
Quoted 12 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/include/asm/cpufeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/include/asm/cpufeature.h +0
-0
xen/arch/arm/include/asm/cpufeature.h static inline void cpus_set_cap(unsigned int num) · line 131
Quoted 7 lines
xen/arch/arm/include/asm/cpufeature.h +2
-2@@ -127,8 +127,8 @@ static inline void cpus_set_cap(unsigned int num)struct arm_cpu_capabilities {const char *desc;u16 capability; -bool (*matches)(const struct arm_cpu_capabilities *); -int (*enable)(void *);/* Called on every active CPUs */ +bool (*matches)(const struct arm_cpu_capabilities *caps); +int (*enable)(void *ptr);/* Called on every active CPUs */
How did you come up with the name? The void * seems to be named 'data' by the declaration and I think we should be consistent, otherwise this is defeating the spirit of MISRA (assuming this is not a violation).
Cheers,
Signature · 1 line
Julien Grall
PATCH 3/10 arm/smpboot: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter name, no functional change.
--- xen/arch/arm/arm64/smpboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/arm64/smpboot.c +1 -1
@@ -10,7 +10,7 @@#include <asm/acpi.h> struct smp_enable_ops { -int (*prepare_cpu)(int ); +int (*prepare_cpu)(int cpu); };static paddr_t cpu_release_addr[NR_CPUS ];
Signature · 1 line
2.34.1
Re: [XEN PATCH 03/10] arm/smpboot: address violations of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 4/10 arm/setup: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter names, no functional change.
--- xen/arch/arm/include/asm/setup.h | 5 +++-- xen/arch/arm/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
xen/arch/arm/include/asm/setup.h +3 -2
@@ -141,7 +141,8 @@ void alloc_static_evtchn(void);void discard_initial_modules (void );void fw_unreserved_regions (paddr_t s,paddr_t e, -void (*cb)(paddr_t ,paddr_t ),unsigned int first); +void (*cb)(paddr_t ps,paddr_t pe), +unsigned int first);size_t boot_fdt_info (const void *fdt,paddr_t paddr);const char *boot_fdt_cmdline (const void *fdt);
@@ -189,7 +190,7 @@ extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES ];/* Find where Xen will be residing at runtime and return a PT entry */ -lpae_t pte_of_xenaddr (vaddr_t ); +lpae_t pte_of_xenaddr (vaddr_t va);extern const char __ro_after_init_start[], __ro_after_init_end[];
xen/arch/arm/setup.c +2 -2
@@ -207,7 +207,7 @@ static void __init processor_id(void) }static void __init dt_unreserved_regions (paddr_t s,paddr_t e, -void (*cb)(paddr_t ,paddr_t ), +void (*cb)(paddr_t ps,paddr_t pe),unsigned int first) {unsigned int i, nr;
@@ -324,7 +324,7 @@ static bool __init bootmodules_overlap_check(struct bootmodules *bootmodules, }void __init fw_unreserved_regions (paddr_t s,paddr_t e, -void (*cb)(paddr_t ,paddr_t ), +void (*cb)(paddr_t ps,paddr_t pe),unsigned int first) {if ( acpi_disabled )
Signature · 1 line
2.34.1
Re: [XEN PATCH 04/10] arm/setup: address violations of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 5/10 arm/p2m: address a violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter name, no functional change.
--- xen/arch/arm/include/asm/p2m.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/p2m.h +1 -1
@@ -21,7 +21,7 @@ extern unsigned int p2m_root_level;struct domain ; -extern void memory_type_changed (struct domain *); +extern void memory_type_changed (struct domain *d);/* Per-p2m-table state */ struct p2m_domain {
Signature · 1 line
2.34.1
Re: [XEN PATCH 05/10] arm/p2m: address a violation of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 6/10 arm/cmpxchg: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter names, no functional change.
--- xen/arch/arm/include/asm/arm32/cmpxchg.h | 2 +- xen/arch/arm/include/asm/arm64/cmpxchg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/include/asm/arm32/cmpxchg.h +1 -1
@@ -3,7 +3,7 @@#include <xen/prefetch.h> -extern void __bad_xchg (volatile void *,int ); +extern void __bad_xchg (volatile void *ptr,int size);static inline unsigned long __xchg (unsigned long x,volatile void *ptr,int size) {
xen/arch/arm/include/asm/arm64/cmpxchg.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_ARM64_CMPXCHG_H#define __ASM_ARM64_CMPXCHG_H -extern void __bad_xchg (volatile void *,int ); +extern void __bad_xchg (volatile void *ptr,int size);static inline unsigned long __xchg (unsigned long x,volatile void *ptr,int size) {
Signature · 1 line
2.34.1
Re: [XEN PATCH 06/10] arm/cmpxchg: address violations of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 7/10 arm/traps: address a violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter name, no functional change.
--- xen/arch/arm/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
@@ -1236,7 +1236,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)if ( id == BUGFRAME_run_fn ) { -void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; +void (*fn)(const struct cpu_user_regs *regs) = (void *)regs->BUG_FN_REG;fn (regs);return 0 ;
Signature · 1 line
2.34.1
Re: [XEN PATCH 07/10] arm/traps: address a violation of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>
Re: [XEN PATCH 07/10] arm/traps: address a violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniHi,
Quoted 12 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/arm/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/traps.c +0
-0
xen/arch/arm/traps.c int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) · line 1239
Quoted 5 lines
xen/arch/arm/traps.c +1
-1@@ -1236,7 +1236,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc)if ( id == BUGFRAME_run_fn ) { -void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; +void (*fn)(const struct cpu_user_regs *regs) = (void *)regs->BUG_FN_REG;
Now the line will be over 80 characters. I think we should introduce a typedef. This would also help in the longer run to validate that the function passed to run_in_exception_handle() has the expected prototype.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 07/10] arm/traps: address a violation of MISRA C:2012 Rule 8.2
Hi Stefano,
Quoted 10 lines · Julien Grall
Hi,
Quoted 7 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>---
xen/arch/arm/traps.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
xen/arch/arm/traps.c int do_bug_frame(const struct cpu_user_regs · line 1241
Quoted 12 lines
xen/arch/arm/traps.c +1
-1@@ -1236,7 +1236,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) if ( id == BUGFRAME_run_fn ) { - void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; + void (*fn)(const struct cpu_user_regs *regs) = (void *)regs->BUG_FN_REG;Now the line will be over 80 characters. I think we should introduce a typedef. This would also help in the longer run to validate that the function passed to
run_in_exception_handle()has the expected prototype.
I see this patch was committed in your for-4.19 branch. But this comment was unaddressed. Can you drop the patch because your branch is committed in staging?
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 07/10] arm/traps: address a violation of MISRA C:2012 Rule 8.2
Quoted 30 lines · Julien Grall
Hi Stefano,
Quoted 10 lines · Julien Grall
Hi,
Quoted 7 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>---
xen/arch/arm/traps.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/arm/traps.c int do_bug_frame(const struct cpu_user_regs *regs, · line 1241
Quoted 12 lines
xen/arch/arm/traps.c +1
-1@@ -1236,7 +1236,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) if ( id == BUGFRAME_run_fn ) { - void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; + void (*fn)(const struct cpu_user_regs *regs) = (void *)regs->BUG_FN_REG;Now the line will be over 80 characters. I think we should introduce a typedef. This would also help in the longer run to validate that the function passed to
run_in_exception_handle()has the expected prototype.
Quoted 3 lines
I see this patch was committed in your for-4.19 branch. But this comment was unaddressed. Can you drop the patch because your branch is committed in staging?
I dropped the patch. Federico, please address Julien's feedback.
PATCH 8/10 arm/vgic-v3: address a violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter name, no functional change.
--- xen/arch/arm/vgic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/vgic-v3.c +1 -1
@@ -360,7 +360,7 @@ read_unknown:static uint64_t vgic_sanitise_field (uint64_t reg,uint64_t field_mask,int field_shift, -uint64_t (*sanitise_fn)(uint64_t )) +uint64_t (*sanitise_fn)(uint64_t field)) {uint64_t field = (reg & field_mask) >> field_shift;
Signature · 1 line
2.34.1
Re: [XEN PATCH 08/10] arm/vgic-v3: address a violation of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter name, no functional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 9/10 arm/domain: address violations of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter names, no funtional change.
--- xen/arch/arm/include/asm/domain.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/include/asm/domain.h +2 -2
@@ -243,8 +243,8 @@ struct arch_vcpu } __cacheline_aligned; -void vcpu_show_registers (const struct vcpu *); -void vcpu_switch_to_aarch64_mode (struct vcpu *); +void vcpu_show_registers (const struct vcpu *v); +void vcpu_switch_to_aarch64_mode (struct vcpu *v);/* * Due to the restriction of GICv3, the number of vCPUs in AFF0 is
Signature · 1 line
2.34.1
Re: [XEN PATCH 09/10] arm/domain: address violations of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter names, no funtional change.
Signed-off-by Federico Serafini <[email protected]>
PATCH 10/10 arm/smmu: address violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniAdd missing parameter names, no functional change.
--- xen/drivers/passthrough/arm/smmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/drivers/passthrough/arm/smmu.c +3 -3
@@ -277,8 +277,8 @@ static void iommu_group_put(struct iommu_group *group) }static void iommu_group_set_iommudata (struct iommu_group *group, -struct arm_smmu_master_cfg *cfg, -void (*releasefn)(void *)) +struct arm_smmu_master_cfg *cfg, +void (*releasefn)(void *data)) {/* TODO: Store the releasefn for the PCI */ ASSERT (releasefn ==NULL );
@@ -2082,7 +2082,7 @@ static int arm_smmu_add_device(struct device *dev)struct arm_smmu_device *smmu;struct arm_smmu_master_cfg *cfg;struct iommu_group *group; -void (*releasefn)(void *) =NULL ; +void (*releasefn)(void *data) =NULL ;int ret; smmu =find_smmu_for_device (dev);
Signature · 1 line
2.34.1
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 3 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
In reply to Federico SerafiniHi,
Quoted 5 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Hi Julien,
Quoted 5 lines · Julien Grall
Hi,
On 13/10/2023 16:24, Federico Serafini wrote:
Quoted 8 lines
Quoted 4 lines
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file. At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
@Rahul: do you agree ?
Cheers
Bertrand
Quoted 5 lines
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 10 lines
Quoted 10 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---
Quoted 5 lines
Quoted 3 lines
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
Quoted 1 line
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g. common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Hi Julien,
Quoted 19 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 10 lines
Quoted 10 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 2 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.
I am sure we will at some point for runtime code but we cannot do everything on the first shot. I was not meaning to do that now but that it is something to consider.
Cheers
Bertrand
Quoted 5 lines
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 25 lines · Bertrand Marquis
Quoted 19 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 10 lines
Quoted 10 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
Quoted 8 lines
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 2 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.I am sure we will at some point for runtime code but we cannot do everything on the first shot. I was not meaning to do that now but that it is something to consider.
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Of course the least we rely on exclude-lists.json the better.
For smmu.c, looking at the git history I think it is more actively worked on than other files such as lib/rbtree.c or common/bitmap.c. Given that backports from Linux to smmu.c are not straightforward anyway (please correct me if I am wrong) then I think we should not add smmu.c to exclude-lists.json and do MISRA for smmu.c.
On the other hand, if we think that doing MISRA for smmu.c is going to make backports a lot harder, and we think that we want to do backports "often" (every year or every couple of years) then maybe we shouldn't do MISRA for smmu.c after all.
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Hi Stefano,
Quoted 32 lines · Stefano Stabellini
Quoted 31 lines · Bertrand Marquis
Quoted 19 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 10 lines
Quoted 10 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 2 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.
Quoted 8 lines
Quoted 2 lines
I am sure we will at some point for runtime code but we cannot do everything on the first shot. I was not meaning to do that now but that it is something to consider.
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the cost to port a patch would increase a bit but this is one time cost every many years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So this would be a reason to initially exclude it from MISRA.
Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.
I haven't done any recently. But if they are already not straightforward, then adding MISRA on top is not really to make it better. So I think if you want to do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the idea to backport from Linux.
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
As a side note, the change here looks fairly self-contained. So I don't expect a major impact and therefore would not block this. This may not be the case for more complex one. Hence why I wanted to exclude it.
Do you expect larger MISRA changes in the SMMU driver?
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 73 lines · Julien Grall
Hi Stefano,
Quoted 49 lines · Stefano Stabellini
Quoted 39 lines · Bertrand Marquis
Quoted 26 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 17 lines
Quoted 17 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
Quoted 6 lines
Quoted 4 lines
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 3 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
Quoted 8 lines
Quoted 4 lines
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.I am sure we will at some point for runtime code but we cannot do everything on the first shot.
I was not meaning to do that now but that it is something to consider.Quoted 5 lines
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the cost to port a patch would increase a bit but this is one time cost every many years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So this would be a reason to initially exclude it from MISRA.
Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.
Quoted 7 lines
I haven't done any recently. But if they are already not straightforward, then adding MISRA on top is not really to make it better. So I think if you want to do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the idea to backport from Linux.
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
You have a good point. If we do MISRA for the SMMU then we might as well fully convert the file to Xen. As a clarification, we can still look at the fixes on the Linux driver and "port" security fixes and other key patches such as workarounds for broken specific SMMU versions, but for sure we wouldn't want to backport a new feature of the driver or code refactoring / code improvements of the driver. But that probably is already the case today?
Quoted 3 lines
As a side note, the change here looks fairly self-contained. So I don't expect a major impact and therefore would not block this. This may not be the case for more complex one. Hence why I wanted to exclude it.
Thanks!
Quoted 1 line
Do you expect larger MISRA changes in the SMMU driver?
I'll let Federico answer this one.
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 95 lines · Stefano Stabellini
Quoted 73 lines · Julien Grall
Hi Stefano,
Quoted 49 lines · Stefano Stabellini
Quoted 39 lines · Bertrand Marquis
Quoted 26 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 17 lines
Quoted 17 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
Quoted 6 lines
Quoted 4 lines
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 3 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
Quoted 8 lines
Quoted 4 lines
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.I am sure we will at some point for runtime code but we cannot do everything on the first shot.
I was not meaning to do that now but that it is something to consider.Quoted 5 lines
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the cost to port a patch would increase a bit but this is one time cost every many years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So this would be a reason to initially exclude it from MISRA.
Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.Quoted 7 lines
I haven't done any recently. But if they are already not straightforward, then adding MISRA on top is not really to make it better. So I think if you want to do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the idea to backport from Linux.
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
You have a good point. If we do MISRA for the SMMU then we might as well fully convert the file to Xen. As a clarification, we can still look at the fixes on the Linux driver and "port" security fixes and other key patches such as workarounds for broken specific SMMU versions, but for sure we wouldn't want to backport a new feature of the driver or code refactoring / code improvements of the driver. But that probably is already the case today?
Quoted 3 lines
As a side note, the change here looks fairly self-contained. So I don't expect a major impact and therefore would not block this. This may not be the case for more complex one. Hence why I wanted to exclude it.
Quoted 7 lines
Thanks!
Quoted 1 line
Do you expect larger MISRA changes in the SMMU driver?
I'll let Federico answer this one.
There are more than 500 violations of accepted rules involving the SMMU
files under xen/drivers/passthrough/arm/ and half of them come fromsmmu.c. Those are violations of the series 10 and the essential type system, so I'll definitely expect larger changes to SMMU driver. Furthermore, there is approximately the same amount of violations
involving MISRA rules which have yet to be discussed.
Signature · 3 lines
Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
In reply to Stefano StabelliniHi Stefano,
Quoted 82 lines · Stefano Stabellini
Quoted 73 lines · Julien Grall
Hi Stefano,
Quoted 49 lines · Stefano Stabellini
Quoted 39 lines · Bertrand Marquis
Quoted 26 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 17 lines
Quoted 17 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
Quoted 6 lines
Quoted 4 lines
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file.
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't tell about the SMMUv3.
True that i had the v3 code in mind, we might not want to do that for v1/2 you are right.
Quoted 3 lines
Quoted 3 lines
At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
Quoted 8 lines
Quoted 4 lines
I don't buy this argument right now. We have files in exclude-lists.json that I would consider critical for Xen to run (e.g.
common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move critical components of Xen out of the exclusion list.I am sure we will at some point for runtime code but we cannot do everything on the first shot.
I was not meaning to do that now but that it is something to consider.Quoted 5 lines
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the cost to port a patch would increase a bit but this is one time cost every many years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So this would be a reason to initially exclude it from MISRA.
Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.Quoted 7 lines
I haven't done any recently. But if they are already not straightforward, then adding MISRA on top is not really to make it better. So I think if you want to do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the idea to backport from Linux.
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
Quoted 7 lines
You have a good point. If we do MISRA for the SMMU then we might as well fully convert the file to Xen. As a clarification, we can still look at the fixes on the Linux driver and "port" security fixes and other key patches such as workarounds for broken specific SMMU versions, but for sure we wouldn't want to backport a new feature of the driver or code refactoring / code improvements of the driver. But that probably is already the case today?
Most likely yes, some features might be useful to backport. The main one I can think of is not sharing the stage-2 page-tables as there might be some issue to allow the CPU to access the GICv3 ITS doorbell (so it would have to be only mapped in the IOMMU page-tables).
The other one is stage-1 support.
Anyway, it is not clear whether we could use the same implementation as Linux.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Quoted 109 lines · Julien Grall
Hi Stefano,
Quoted 98 lines · Stefano Stabellini
Quoted 94 lines · Julien Grall
Hi Stefano,
Quoted 59 lines · Stefano Stabellini
Quoted 54 lines · Bertrand Marquis
Quoted 35 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 20 lines
Quoted 16 lines · Julien Grall
Hi,
Quoted 5 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by: Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file
for now.Quoted 4 lines
Looking at exclude-list.json, it doesn't seem to be present. I think
this patch should be replaced with adding a line in execlude-list.json.Quoted 6 lines
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to
turn it to Xen coding style in the future hence it is not listed in
the exclude file.Quoted 3 lines
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't
tell about the SMMUv3.True that i had the v3 code in mind, we might not want to do that for v1/2
you are right.Quoted 10 lines
Quoted 4 lines
At the end having a working smmu might be critical in a safety context
so it will make sense to also check this part of xen.I don't buy this argument right now. We have files in exclude-lists.json
that I would consider critical for Xen to run (e.g.common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move
critical components of Xen out of the exclusion list.Quoted 3 lines
I am sure we will at some point for runtime code but we cannot do everything on the first shot.
I was not meaning to do that now but that it is something to consider.Quoted 5 lines
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the
cost to port a patch would increase a bit but this is one time cost every many
years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So
this would be a reason to initially exclude it from MISRA.Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.I haven't done any recently. But if they are already not straightforward, then
adding MISRA on top is not really to make it better. So I think if you want to
do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the
idea to backport from Linux.Quoted 2 lines
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
Quoted 7 lines
You have a good point. If we do MISRA for the SMMU then we might as well fully convert the file to Xen. As a clarification, we can still look at the fixes on the Linux driver and "port" security fixes and other key patches such as workarounds for broken specific SMMU versions, but for sure we wouldn't want to backport a new feature of the driver or code refactoring / code improvements of the driver. But that probably is already the case today?
Quoted 8 lines
Most likely yes, some features might be useful to backport. The main one I can think of is not sharing the stage-2 page-tables as there might be some issue to allow the CPU to access the GICv3 ITS doorbell (so it would have to be only mapped in the IOMMU page-tables).
The other one is stage-1 support.
Anyway, it is not clear whether we could use the same implementation as Linux.
Yeah.
In terms of next steps, what do you suggest?
Are you OK with keeping smmu.c out of exclude-list? And to go forward with this patch?
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
Hi,
Quoted 117 lines · Stefano Stabellini
Quoted 116 lines · Julien Grall
Hi Stefano,
Quoted 98 lines · Stefano Stabellini
Quoted 94 lines · Julien Grall
Hi Stefano,
Quoted 59 lines · Stefano Stabellini
Quoted 54 lines · Bertrand Marquis
Quoted 35 lines · Julien Grall
Quoted 1 line · Bertrand Marquis
Hi Julien,
Hi Bertrand,
Quoted 20 lines
Quoted 16 lines · Julien Grall
Hi,
Quoted 5 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by: Federico Serafini <[email protected]>--- xen/drivers/passthrough/arm/smmu.c | 6 +++---This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file
for now.Quoted 4 lines
Looking at exclude-list.json, it doesn't seem to be present. I think
this patch should be replaced with adding a line in execlude-list.json.Quoted 6 lines
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to
turn it to Xen coding style in the future hence it is not listed in
the exclude file.Quoted 3 lines
AFAIK the SMMUv{1, 2} code didn't deviate very much from Linux. I can't
tell about the SMMUv3.True that i had the v3 code in mind, we might not want to do that for v1/2
you are right.Quoted 10 lines
Quoted 4 lines
At the end having a working smmu might be critical in a safety context
so it will make sense to also check this part of xen.I don't buy this argument right now. We have files in exclude-lists.json
that I would consider critical for Xen to run (e.g.common/bitmap.c, common/libfdt). So if you want to use this argument then we need to move
critical components of Xen out of the exclusion list.Quoted 3 lines
I am sure we will at some point for runtime code but we cannot do everything on the first shot.
I was not meaning to do that now but that it is something to consider.Quoted 5 lines
Things that are in exclude-lists.json are source files that come from other projects and also change very rarely. The argument that we don't do MISRA C on the files in exclude-lists.json, it is not because those files are unimportant, but because they change only once every many years.
Interesting. I would have thought this would be a condition to do MISRA as the
cost to port a patch would increase a bit but this is one time cost every many
years. Whereas code like the SMMU are still actively developped. And in particular for SMMUv2 we tried to stick close to Linux to help backport. So
this would be a reason to initially exclude it from MISRA.Quoted 8 lines
Of course the least we rely on exclude-lists.json the better.
For
smmu.c, looking at the git history I think it is more actively worked on than other files such aslib/rbtree.corcommon/bitmap.c. Given that backports from Linux tosmmu.care not straightforward anyway (please correct me if I am wrong) then I think we should not addsmmu.cto exclude-lists.json and do MISRA forsmmu.c.I haven't done any recently. But if they are already not straightforward, then
adding MISRA on top is not really to make it better. So I think if you want to
do MISRA for the SMMU, then we need to fully convert it to Xen and abandon the
idea to backport from Linux.Quoted 2 lines
This would also make the code looks nicer as at the moment this contains wrapper just to stay as close as possible to Linux.
Quoted 7 lines
You have a good point. If we do MISRA for the SMMU then we might as well fully convert the file to Xen. As a clarification, we can still look at the fixes on the Linux driver and "port" security fixes and other key patches such as workarounds for broken specific SMMU versions, but for sure we wouldn't want to backport a new feature of the driver or code refactoring / code improvements of the driver. But that probably is already the case today?
Most likely yes, some features might be useful to backport. The main one I can think of is not sharing the stage-2 page-tables as there might be some issue to allow the CPU to access the GICv3 ITS doorbell (so it would have to be only mapped in the IOMMU page-tables).
The other one is stage-1 support.
Quoted 8 lines
Quoted 1 line
Anyway, it is not clear whether we could use the same implementation as Linux.
Yeah.
In terms of next steps, what do you suggest?
Are you OK with keeping
smmu.cout of exclude-list? And to go forward with this patch?
Federico suggested that there are hundreds of violation. I feel like we should convert the SMMU driver to Xen coding style, clean-it up and then handle any MISRA violations.
I would still be ok to accept small MISRA fix first though.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH 10/10] arm/smmu: address violation of MISRA C:2012 Rule 8.2
In reply to Bertrand MarquisHi Bertrand
Quoted 14 lines · Bertrand Marquis
Hi Julien,
Quoted 10 lines · Julien Grall
Hi,
Quoted 4 lines · Federico Serafini
Add missing parameter names, no functional change.
Signed-off-by Federico Serafini <[email protected]>---
xen/drivers/passthrough/arm/smmu.c| 6 +++---
Quoted 8 lines
Quoted 3 lines
This file is using the Linux coding style because it is imported from Linux. I was under the impression we would exclude such file for now.
Looking at exclude-list.json, it doesn't seem to be present. I think this patch should be replaced with adding a line in execlude-list.json.
I think that during one of the discussions we said that this file already deviated quite a lot from the status in Linux and we wanted to turn it to Xen coding style in the future hence it is not listed in the exclude file. At the end having a working smmu might be critical in a safety context so it will make sense to also check this part of xen.
@Rahul: do you agree ?
Yes, you are right current SMMUv3 code already deviates quite a lot from the status of Linux because Xen handles the command queue in a different way than the way Linux handles it. More detailed can be found at the start of the SMMUv3 file. I am pasting it here also.
* 5. Latest version of the Linux SMMUv3 code implements the commands queue
* access functions based on atomic operations implemented in Linux.
* Atomic functions used by the commands queue access functions are not
* implemented in XEN therefore we decided to port the earlier version
* of the code. Atomic operations are introduced to fix the bottleneck of
* the SMMU command queue insertion operation. A new algorithm for
* inserting commands into the queue is introduced, which is
* lock-free on the fast-path.
* Consequence of reverting the patch is that the command queue insertion
* will be slow for large systems as spinlock will be used to serializes
* accesses from all CPUs to the single queue supported by the hardware.
* Once the proper atomic operations will be available in XEN the driver
* can be updated.
Anyway because of above reason backporting SMMUv3 Linux driver patches to Xen are not straight forward. If making smmu-v3.c to Xen coding style helps in safety context I am okay with that.
Regards,
Rahul