Skip to contentSkip to conversation

xen/arm: fixed violations of MISRA C:2012 R8.3 on parameter names.

PATCH Superseded Federico Serafini 3 participants 5 messages Jun 22, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: fixed violations of MISRA C:2012 R8.3 on parameter names.

To comply with Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers") change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions.

---
 xen/arch/arm/include/asm/event.h        | 2 +-
 xen/arch/arm/include/asm/fixmap.h       | 2 +-
 xen/arch/arm/include/asm/gic.h          | 2 +-
 xen/arch/arm/include/asm/gic_v3_its.h   | 5 +++--
 xen/arch/arm/include/asm/grant_table.h  | 6 +++---
 xen/arch/arm/include/asm/guest_access.h | 4 ++--
 xen/arch/arm/include/asm/irq.h          | 2 +-
 xen/arch/arm/include/asm/mm.h           | 2 +-
 xen/arch/arm/include/asm/regs.h         | 2 +-
 xen/arch/arm/include/asm/vgic.h         | 4 ++--
 10 files changed, 16 insertions(+), 15 deletions(-)
xen/arch/arm/include/asm/event.h +1 -1
index b14c166ad6..fa54ef8869 100644
@@ -3,7 +3,7 @@
 
 #include <asm/domain.h>
 
-void vcpu_kick(struct vcpu *v);
+void vcpu_kick(struct vcpu *vcpu);
 void vcpu_mark_events_pending(struct vcpu *v);
 void vcpu_update_evtchn_irq(struct vcpu *v);
 void vcpu_block_unless_event_pending(struct vcpu *v);
xen/arch/arm/include/asm/fixmap.h +1 -1
index d0c9a52c8c..734eb9b1d4 100644
@@ -30,7 +30,7 @@
 extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES];
 
 /* Map a page in a fixmap entry */
-extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int attributes);
+extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
 /* Remove a mapping from a fixmap entry */
 extern void clear_fixmap(unsigned int map);
 
xen/arch/arm/include/asm/gic.h +1 -1
index 76e3fa5dc4..f1ef347edc 100644
@@ -257,7 +257,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
 extern void gic_clear_pending_irqs(struct vcpu *v);
 
 extern void init_maintenance_interrupt(void);
-extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
+extern void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq,
         unsigned int priority);
 extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq);
 
xen/arch/arm/include/asm/gic_v3_its.h +3 -2
index fae3f6ecef..c24d4752d0 100644
@@ -190,8 +190,9 @@ struct pending_irq *gicv3_its_get_event_pending_irq(struct domain *d,
                                                     uint32_t eventid);
 int gicv3_remove_guest_event(struct domain *d, paddr_t vdoorbell_address,
                                      uint32_t vdevid, uint32_t eventid);
-struct pending_irq *gicv3_assign_guest_event(struct domain *d, paddr_t doorbell,
-                                             uint32_t devid, uint32_t eventid,
+struct pending_irq *gicv3_assign_guest_event(struct domain *d,
+                                             paddr_t vdoorbell_address,
+                                             uint32_t vdevid, uint32_t eventid,
                                              uint32_t virt_lpi);
 void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                  uint32_t virt_lpi);
xen/arch/arm/include/asm/grant_table.h +3 -3
index e13dfeefa5..bd4eea2317 100644
@@ -36,10 +36,10 @@ static inline bool gnttab_release_host_mappings(const struct domain *d)
     return true;
 }
 
-int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
+int create_grant_host_mapping(unsigned long addr, mfn_t frame,
                               unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
-                               unsigned long new_gpaddr, unsigned int flags);
+int replace_grant_host_mapping(unsigned long addr, mfn_t mfn,
+                               unsigned long new_addr, unsigned int flags);
 
 /*
  * The region used by Xen on the memory will never be mapped in DOM0
xen/arch/arm/include/asm/guest_access.h +2 -2
index 4421e43611..c37cf7d871 100644
@@ -12,11 +12,11 @@ unsigned long raw_clear_guest(void *to, unsigned int len);
 
 /* Copy data to guest physical address, then clean the region. */
 unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
-                                              paddr_t phys,
+                                              paddr_t gpa,
                                               void *buf,
                                               unsigned int len);
 
-int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
                                uint32_t size, bool is_write);
 
 #define __raw_copy_to_guest raw_copy_to_guest
