diff mbox series

[v6,04/17] xen/arm: use arch_get_ram_range to get memory ranges from bootinfo

Message ID 20231120025431.14845-5-Henry.Wang@arm.com (mailing list archive)
State New, archived
Headers show
Series Device tree based NUMA support for Arm | expand

Commit Message

Henry Wang Nov. 20, 2023, 2:54 a.m. UTC
From: Wei Chen <wei.chen@arm.com>

Implement the same helper "arch_get_ram_range" as x86 for NUMA
code to get memory bank from Arm bootinfo.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
---
v2 -> v6:
- Rebase on top of staging without code changes.
v1 -> v2:
- Use arch_get_ram_range instead of arch_get_memory_map.
---
 xen/arch/arm/numa.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
index 31332a6ea7..e9b2ec93bc 100644
--- a/xen/arch/arm/numa.c
+++ b/xen/arch/arm/numa.c
@@ -99,3 +99,14 @@  unsigned char __node_distance(nodeid_t from, nodeid_t to)
 
     return node_distance_map[from][to];
 }
+
+int __init arch_get_ram_range(unsigned int idx, paddr_t *start, paddr_t *end)
+{
+    if ( idx >= bootinfo.mem.nr_banks )
+        return -ENOENT;
+
+    *start = bootinfo.mem.bank[idx].start;
+    *end = *start + bootinfo.mem.bank[idx].size;
+
+    return 0;
+}