All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: "Jürgen Groß" <jgross@suse.com>
Cc: julien@xen.org, xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr_Babchuk@epam.com, oleksandr_tyshchenko@epam.com
Subject: Re: [Xen-devel] [PATCH for-4.13] xen/arm: fix duplicate memory node in DT
Date: Mon, 7 Oct 2019 14:30:44 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.21.1910071430100.13684@sstabellini-ThinkPad-T480s> (raw)
In-Reply-To: <71fe02ae-a279-8d30-28e9-35d6c84c9a08@suse.com>

[-- Attachment #1: Type: text/plain, Size: 2122 bytes --]

On Mon, 7 Oct 2019, Jürgen Groß wrote:
> On 05.10.19 01:09, Stefano Stabellini wrote:
> > 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.
> > 
> > Reported-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
> > 
> > ---
> > 
> > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> > index 921b054520..a4c07db383 100644
> > --- a/xen/arch/arm/domain_build.c
> > +++ b/xen/arch/arm/domain_build.c
> > @@ -646,16 +646,22 @@ 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 32-bit number + \0 */
> > +    char buf[18];
> 
> You are using PRIx64 for printing the number, so I guess you should
> enlarge buf by 8 bytes and adjust the comment (s/32/64/).

Well spotted! In fact, there is a similar error in make_cpus_node. I'll
fix that one too in a separate patch.


> >       __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */];
> >       __be32 *cells;
> >         BUG_ON(nr_cells >= ARRAY_SIZE(reg));
> > +    /* Nothing to do */
> > +    if ( mem->nr_banks == 0 )
> > +        return 0;
> >         dt_dprintk("Create memory node (reg size %d, nr cells %d)\n",
> >                  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;
> 
> 
> Juergen
> 

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

  reply	other threads:[~2019-10-07 21:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 23:09 [Xen-devel] [PATCH for-4.13] xen/arm: fix duplicate memory node in DT Stefano Stabellini
2019-10-07  6:51 ` Jürgen Groß
2019-10-07 21:30   ` Stefano Stabellini [this message]
2019-10-07 10:01 ` Julien Grall
2019-10-07 21:30   ` Stefano Stabellini
2019-10-07 21:47     ` Julien Grall
2019-10-07 22:15       ` Stefano Stabellini

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=alpine.DEB.2.21.1910071430100.13684@sstabellini-ThinkPad-T480s \
    --to=sstabellini@kernel.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=oleksandr_tyshchenko@epam.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.