xen/arch/arm/include/asm/irq.h +1 -1
index 11bc85d111..105b33b37d 100644
@@ -76,7 +76,7 @@ void init_IRQ(void);
 
 int route_irq_to_guest(struct domain *d, unsigned int virq,
                        unsigned int irq, const char *devname);
-int release_guest_irq(struct domain *d, unsigned int irq);
+int release_guest_irq(struct domain *d, unsigned int virq);
 
 void arch_move_irqs(struct vcpu *v);
 
xen/arch/arm/include/asm/mm.h +1 -1
index 4262165ce2..d78f7a183a 100644
@@ -225,7 +225,7 @@ extern void setup_directmap_mappings(unsigned long base_mfn, unsigned long nr_mf
 /* Map a frame table to cover physical addresses ps through pe */
 extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
 /* map a physical range in virtual memory */
-void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int attributes);
+void __iomem *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes);
 
 static inline void __iomem *ioremap_nocache(paddr_t start, size_t len)
 {
xen/arch/arm/include/asm/regs.h +1 -1
index 0693a68131..ef34b38aa1 100644
@@ -58,7 +58,7 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
 }
 
 register_t get_user_reg(struct cpu_user_regs *regs, int reg);
-void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
+void set_user_reg(struct cpu_user_regs *regs, int reg, register_t value);
 
 #endif
 
xen/arch/arm/include/asm/vgic.h +2 -2
index 328fd46d1b..aa9f49409e 100644
@@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v);
 int domain_vgic_register(struct domain *d, int *mmio_count);
 int domain_vgic_init(struct domain *d, unsigned int nr_spis);
 void domain_vgic_free(struct domain *d);
-int vcpu_vgic_init(struct vcpu *vcpu);
-int vcpu_vgic_free(struct vcpu *vcpu);
+int vcpu_vgic_init(struct vcpu *v);
+int vcpu_vgic_free(struct vcpu *v);
 
 void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
                      bool level);
Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 23 lines · Federico Serafini

To comply with Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers") change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions. >

---
  xen/arch/arm/include/asm/event.h        | 2 +-
  xen/arch/arm/include/asm/fixmap.h       | 2 +-
  xen/arch/arm/include/asm/gic.h          | 2 +-
  xen/arch/arm/include/asm/gic_v3_its.h   | 5 +++--
  xen/arch/arm/include/asm/grant_table.h  | 6 +++---
  xen/arch/arm/include/asm/guest_access.h | 4 ++--
  xen/arch/arm/include/asm/irq.h          | 2 +-
  xen/arch/arm/include/asm/mm.h           | 2 +-
  xen/arch/arm/include/asm/regs.h         | 2 +-
  xen/arch/arm/include/asm/vgic.h         | 4 ++--
  10 files changed, 16 insertions(+), 15 deletions(-)
xen/arch/arm/include/asm/event.h +0 -0
index b14c166ad6..fa54ef8869 100644

xen/arch/arm/include/asm/event.h line 6

Quoted 5 lines
xen/arch/arm/include/asm/event.h +1 -1
@@ -3,7 +3,7 @@
 
  #include <asm/domain.h>
 
-void vcpu_kick(struct vcpu *v);
+void vcpu_kick(struct vcpu *vcpu);

With this change we know have inconsistency in the arguments naming within the header. It is more common to denote a vCPU with 'v' so I would rather prefer if we modify the function definition in a patch before.

Quoted 50 lines
xen/arch/arm/include/asm/event.h +0 -0
  void vcpu_mark_events_pending(struct vcpu *v);
  void vcpu_update_evtchn_irq(struct vcpu *v);
  void vcpu_block_unless_event_pending(struct vcpu *v);
xen/arch/arm/include/asm/fixmap.h +1 -1
index d0c9a52c8c..734eb9b1d4 100644
@@ -30,7 +30,7 @@
  extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES];
 
  /* Map a page in a fixmap entry */
-extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int attributes);
+extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
  /* Remove a mapping from a fixmap entry */
  extern void clear_fixmap(unsigned int map);
 
xen/arch/arm/include/asm/gic.h +1 -1
index 76e3fa5dc4..f1ef347edc 100644
@@ -257,7 +257,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
  extern void gic_clear_pending_irqs(struct vcpu *v);
 
  extern void init_maintenance_interrupt(void);
-extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
+extern void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq,
          unsigned int priority);
  extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq);
 
