Skip to contentSkip to conversation

xen/x86: address some violations of MISRA C:2012 Rules 8.2 and 8.3

PATCH In review Federico Serafini 2 participants 9 messages Sep 6, 2023 – Sep 7, 2023

lore
Share & tools
lore
#0 lore raw

cover xen/x86: address some violations of MISRA C:2012 Rules 8.2 and 8.3

This serie addresses some violations of MISRA C:2012 Rules 8.2 and 8.3 for x86-64.

Federico Serafini (4):
x86/genapic: address a violation of MISRA C:2012 Rule 8.3 x86/io: address violations of MISRA C:2012 Rule 8.3 x86/io_apic: address violations of MISRA C:2012 Rules 8.2 and 8.3 xen/vpci: address a violation of MISRA C:2012 Rule 8.3

 xen/arch/x86/include/asm/genapic.h | 2 +-
 xen/arch/x86/include/asm/hap.h     | 2 +-
 xen/arch/x86/include/asm/io.h      | 2 +-
 xen/arch/x86/include/asm/io_apic.h | 4 ++--
 xen/include/xen/vpci.h             | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 x86/genapic: address a violation of MISRA C:2012 Rule 8.3

Make function delcaration consistent with the corresponding definition. No functional change.

---
 xen/arch/x86/include/asm/genapic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/genapic.h +1 -1
index beeaddf19d..970df8ffe0 100644
@@ -43,7 +43,7 @@ void cf_check send_IPI_self_legacy(uint8_t vector);
 
 void cf_check init_apic_ldr_flat(void);
 unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
-void cf_check send_IPI_mask_flat(const cpumask_t *mask, int vector);
+void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, int vector);
 const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu);
 #define GENAPIC_FLAT \
 	.int_delivery_mode = dest_LowestPrio, \
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/4 x86/io: address violations of MISRA C:2012 Rule 8.3

In reply to Federico Serafini

Make declarations consistent, no functional change.

---
 xen/arch/x86/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/io.h +1 -1
index 92b784a861..8c8a15bd06 100644
@@ -51,6 +51,6 @@ __OUT(l,,int)
 #define IOEMUL_QUIRK_STUB_BYTES 9
 struct cpu_user_regs;
 extern unsigned int (*ioemul_handle_quirk)(
-    u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs);
+    uint8_t opcode, char *io_emul_stub, struct cpu_user_regs *regs);
 
 #endif
Signature · 1 line
2.34.1
#5 lore raw

PATCH 3/4 x86/io_apic: address violations of MISRA C:2012 Rules 8.2 and 8.3

In reply to Federico Serafini

Add missing parameter names and make function declarations and definitions consistent.

No functional change.

---
 xen/arch/x86/include/asm/io_apic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/include/asm/io_apic.h +2 -2
index 9165da2281..a7e4c9e146 100644
@@ -199,7 +199,7 @@ extern struct IO_APIC_route_entry __ioapic_read_entry(
     unsigned int apic, unsigned int pin, bool raw);
 void __ioapic_write_entry(
     unsigned int apic, unsigned int pin, bool raw,
-    struct IO_APIC_route_entry);
+    struct IO_APIC_route_entry e);
 
 extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
 extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries);
@@ -211,6 +211,6 @@ extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries,
 unsigned highest_gsi(void);
 
 int ioapic_guest_read( unsigned long physbase, unsigned int reg, u32 *pval);
-int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 pval);
+int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val);
 
 #endif
Signature · 1 line
2.34.1
#7 lore raw

PATCH 4/4 xen/vpci: address a violation of MISRA C:2012 Rule 8.3

In reply to Federico Serafini

Make function declarations and definitions consistent. No functional change.

---
 xen/arch/x86/include/asm/hap.h | 2 +-
 xen/include/xen/vpci.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/include/asm/hap.h +1 -1
index 9d12327b12..05e124ad57 100644
@@ -30,7 +30,7 @@ void  hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned int nr_frames,
-                           XEN_GUEST_HANDLE(void) dirty_bitmap);
+                           XEN_GUEST_HANDLE(void) guest_dirty_bitmap);
 
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
 int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted);
xen/include/xen/vpci.h +1 -1
index 0b8a2a3c74..d743d96a10 100644
@@ -26,7 +26,7 @@ typedef int vpci_register_init_t(struct pci_dev *dev);
                __used_section(".data.vpci." p) = x
 
 /* Add vPCI handlers to device. */
-int __must_check vpci_add_handlers(struct pci_dev *dev);
+int __must_check vpci_add_handlers(struct pci_dev *pdev);
 
 /* Remove all handlers and free vpci related structures. */
 void vpci_remove_device(struct pci_dev *pdev);
Signature · 1 line
2.34.1
#8 lore raw

Re: [XEN PATCH 4/4] xen/vpci: address a violation of MISRA C:2012 Rule 8.3

xen/arch/x86/include/asm/hap.h void hap_vcpu_init(struct vcpu *v); · line 36

Quoted 11 lines · Federico Serafini
xen/arch/x86/include/asm/hap.h +1 -1
@@ -30,7 +30,7 @@ void  hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned int nr_frames,
-                           XEN_GUEST_HANDLE(void) dirty_bitmap);
+                           XEN_GUEST_HANDLE(void) guest_dirty_bitmap);
 
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
 int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted);

How is this related to vPCI? Plus if you change the HAP function, please adjust its shadow counterpart too.

Jan