Re: [XEN PATCH v3] x86/HVM: address violations of MISRA C:2012 Rules 8.2 and 8.3

2023-07-20 Thread Jan Beulich
On 20.07.2023 09:53, Federico Serafini wrote:
> Give a name to unnamed parameters thus addressing violations of
> MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
> named parameters").
> Keep consistency between parameter names and types used in function
> declarations and the ones used in the corresponding function
> definitions, thus addressing violations of MISRA C:2012 Rule 8.3
> ("All declarations of an object or function shall use the same names
> and type qualifiers").
> 
> No functional changes.
> 
> Signed-off-by: Federico Serafini 

Acked-by: Jan Beulich 





[XEN PATCH v3] x86/HVM: address violations of MISRA C:2012 Rules 8.2 and 8.3

2023-07-20 Thread Federico Serafini
Give a name to unnamed parameters thus addressing violations of
MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with
named parameters").
Keep consistency between parameter names and types used in function
declarations and the ones used in the corresponding function
definitions, thus addressing violations of MISRA C:2012 Rule 8.3
("All declarations of an object or function shall use the same names
and type qualifiers").

No functional changes.

Signed-off-by: Federico Serafini 
---
Changes in v3:
  - removed changes to convert_hour() (Jan took care of it);
  - modified also hvm_set_rdtsc_exiting() declaration;
  - modified also svm_intercept_msr() declaration.
---
Changes in v2:
  - u64 vs uint64_t mismatches are solved in favor of the stdint types;
  - adapted parameter names of nsvm_vcpu_vmexit_event() definition to
the names used in its declaration.
---

Signed-off-by: Federico Serafini 
---
 xen/arch/x86/hvm/domain.c   |  2 +-
 xen/arch/x86/hvm/hvm.c  |  6 +++---
 xen/arch/x86/hvm/svm/nestedsvm.c|  8 
 xen/arch/x86/hvm/vioapic.c  |  2 +-
 xen/arch/x86/include/asm/hvm/domain.h   |  2 +-
 xen/arch/x86/include/asm/hvm/hvm.h  | 20 ++--
 xen/arch/x86/include/asm/hvm/irq.h  | 14 +++---
 xen/arch/x86/include/asm/hvm/save.h |  4 ++--
 xen/arch/x86/include/asm/hvm/support.h  |  2 +-
 xen/arch/x86/include/asm/hvm/svm/vmcb.h |  2 +-
 10 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c
index 7692ee24c2..7f6e362a70 100644
--- a/xen/arch/x86/hvm/domain.c
+++ b/xen/arch/x86/hvm/domain.c
@@ -100,7 +100,7 @@ static int check_segment(struct segment_register *reg, enum 
x86_segment seg)
 }
 
 /* Called by VCPUOP_initialise for HVM guests. */
-int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx)
+int arch_set_info_hvm_guest(struct vcpu *v, const struct vcpu_hvm_context *ctx)
 {
 const struct domain *d = v->domain;
 struct cpu_user_regs *uregs = >arch.user_regs;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 57363c2ae1..28d131a202 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -272,7 +272,7 @@ uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t 
vec2)
 return X86_EXC_DF;
 }
 
-void hvm_set_rdtsc_exiting(struct domain *d, bool_t enable)
+void hvm_set_rdtsc_exiting(struct domain *d, bool enable)
 {
 struct vcpu *v;
 
@@ -280,7 +280,7 @@ void hvm_set_rdtsc_exiting(struct domain *d, bool_t enable)
 alternative_vcall(hvm_funcs.set_rdtsc_exiting, v, enable);
 }
 
-void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat)
+void hvm_get_guest_pat(struct vcpu *v, uint64_t *guest_pat)
 {
 if ( !alternative_call(hvm_funcs.get_guest_pat, v, guest_pat) )
 *guest_pat = v->arch.hvm.pat_cr;
@@ -426,7 +426,7 @@ static void hvm_set_guest_tsc_adjust(struct vcpu *v, u64 
tsc_adjust)
 update_vcpu_system_time(v);
 }
 
-u64 hvm_get_guest_tsc_fixed(struct vcpu *v, uint64_t at_tsc)
+uint64_t hvm_get_guest_tsc_fixed(struct vcpu *v, uint64_t at_tsc)
 {
 uint64_t tsc;
 
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 5d74863268..a09b6abaae 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -837,12 +837,12 @@ nsvm_vcpu_vmexit_inject(struct vcpu *v, struct 
cpu_user_regs *regs,
 }
 
 int cf_check nsvm_vcpu_vmexit_event(
-struct vcpu *v, const struct x86_event *trap)
+struct vcpu *v, const struct x86_event *event)
 {
 ASSERT(vcpu_nestedhvm(v).nv_vvmcx != NULL);
 
-nestedsvm_vmexit_defer(v, VMEXIT_EXCEPTION_DE + trap->vector,
-   trap->error_code, trap->cr2);
+nestedsvm_vmexit_defer(v, VMEXIT_EXCEPTION_DE + event->vector,
+   event->error_code, event->cr2);
 return NESTEDHVM_VMEXIT_DONE;
 }
 
@@ -1538,7 +1538,7 @@ nestedsvm_vcpu_interrupt(struct vcpu *v, const struct 
hvm_intack intack)
 return NSVM_INTR_NOTINTERCEPTED;
 }
 
-bool_t
+bool
 nestedsvm_gif_isset(struct vcpu *v)
 {
 struct nestedsvm *svm = _nestedsvm(v);
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 41e3c4d5e4..4e40d3609a 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -43,7 +43,7 @@
 /* HACK: Route IRQ0 only to VCPU0 to prevent time jumps. */
 #define IRQ0_SPECIAL_ROUTING 1
 
-static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int irq);
+static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin);
 
 static struct hvm_vioapic *addr_vioapic(const struct domain *d,
 unsigned long addr)
diff --git a/xen/arch/x86/include/asm/hvm/domain.h 
b/xen/arch/x86/include/asm/hvm/domain.h
index 02c32cf26d..6e53ce4449 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -47,7 +47,7 @@ struct