xen/arch/arm/include/asm/gic_v3_its.h +3 -2
index fae3f6ecef..c24d4752d0 100644
@@ -190,8 +190,9 @@ struct pending_irq *gicv3_its_get_event_pending_irq(struct domain *d,
                                                      uint32_t eventid);
  int gicv3_remove_guest_event(struct domain *d, paddr_t vdoorbell_address,
                                       uint32_t vdevid, uint32_t eventid);
-struct pending_irq *gicv3_assign_guest_event(struct domain *d, paddr_t doorbell,
-                                             uint32_t devid, uint32_t eventid,
+struct pending_irq *gicv3_assign_guest_event(struct domain *d,
+                                             paddr_t vdoorbell_address,
+                                             uint32_t vdevid, uint32_t eventid,
                                               uint32_t virt_lpi);
  void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                   uint32_t virt_lpi);
xen/arch/arm/include/asm/grant_table.h +0 -0
index e13dfeefa5..bd4eea2317 100644

xen/arch/arm/include/asm/grant_table.h static inline bool gnttab_release_host_mappings(const struct domain *d) · line 42

Quoted 10 lines
xen/arch/arm/include/asm/grant_table.h +3 -3
@@ -36,10 +36,10 @@ static inline bool gnttab_release_host_mappings(const struct domain *d)
      return true;
  }
 
-int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
+int create_grant_host_mapping(unsigned long addr, mfn_t frame,
                                unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
-                               unsigned long new_gpaddr, unsigned int flags);
+int replace_grant_host_mapping(unsigned long addr, mfn_t mfn,
+                               unsigned long new_addr, unsigned int flags);

I know you are focusing to use the same parameter names as the definitions. However, with the new name it is not clear anymore what type of address is expected.

From my understanding, the interface is expecting a guest physical address. So I think we should stick with 'gpaddr'.

Also, I think there is another problem with this interface because a guest (and even host) address can be bigger than an 'unsigned long' on arm32. Anyway, this is something that could be dealt outside of this series.

Quoted 9 lines
xen/arch/arm/include/asm/grant_table.h +0 -0
  /*
   * The region used by Xen on the memory will never be mapped in DOM0
xen/arch/arm/include/asm/guest_access.h +0 -0
index 4421e43611..c37cf7d871 100644
@@ -12,11 +12,11 @@ unsigned long raw_clear_guest(void *to, unsigned int len);
 

xen/arch/arm/include/asm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned int len); · line 20

Quoted 10 lines
xen/arch/arm/include/asm/guest_access.h +2 -2
  /* Copy data to guest physical address, then clean the region. */
  unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
-                                              paddr_t phys,
+                                              paddr_t gpa,
                                                void *buf,
                                                unsigned int len);
 
-int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
                                 uint32_t size, bool is_write);

The function namem suggests there would be a parameter called 'ipa'. But you are renaming it to 'gpa'. In this case, we should either renaming the parameter in the definition or the function name.

I am slightly leaning towards the latter because we don't tend to use 'ipa' very much in Xen (even though this is the Arm official terminology).

Quoted 20 lines
xen/arch/arm/include/asm/guest_access.h +0 -0
  #define __raw_copy_to_guest raw_copy_to_guest
xen/arch/arm/include/asm/irq.h +1 -1
index 11bc85d111..105b33b37d 100644
@@ -76,7 +76,7 @@ void init_IRQ(void);
 
  int route_irq_to_guest(struct domain *d, unsigned int virq,
                         unsigned int irq, const char *devname);
-int release_guest_irq(struct domain *d, unsigned int irq);
+int release_guest_irq(struct domain *d, unsigned int virq);
 
  void arch_move_irqs(struct vcpu *v);
 
xen/arch/arm/include/asm/mm.h +0 -0
index 4262165ce2..d78f7a183a 100644

xen/arch/arm/include/asm/mm.h extern void setup_directmap_mappings(unsigned long base_mfn, unsigned long nr_mf · line 228

Quoted 5 lines
xen/arch/arm/include/asm/mm.h +1 -1
@@ -225,7 +225,7 @@ extern void setup_directmap_mappings(unsigned long base_mfn, unsigned long nr_mf
  /* Map a frame table to cover physical addresses ps through pe */
  extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
  /* map a physical range in virtual memory */
-void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int attributes);
+void __iomem *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes)

All the ioremap_* prototypes were consistent before this change. I have a slight preference if we stick we 'start' and therefore rename the parameter in the definition. But I would be ok with 'pa' so long all the other ioremap_* prototypes are updated accordingly.

