[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/arm: domain: Fix MISRA C 2012 Rule 8.7 violation



commit 2ce6a719a0cbfec5b57a2d257123146be1853f4a
Author:     Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
AuthorDate: Thu Jul 28 19:21:51 2022 +0300
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Fri Jul 29 16:01:10 2022 -0700

    xen/arm: domain: Fix MISRA C 2012 Rule 8.7 violation
    
    The function idle_loop() is referenced only in domain.c.
    Change its linkage from external to internal by adding the storage-class
    specifier static to its definitions.
    
    Add the function as a 'fake' input operand to the inline assembly statement,
    to make the compiler aware that the function is used.
    Fake means that the function is not actually used as an operand by the asm 
code.
    That is because there is not a suitable gcc arm32 asm constraint for labels.
    
    Declare return_to_new_vcpu32() and return_to_new_vcpu64() that are also
    referenced by this inline asm statement.
    
    Also, this patch resolves indirectly a MISRA C 2012 Rule 8.4 violation 
warning.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
    [add noreturn]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/domain.c              | 5 ++++-
 xen/arch/arm/include/asm/current.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2f8eaab7b5..2cd481979c 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -63,7 +63,7 @@ static void do_idle(void)
     rcu_idle_exit(cpu);
 }
 
-void idle_loop(void)
+static void noreturn idle_loop(void)
 {
     unsigned int cpu = smp_processor_id();
 
@@ -331,6 +331,9 @@ static void schedule_tail(struct vcpu *prev)
     update_vcpu_system_time(current);
 }
 
+extern void noreturn return_to_new_vcpu32(void);
+extern void noreturn return_to_new_vcpu64(void);
+
 static void continue_new_vcpu(struct vcpu *prev)
 {
     current->arch.actlr = READ_SYSREG(ACTLR_EL1);
diff --git a/xen/arch/arm/include/asm/current.h 
b/xen/arch/arm/include/asm/current.h
index 73e81458e5..6973eeb1d1 100644
--- a/xen/arch/arm/include/asm/current.h
+++ b/xen/arch/arm/include/asm/current.h
@@ -45,7 +45,7 @@ static inline struct cpu_info *get_cpu_info(void)
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn) do {                           \
-    asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack) : "memory" ); \
+    asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack), "X" (fn) : "memory" 
); \
     unreachable();                                                      \
 } while ( false )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.