From: Stefano Stabellini Date: Tue, 8 Oct 2019 01:15:01 +0000 (-0700) Subject: xen/arm: fix duplicate memory node in DT X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1313 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=98d1dac88f82c2b79d528faabe5e3fda8133e8bb;p=xen.git xen/arm: fix duplicate memory node in DT When reserved-memory regions are present in the host device tree, dom0 is started with multiple memory nodes. Each memory node should have a unique name, but today they are all called "memory" leading to Linux printing the following warning at boot: OF: Duplicate name in base, renamed to "memory#1" This patch fixes the problem by appending a "@" to the name, as per the Device Tree specification, where matches the base of address of the first region. Fixes: 248faa637d2 (xen/arm: add reserved-memory regions to the dom0 memory node) Reported-by: Oleksandr Tyshchenko Signed-off-by: Stefano Stabellini Acked-by: Julien Grall Release-acked-by: Juergen Gross --- diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 5ab84e5839..e7eaa35b14 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -646,6 +646,8 @@ static int __init make_memory_node(const struct domain *d, int res, i; int reg_size = addrcells + sizecells; int nr_cells = reg_size * mem->nr_banks; + /* Placeholder for memory@ + a 64-bit number + \0 */ + char buf[24]; __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */]; __be32 *cells; @@ -657,7 +659,8 @@ static int __init make_memory_node(const struct domain *d, reg_size, nr_cells); /* ePAPR 3.4 */ - res = fdt_begin_node(fdt, "memory"); + snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[0].start); + res = fdt_begin_node(fdt, buf); if ( res ) return res;