Quoted 21 lines
xen/arch/arm/include/asm/mm.h +0 -0
  static inline void __iomem *ioremap_nocache(paddr_t start, size_t len)
  {
xen/arch/arm/include/asm/regs.h +1 -1
index 0693a68131..ef34b38aa1 100644
@@ -58,7 +58,7 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
  }
 
  register_t get_user_reg(struct cpu_user_regs *regs, int reg);
-void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
+void set_user_reg(struct cpu_user_regs *regs, int reg, register_t value);
 
  #endif
 
xen/arch/arm/include/asm/vgic.h +0 -0
index 328fd46d1b..aa9f49409e 100644

xen/arch/arm/include/asm/vgic.h bool vgic_evtchn_irq_pending(struct vcpu *v); · line 362

Quoted 10 lines
xen/arch/arm/include/asm/vgic.h +2 -2
@@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v);
  int domain_vgic_register(struct domain *d, int *mmio_count);
  int domain_vgic_init(struct domain *d, unsigned int nr_spis);
  void domain_vgic_free(struct domain *d);
-int vcpu_vgic_init(struct vcpu *vcpu);
-int vcpu_vgic_free(struct vcpu *vcpu);
+int vcpu_vgic_init(struct vcpu *v);
+int vcpu_vgic_free(struct vcpu *v);
 
  void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
                       bool level);

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw

Hi Federico,

On top of Julien remarks, only one more from my side.

Quoted 182 lines · Julien Grall

Hi,

Quoted 23 lines · Federico Serafini

To comply with Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers") change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions. >

---
  xen/arch/arm/include/asm/event.h        | 2 +-
  xen/arch/arm/include/asm/fixmap.h       | 2 +-
  xen/arch/arm/include/asm/gic.h          | 2 +-
  xen/arch/arm/include/asm/gic_v3_its.h   | 5 +++--
  xen/arch/arm/include/asm/grant_table.h  | 6 +++---
  xen/arch/arm/include/asm/guest_access.h | 4 ++--
  xen/arch/arm/include/asm/irq.h          | 2 +-
  xen/arch/arm/include/asm/mm.h           | 2 +-
  xen/arch/arm/include/asm/regs.h         | 2 +-
  xen/arch/arm/include/asm/vgic.h         | 4 ++--
  10 files changed, 16 insertions(+), 15 deletions(-)
xen/arch/arm/include/asm/event.h +0 -0
index b14c166ad6..fa54ef8869 100644

xen/arch/arm/include/asm/event.h line 6

Quoted 5 lines
xen/arch/arm/include/asm/event.h +1 -1
@@ -3,7 +3,7 @@
 
  #include <asm/domain.h>
 
-void vcpu_kick(struct vcpu *v);
+void vcpu_kick(struct vcpu *vcpu);

With this change we know have inconsistency in the arguments naming within the header. It is more common to denote a vCPU with 'v' so I would rather prefer if we modify the function definition in a patch before.

Quoted 50 lines
xen/arch/arm/include/asm/event.h +0 -0
  void vcpu_mark_events_pending(struct vcpu *v);
  void vcpu_update_evtchn_irq(struct vcpu *v);
  void vcpu_block_unless_event_pending(struct vcpu *v);
xen/arch/arm/include/asm/fixmap.h +1 -1
index d0c9a52c8c..734eb9b1d4 100644
@@ -30,7 +30,7 @@
  extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES];
 
  /* Map a page in a fixmap entry */
-extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int attributes);
+extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
  /* Remove a mapping from a fixmap entry */
  extern void clear_fixmap(unsigned int map);
 
xen/arch/arm/include/asm/gic.h +1 -1
index 76e3fa5dc4..f1ef347edc 100644
@@ -257,7 +257,7 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
  extern void gic_clear_pending_irqs(struct vcpu *v);
 
  extern void init_maintenance_interrupt(void);
-extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
+extern void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq,
          unsigned int priority);
  extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq);
 
xen/arch/arm/include/asm/gic_v3_its.h +3 -2
index fae3f6ecef..c24d4752d0 100644
@@ -190,8 +190,9 @@ struct pending_irq *gicv3_its_get_event_pending_irq(struct domain *d,
                                                      uint32_t eventid);
  int gicv3_remove_guest_event(struct domain *d, paddr_t vdoorbell_address,
                                       uint32_t vdevid, uint32_t eventid);
