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

Re: [XEN RFC PATCH 29/40] xen/arm: implement Arm arch helpers Arm to get memory map info



Hi Wei,

On 11/08/2021 11:24, Wei Chen wrote:
These two helpers are architecture APIs that are required by
nodes_cover_memory.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
  xen/arch/arm/numa.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
index f61a8df645..6eebf8e8bc 100644
--- a/xen/arch/arm/numa.c
+++ b/xen/arch/arm/numa.c
@@ -126,3 +126,17 @@ void __init numa_init(bool acpi_off)
      numa_initmem_init(PFN_UP(ram_start), PFN_DOWN(ram_end));
      return;
  }
+
+uint32_t __init arch_meminfo_get_nr_bank(void)
+{
+       return bootinfo.mem.nr_banks;
+}
+
+int __init arch_meminfo_get_ram_bank_range(int bank,
+       unsigned long long *start, unsigned long long *end)

They are physical address, so we should use "paddr_t" as on system such as 32-bit Arm, "unsigned long" is not enough to cover all the physical address.

As you change the type, I would also suggest to change the bank from an int to an unsigned int.

+{
+       *start = bootinfo.mem.bank[bank].start;
+       *end = bootinfo.mem.bank[bank].start + bootinfo.mem.bank[bank].size;
+
+       return 0;
+}


Cheers,

--
Julien Grall



 


Rackspace

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