public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Frank Rowand <frank.rowand@sony.com>,
	linux-kernel@vger.kernel.org, Rob Herring <robh@kernel.org>
Subject: Re: Qemu crashes in -next due to 'of: remove *phandle properties from expanded device tree'
Date: Thu, 15 Jun 2017 00:58:20 -0700	[thread overview]
Message-ID: <59423E1C.4020804@gmail.com> (raw)
In-Reply-To: <f994f1ab-64dc-85b6-da4d-9c332d9578a3@roeck-us.net>

On 06/14/17 21:12, Guenter Roeck wrote:

< snip >

> Good (v4.12-rc4):
> 

< snip >

> OF: Checking node /soc@e0000000/pic@40000
> OF:     type match
> OF:   node '/soc@e0000000/pic@40000' compatible '' type 'open-pic' name '' score 2
> OF:   node '/soc@e0000000/pic@40000' compatible 'open-pic' type '' name '' score 0

< snip >

> 
> bad:

< snip >

> OF: Checking node /soc@e0000000/pic@40000
> OF:   node '/soc@e0000000/pic@40000' compatible '' type 'open-pic' name '' score 0
> OF:   node '/soc@e0000000/pic@40000' compatible 'open-pic' type '' name '' score 0

< snip >

> No matching open-pic node
> ------------[ cut here ]------------
> kernel BUG at arch/powerpc/platforms/85xx/corenet_generic.c:50!
> 
> So, in __of_device_is_compatible(), the difference is in
> __of_device_is_compatible() after
> 
>         /* Matching type is better than matching name */
> 
> Further debugging shows that device->type is NULL in the bad case.
> 
> OF: Checking node /soc@e0000000/pic@40000
> OF:     trying type match open-pic - <NULL>
> OF:   node '/soc@e0000000/pic@40000' compatible '' type 'open-pic' name '' score 0
> OF:   node '/soc@e0000000/pic@40000' compatible 'open-pic' type '' name '' score 0
> 
> Do you need more information ?

I think I know what part of my patch is causing the problem.

Can you try the following patch to see if if fixes the failure in
__of_device_is_compatible()?

If this fixes the failure, then I know what is going on.  If it works
then I will have to rework my original patch in a different way than
this quick hack.

-Frank



---
 drivers/of/dynamic.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: b/drivers/of/dynamic.c
===================================================================
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -218,6 +218,20 @@ int of_property_notify(int action, struc
 
 static void __of_attach_node(struct device_node *np)
 {
+	const __be32 *phandle;
+	int sz;
+
+	/* use "<NULL>" to be consistent with populate_node() */
+	np->name = __of_get_property(np, "name", NULL) ? : "<NULL>";
+	np->type = __of_get_property(np, "device_type", NULL) ? : "<NULL>";
+
+	phandle = __of_get_property(np, "phandle", &sz);
+	if (!phandle)
+		phandle = __of_get_property(np, "linux,phandle", &sz);
+	if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle)
+		phandle = __of_get_property(np, "ibm,phandle", &sz);
+	np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0;
+
 	np->child = NULL;
 	np->sibling = np->parent->child;
 	np->parent->child = np;

  reply	other threads:[~2017-06-15  7:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 19:26 Qemu crashes in -next due to 'of: remove *phandle properties from expanded device tree' Guenter Roeck
2017-06-14 21:31 ` Frank Rowand
2017-06-14 22:35   ` Guenter Roeck
2017-06-15  0:45     ` Frank Rowand
2017-06-15  2:10       ` Guenter Roeck
2017-06-15  4:12       ` Guenter Roeck
2017-06-15  7:58         ` Frank Rowand [this message]
2017-06-15  9:53           ` Guenter Roeck
2017-06-15  6:48 ` Michael Ellerman

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=59423E1C.4020804@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=frank.rowand@sony.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@kernel.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