-struct pending_irq *gicv3_assign_guest_event(struct domain *d, paddr_t doorbell,
-                                             uint32_t devid, uint32_t eventid,
+struct pending_irq *gicv3_assign_guest_event(struct domain *d,
+                                             paddr_t vdoorbell_address,
+                                             uint32_t vdevid, uint32_t eventid,
                                               uint32_t virt_lpi);
  void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                   uint32_t virt_lpi);
xen/arch/arm/include/asm/grant_table.h +0 -0
index e13dfeefa5..bd4eea2317 100644

xen/arch/arm/include/asm/grant_table.h static inline bool gnttab_release_host_mappings(const struct domain *d) · line 42

Quoted 10 lines
xen/arch/arm/include/asm/grant_table.h +3 -3
@@ -36,10 +36,10 @@ static inline bool gnttab_release_host_mappings(const struct domain *d)
      return true;
  }
 
-int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
+int create_grant_host_mapping(unsigned long addr, mfn_t frame,
                                unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
-                               unsigned long new_gpaddr, unsigned int flags);
+int replace_grant_host_mapping(unsigned long addr, mfn_t mfn,
+                               unsigned long new_addr, unsigned int flags);

I know you are focusing to use the same parameter names as the definitions. However, with the new name it is not clear anymore what type of address is expected.

From my understanding, the interface is expecting a guest physical
address. So I think we should stick with 'gpaddr'.

Also, I think there is another problem with this interface because a guest (and even host) address can be bigger than an 'unsigned long' on arm32. Anyway, this is something that could be dealt outside of this series.

Quoted 9 lines
xen/arch/arm/include/asm/grant_table.h +0 -0
  /*
   * The region used by Xen on the memory will never be mapped in DOM0
xen/arch/arm/include/asm/guest_access.h +0 -0
index 4421e43611..c37cf7d871 100644
@@ -12,11 +12,11 @@ unsigned long raw_clear_guest(void *to, unsigned int len);
 

xen/arch/arm/include/asm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned int len); · line 20

Quoted 10 lines
xen/arch/arm/include/asm/guest_access.h +2 -2
  /* Copy data to guest physical address, then clean the region. */
  unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
-                                              paddr_t phys,
+                                              paddr_t gpa,
                                                void *buf,
                                                unsigned int len);
 
-int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
                                 uint32_t size, bool is_write);

The function namem suggests there would be a parameter called 'ipa'. But you are renaming it to 'gpa'. In this case, we should either renaming the parameter in the definition or the function name.

I am slightly leaning towards the latter because we don't tend to use 'ipa' very much in Xen (even though this is the Arm official terminology).

Quoted 20 lines
xen/arch/arm/include/asm/guest_access.h +0 -0
  #define __raw_copy_to_guest raw_copy_to_guest
xen/arch/arm/include/asm/irq.h +1 -1
index 11bc85d111..105b33b37d 100644
@@ -76,7 +76,7 @@ void init_IRQ(void);
 
  int route_irq_to_guest(struct domain *d, unsigned int virq,
                         unsigned int irq, const char *devname);
-int release_guest_irq(struct domain *d, unsigned int irq);
+int release_guest_irq(struct domain *d, unsigned int virq);
 
  void arch_move_irqs(struct vcpu *v);
 
xen/arch/arm/include/asm/mm.h +0 -0
index 4262165ce2..d78f7a183a 100644

xen/arch/arm/include/asm/mm.h extern void setup_directmap_mappings(unsigned long base_mfn, unsigned long nr_mf · line 228

Quoted 5 lines
xen/arch/arm/include/asm/mm.h +1 -1
@@ -225,7 +225,7 @@ extern void setup_directmap_mappings(unsigned long base_mfn, unsigned long nr_mf
  /* Map a frame table to cover physical addresses ps through pe */
  extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
  /* map a physical range in virtual memory */
-void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int attributes);
+void __iomem *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes)

All the ioremap_* prototypes were consistent before this change. I have a slight preference if we stick we 'start' and therefore rename the parameter in the definition. But I would be ok with 'pa' so long all the other ioremap_* prototypes are updated accordingly.

Quoted 16 lines
xen/arch/arm/include/asm/mm.h +0 -0
  static inline void __iomem *ioremap_nocache(paddr_t start, size_t len)
  {
xen/arch/arm/include/asm/regs.h +1 -1
index 0693a68131..ef34b38aa1 100644
@@ -58,7 +58,7 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
  }
 
  register_t get_user_reg(struct cpu_user_regs *regs, int reg);
