|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 20/21] xen/arm: Use dedicated function for Static SHM Device Tree creation
Use a dedicated function to create Static SHM Device Tree nodes instead
of reusing the generic memory node function.
Since the memory banks managing Static SHM repurpose the 'type' field
for a different purpose via a union, separating this creation logic
keeps the implementation clean and significantly improves maintainability.
---
xen/arch/arm/domain_build.c | 6 ++++++
xen/common/device-tree/domain-build.c | 21 +++++++++++++++++++++
xen/include/xen/fdt-domain-build.h | 2 ++
3 files changed, 29 insertions(+)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 7960dcd33a..1cd66c9911 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1805,6 +1805,12 @@ static int __init handle_node(struct domain *d, struct
kernel_info *kinfo,
if ( res )
return res;
+#ifdef CONFIG_STATIC_SHM
+ res = make_raw_memory_node(kinfo, addrcells, sizecells,
kernel_info_get_shm_mem_const(kinfo));
+ if ( res )
+ return res;
+#endif /* CONFIG_STATIC_SHM */
+
res = make_distance_map_node(d, kinfo->fdt);
if ( res )
return res;
diff --git a/xen/common/device-tree/domain-build.c
b/xen/common/device-tree/domain-build.c
index 61e2e50062..f846ca0471 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -565,6 +565,27 @@ int __init make_memory_node(const struct kernel_info
*kinfo, int addrcells,
return res;
}
+int __init make_raw_memory_node(const struct kernel_info *kinfo, int addrcells,
+ int sizecells, const struct membanks *mem)
+{
+ unsigned int i;
+ int res = 0;
+
+ if ( mem->nr_banks == 0 )
+ return 0;
+
+ dt_dprintk("Create raw memory nodes\n");
+
+ for ( i = 0 ; i < mem->nr_banks; i++ )
+ {
+ res = make_memory_sibling_node(kinfo, addrcells, sizecells,
&mem->bank[i]);
+ if ( res )
+ return res;
+ }
+
+ return res;
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/xen/fdt-domain-build.h
b/xen/include/xen/fdt-domain-build.h
index 671486c1c8..6a809f3f86 100644
--- a/xen/include/xen/fdt-domain-build.h
+++ b/xen/include/xen/fdt-domain-build.h
@@ -31,6 +31,8 @@ int make_hypervisor_node(struct domain *d, const struct
kernel_info *kinfo,
int addrcells, int sizecells);
int make_memory_node(const struct kernel_info *kinfo, int addrcells,
int sizecells, const struct membanks *mem);
+int make_raw_memory_node(const struct kernel_info *kinfo, int addrcells,
+ int sizecells, const struct membanks *mem);
int make_timer_node(const struct kernel_info *kinfo);
static inline int get_allocation_size(paddr_t size)
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |