xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien.Grall@arm.com
Cc: jgross@suse.com, xen-devel@lists.xenproject.org,
	sstabellini@kernel.org, Volodymyr_Babchuk@epam.com,
	Stefano Stabellini <stefano.stabellini@xilinx.com>
Subject: [Xen-devel] [PATCH v2 3/3] xen/arm: fix duplicate memory node in DT
Date: Mon,  7 Oct 2019 18:15:01 -0700	[thread overview]
Message-ID: <20191008011501.21038-3-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1910071811320.13684@sstabellini-ThinkPad-T480s>

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 "@<unit-address>" to the
name, as per the Device Tree specification, where <unit-address> 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 <oleksandr_tyshchenko@epam.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
Changes in v2:
- fix buf size calculation: the number is 64bit and printed as
  hexadecimal
- move check on nr_banks to a separate patch
---
 xen/arch/arm/domain_build.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index ea01aada0b..3de4dafaed 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;
 
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-10-08  1:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  1:14 [Xen-devel] [PATCH for-4.13 v2 0/3] fixes for make_[memory/cpu]_node Stefano Stabellini
2019-10-08  1:14 ` [Xen-devel] [PATCH v2 1/3] xen/arm: fix buf size in make_cpus_node Stefano Stabellini
2019-10-08 11:15   ` Julien Grall
2019-10-08 21:18     ` Stefano Stabellini
2019-10-08 21:47       ` Julien Grall
2019-10-08  1:15 ` [Xen-devel] [PATCH v2 2/3] xen/arm: make_memory_node return error on nr_banks == 0 Stefano Stabellini
2019-10-08 12:53   ` Julien Grall
2019-10-08  1:15 ` Stefano Stabellini [this message]
2019-10-08 12:54   ` [Xen-devel] [PATCH v2 3/3] xen/arm: fix duplicate memory node in DT Julien Grall
2019-10-08  4:21 ` [Xen-devel] [PATCH for-4.13 v2 0/3] fixes for make_[memory/cpu]_node Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191008011501.21038-3-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=Julien.Grall@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=jgross@suse.com \
    --cc=stefano.stabellini@xilinx.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).