-void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
+void set_user_reg(struct cpu_user_regs *regs, int reg, register_t value);
 
  #endif
 
Quoted 12 lines

xen/arch/arm/include/asm/vgic.h bool vgic_evtchn_irq_pending(struct vcpu *v); · line 359

Quoted 12 lines
xen/arch/arm/include/asm/vgic.h +2 -2
index 328fd46d1b..aa9f49409e 100644
@@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v);
  int domain_vgic_register(struct domain *d, int *mmio_count);
  int domain_vgic_init(struct domain *d, unsigned int nr_spis);
  void domain_vgic_free(struct domain *d);
-int vcpu_vgic_init(struct vcpu *vcpu);
-int vcpu_vgic_free(struct vcpu *vcpu);
+int vcpu_vgic_init(struct vcpu *v);
+int vcpu_vgic_free(struct vcpu *v);

I know that new VGIC (files under arch/arm/vgic/) is not covered by the MISRA work, but functions there reuse the same prototypes. So by changing the parameter names here, we should also change the names in the following definitions for consistency:
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/vgic/vgic-init.c;h=ea739d081e7879b44c4b05c862ad32c301105732;hb=HEAD#l201
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/vgic/vgic-init.c;h=ea739d081e7879b44c4b05c862ad32c301105732;hb=HEAD#l242

I can do this by myself although it would be simpler to have all in one patch.

~Michal

#3 lore raw
Quoted 18 lines · Michal Orzel
Quoted 4 lines
Quoted 4 lines
xen/arch/arm/include/asm/vgic.h +0 -0
index 328fd46d1b..aa9f49409e 100644
Quoted 8 lines

xen/arch/arm/include/asm/vgic.h bool vgic_evtchn_irq_pending(struct vcpu *v); · line 359

Quoted 8 lines
xen/arch/arm/include/asm/vgic.h +2 -2
@@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v);
   int domain_vgic_register(struct domain *d, int *mmio_count);
   int domain_vgic_init(struct domain *d, unsigned int nr_spis);
   void domain_vgic_free(struct domain *d);
-int vcpu_vgic_init(struct vcpu *vcpu);
-int vcpu_vgic_free(struct vcpu *vcpu);
+int vcpu_vgic_init(struct vcpu *v);
+int vcpu_vgic_free(struct vcpu *v);

I know that new VGIC (files under arch/arm/vgic/) is not covered by the MISRA work, but functions there reuse the same prototypes. So by changing the parameter names here, we should also change the names in the following definitions for consistency:
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/vgic/vgic-init.c;h=ea739d081e7879b44c4b05c862ad32c301105732;hb=HEAD#l201
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/vgic/vgic-init.c;h=ea739d081e7879b44c4b05c862ad32c301105732;hb=HEAD#l242

Quoted 3 lines

I can do this by myself although it would be simpler to have all in one patch.

~Michal

Hello Michal,

I can do it.

Regards

Signature · 3 lines
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)
#4 lore raw
In reply to Julien Grall
Quoted 202 lines · Julien Grall

Hi,

Quoted 23 lines · Federico Serafini

To comply with Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers") change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions. >

---
  xen/arch/arm/include/asm/event.h        | 2 +- xen/arch/arm/include/asm/fixmap.h       | 2 +- xen/arch/arm/include/asm/gic.h          | 2 +- xen/arch/arm/include/asm/gic_v3_its.h   | 5 +++-- xen/arch/arm/include/asm/grant_table.h  | 6 +++--- xen/arch/arm/include/asm/guest_access.h | 4 ++-- xen/arch/arm/include/asm/irq.h          | 2 +- xen/arch/arm/include/asm/mm.h           | 2 +- xen/arch/arm/include/asm/regs.h         | 2 +- xen/arch/arm/include/asm/vgic.h         | 4 ++--

  10 files changed, 16 insertions(+), 15 deletions(-)
xen/arch/arm/include/asm/event.h +0 -0
index b14c166ad6..fa54ef8869 100644

xen/arch/arm/include/asm/event.h line 4

Quoted 3 lines
xen/arch/arm/include/asm/event.h +1 -1
@@ -3,7 +3,7 @@
   #include <asm/domain.h>
