On 07/05/2012 11:48 AM, Peter Maydell wrote:
> Device tree memory regions may have sizes larger than 4GB.
> Instead of silently truncating a 64 bit size when we pass it
> to arm_add_memory(), split large regions into 2GB chunks.
> 
> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
> ---
> With this patch, I can take a device tree which has been tweaked
> so its #address-cells and #size-cells are both 2, and boot it on
> a QEMU vexpress-a15 model with >4GB of RAM, and have the kernel
> actually detect the right amount of RAM. [the qemu bit needs some
> patches I haven't posted yet.]
> 
> Since I'm not really a kernel dev I thought I'd post this to
> linaro-dev first in the hope of a bit of friendly local review
> before venturing onto lkml :-)
> (Apologies to those on cc who got this twice because I mistyped
> the linaro-dev email address.)

We'll still find you. ;)

>  arch/arm/kernel/devtree.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> index bee7f9d..79a6e66 100644
> --- a/arch/arm/kernel/devtree.c
> +++ b/arch/arm/kernel/devtree.c
> @@ -26,6 +26,11 @@
>  
>  void __init early_init_dt_add_memory_arch(u64 base, u64 size)
>  {
> +     while (size > 0x80000000) {
> +             arm_add_memory(base, 0x80000000);
> +             base += 0x80000000;
> +             size -= 0x80000000;
> +     }
>       arm_add_memory(base, size);

I would just change arm_add_memory to use phys_addr_t for the size
param. This ultimately calls memblock functions which use phys_addr_t
for sizes.

One thing I noticed is ATAGs will be broken for LPAE. That's probably
fine because if you can fix your bootloader for new ATAGs, then you can
support DT.

Rob

>  }
>  
> 



_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to