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

[xen master] asm/smp.h: Fix circular dependency for device_tree.h and rwlock.h



commit f07bfa2e34e3e965c6acf73a943b76e2e9663776
Author:     Vikram Garhwal <vikram.garhwal@xxxxxxx>
AuthorDate: Tue Sep 5 18:16:23 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Sep 5 18:33:58 2023 -0700

    asm/smp.h: Fix circular dependency for device_tree.h and rwlock.h
    
    Dynamic programming ops will modify the dt_host and there might be other
    function which are browsing the dt_host at the same time. To avoid the race
    conditions, we will need to add a rwlock to protect access to the dt_host.
    However, adding rwlock in device_tree.h causes following circular 
dependency:
        device_tree.h->rwlock.h->smp.h->asm/smp.h->device_tree.h
    
    To fix this, removed the "#include <xen/device_tree.h> and forward declared
    "struct dt_device_node".
    
    Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
    Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
    Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/arch/arm/include/asm/smp.h | 4 +++-
 xen/arch/arm/smpboot.c         | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index a37ca55bff..4fabdf5310 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -3,7 +3,6 @@
 
 #ifndef __ASSEMBLY__
 #include <xen/cpumask.h>
-#include <xen/device_tree.h>
 #include <asm/current.h>
 #endif
 
@@ -23,6 +22,9 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 extern void noreturn stop_cpu(void);
 
 extern int arch_smp_init(void);
+
+struct dt_device_node;
+
 extern int arch_cpu_init(int cpu, struct dt_device_node *dn);
 extern int arch_cpu_up(int cpu);
 extern void arch_cpu_up_finish(void);
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index e107b86b7b..eeb76cd551 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -10,6 +10,7 @@
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/delay.h>
+#include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/errno.h>
 #include <xen/init.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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