-void vcpu_kick(struct vcpu *v);
+void vcpu_kick(struct vcpu *vcpu);

With this change we know have inconsistency in the arguments naming within the header. It is more common to denote a vCPU with 'v' so I would rather prefer if we modify the function definition in a patch before.

Quoted 1 line
xen/arch/arm/include/asm/event.h +0 -0
   void vcpu_mark_events_pending(struct vcpu *v);> Hi,
Quoted 80 lines · Federico Serafini

To comply with Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers") change the parameter names of function declarations to be consistent with the names used in the corresponding function definitions. >

---
  xen/arch/arm/include/asm/event.h        | 2 +-
  xen/arch/arm/include/asm/fixmap.h       | 2 +-
  xen/arch/arm/include/asm/gic.h          | 2 +-
  xen/arch/arm/include/asm/gic_v3_its.h   | 5 +++--
  xen/arch/arm/include/asm/grant_table.h  | 6 +++---
  xen/arch/arm/include/asm/guest_access.h | 4 ++--
  xen/arch/arm/include/asm/irq.h          | 2 +-
  xen/arch/arm/include/asm/mm.h           | 2 +-
  xen/arch/arm/include/asm/regs.h         | 2 +-
  xen/arch/arm/include/asm/vgic.h         | 4 ++--
  10 files changed, 16 insertions(+), 15 deletions(-)
xen/arch/arm/include/asm/event.h +1 -1
index b14c166ad6..fa54ef8869 100644
@@ -3,7 +3,7 @@
  #include <asm/domain.h>
-void vcpu_kick(struct vcpu *v);
+void vcpu_kick(struct vcpu *vcpu)
   void vcpu_update_evtchn_irq(struct vcpu *v);
   void vcpu_block_unless_event_pending(struct vcpu *v);
xen/arch/arm/include/asm/fixmap.h +1 -1
index d0c9a52c8c..734eb9b1d4 100644
@@ -30,7 +30,7 @@
   extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES];
   /* Map a page in a fixmap entry */
-extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int 
 attributes);
+extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
   /* Remove a mapping from a fixmap entry */
   extern void clear_fixmap(unsigned int map);
xen/arch/arm/include/asm/gic.h +1 -1
index 76e3fa5dc4..f1ef347edc 100644
@@ -257,7 +257,7 @@ int gic_remove_irq_from_guest(struct domain *d, 
 unsigned int virq,
   extern void gic_clear_pending_irqs(struct vcpu *v);
   extern void init_maintenance_interrupt(void);
-extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
+extern void gic_raise_guest_irq(struct vcpu *v, unsigned int 
 virtual_irq,
           unsigned int priority);
   extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq);
xen/arch/arm/include/asm/gic_v3_its.h +3 -2
index fae3f6ecef..c24d4752d0 100644
@@ -190,8 +190,9 @@ struct pending_irq 
 *gicv3_its_get_event_pending_irq(struct domain *d,
                                                       uint32_t eventid);
   int gicv3_remove_guest_event(struct domain *d, paddr_t vdoorbell_address,
                                        uint32_t vdevid, uint32_t eventid);
-struct pending_irq *gicv3_assign_guest_event(struct domain *d, 
 paddr_t doorbell,
-                                             uint32_t devid, uint32_t 
 eventid,
+struct pending_irq *gicv3_assign_guest_event(struct domain *d,
+                                             paddr_t vdoorbell_address,
+                                             uint32_t vdevid, 

uint32_t eventid,
                                               uint32_t virt_lpi); void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id, uint32_t virt_lpi);

xen/arch/arm/include/asm/grant_table.h +0 -0
index e13dfeefa5..bd4eea2317 100644
@@ -36,10 +36,10 @@ static inline bool 
 gnttab_release_host_mappings(const struct domain *d)
       return true;

xen/arch/arm/include/asm/grant_table.h static inline bool · line 44

Quoted 10 lines
xen/arch/arm/include/asm/grant_table.h +3 -3
   }
-int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
+int create_grant_host_mapping(unsigned long addr, mfn_t frame,
                                 unsigned int flags, unsigned int cache_flags);
-int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
-                               unsigned long new_gpaddr, unsigned int 
 flags);
+int replace_grant_host_mapping(unsigned long addr, mfn_t mfn,
+                               unsigned long new_addr, unsigned int 
 flags);

I know you are focusing to use the same parameter names as the definitions. However, with the new name it is not clear anymore what type of address is expected.

