Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752316AbdFOH7K (ORCPT ); Thu, 15 Jun 2017 03:59:10 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:33047 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbdFOH7J (ORCPT ); Thu, 15 Jun 2017 03:59:09 -0400 Subject: Re: Qemu crashes in -next due to 'of: remove *phandle properties from expanded device tree' To: Guenter Roeck References: <20170614192638.GA15210@roeck-us.net> <5941AB4E.3070804@gmail.com> <20170614223559.GA19172@roeck-us.net> <5941D8C0.1020100@gmail.com> Cc: Frank Rowand , linux-kernel@vger.kernel.org, Rob Herring From: Frank Rowand Message-ID: <59423E1C.4020804@gmail.com> Date: Thu, 15 Jun 2017 00:58:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2537 Lines: 88 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 - > 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 "" to be consistent with populate_node() */ + np->name = __of_get_property(np, "name", NULL) ? : ""; + np->type = __of_get_property(np, "device_type", 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;