From my understanding, the interface is expecting a guest physical
address. So I think we should stick with 'gpaddr'.

Also, I think there is another problem with this interface because a guest (and even host) address can be bigger than an 'unsigned long' on arm32. Anyway, this is something that could be dealt outside of this series.

Quoted 7 lines
xen/arch/arm/include/asm/grant_table.h +0 -0
   /*

   * The region used by Xen on the memory will never be mapped in DOM0

xen/arch/arm/include/asm/guest_access.h +0 -0
index 4421e43611..c37cf7d871 100644

xen/arch/arm/include/asm/guest_access.h unsigned long raw_clear_guest(void *to, unsigned · line 19

Quoted 10 lines
xen/arch/arm/include/asm/guest_access.h +2 -2
@@ -12,11 +12,11 @@ unsigned long raw_clear_guest(void *to, unsigned 
 int len);
   /* Copy data to guest physical address, then clean the region. */
   unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
-                                              paddr_t phys,
+                                              paddr_t gpa,
                                                 void *buf,
                                                 unsigned int len);
-int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
+int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
                                  uint32_t size, bool is_write);

The function namem suggests there would be a parameter called 'ipa'. But you are renaming it to 'gpa'. In this case, we should either renaming the parameter in the definition or the function name.

I am slightly leaning towards the latter because we don't tend to use 'ipa' very much in Xen (even though this is the Arm official terminology).

Quoted 16 lines
xen/arch/arm/include/asm/guest_access.h +0 -0
   #define __raw_copy_to_guest raw_copy_to_guest
xen/arch/arm/include/asm/irq.h +1 -1
index 11bc85d111..105b33b37d 100644
@@ -76,7 +76,7 @@ void init_IRQ(void);
   int route_irq_to_guest(struct domain *d, unsigned int virq,
                          unsigned int irq, const char *devname);
-int release_guest_irq(struct domain *d, unsigned int irq);
+int release_guest_irq(struct domain *d, unsigned int virq);
   void arch_move_irqs(struct vcpu *v);
xen/arch/arm/include/asm/mm.h +0 -0
index 4262165ce2..d78f7a183a 100644
@@ -225,7 +225,7 @@ extern void setup_directmap_mappings(unsigned long 
Quoted 8 lines

base_mfn, unsigned long nr_mf
  /* Map a frame table to cover physical addresses ps through pe */ extern void setup_frametable_mappings(paddr_t ps, paddr_t pe); /* map a physical range in virtual memory */
-void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int attributes);
+void __iomem *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes)

All the ioremap_* prototypes were consistent before this change. I have a slight preference if we stick we 'start' and therefore rename the parameter in the definition. But I would be ok with 'pa' so long all the other ioremap_* prototypes are updated accordingly.

Quoted 22 lines

  static inline void __iomem *ioremap_nocache(paddr_t start, size_t len) {

xen/arch/arm/include/asm/regs.h +1 -1
index 0693a68131..ef34b38aa1 100644
@@ -58,7 +58,7 @@ static inline bool guest_mode(const struct 
 cpu_user_regs *r)
   }
   register_t get_user_reg(struct cpu_user_regs *regs, int reg);
-void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
+void set_user_reg(struct cpu_user_regs *regs, int reg, register_t 
 value);
   #endif
xen/arch/arm/include/asm/vgic.h +0 -0
index 328fd46d1b..aa9f49409e 100644
@@ -355,8 +355,8 @@ bool vgic_evtchn_irq_pending(struct vcpu *v);
   int domain_vgic_register(struct domain *d, int *mmio_count);
   int domain_vgic_init(struct domain *d, unsigned int nr_spis);
   void domain_vgic_free(struct domain *d);
Quoted 9 lines

xen/arch/arm/include/asm/vgic.h bool vgic_evtchn_irq_pending(struct vcpu *v); · line 362

Quoted 6 lines
xen/arch/arm/include/asm/vgic.h +2 -2
-int vcpu_vgic_init(struct vcpu *vcpu);
-int vcpu_vgic_free(struct vcpu *vcpu);
+int vcpu_vgic_init(struct vcpu *v);
+int vcpu_vgic_free(struct vcpu *v);
   void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
                        bool level);

Cheers,

Hello Julien,
my original intention was to minimize the amount of modified code without touching the definitions, however, I can apply your suggested changes adapting definitions to declarations when the context requires it.

Regards

Signature · 3 lines
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)