[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251030144650.GA3911092-robh@kernel.org>
Date: Thu, 30 Oct 2025 09:46:50 -0500
From: Rob Herring <robh@...nel.org>
To: Herve Codina <herve.codina@...tlin.com>
Cc: Andrew Lunn <andrew@...n.ch>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Danilo Krummrich <dakr@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>, Andi Shyti <andi.shyti@...nel.org>,
	Wolfram Sang <wsa+renesas@...g-engineering.com>,
	Peter Rosin <peda@...ntia.se>, Arnd Bergmann <arnd@...db.de>,
	Saravana Kannan <saravanak@...gle.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Charles Keepax <ckeepax@...nsource.cirrus.com>,
	Richard Fitzgerald <rf@...nsource.cirrus.com>,
	David Rhodes <david.rhodes@...rus.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	Mark Brown <broonie@...nel.org>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Daniel Scally <djrscally@...il.com>,
	Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	Len Brown <lenb@...nel.org>, Davidlohr Bueso <dave@...olabs.net>,
	Jonathan Cameron <jonathan.cameron@...wei.com>,
	Dave Jiang <dave.jiang@...el.com>,
	Alison Schofield <alison.schofield@...el.com>,
	Vishal Verma <vishal.l.verma@...el.com>,
	Ira Weiny <ira.weiny@...el.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Wolfram Sang <wsa@...nel.org>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org,
	linux-i2c@...r.kernel.org, linux-pci@...r.kernel.org,
	linux-sound@...r.kernel.org, patches@...nsource.cirrus.com,
	linux-gpio@...r.kernel.org, linux-pm@...r.kernel.org,
	linux-spi@...r.kernel.org, linux-acpi@...r.kernel.org,
	linux-cxl@...r.kernel.org,
	Allan Nielsen <allan.nielsen@...rochip.com>,
	Horatiu Vultur <horatiu.vultur@...rochip.com>,
	Steen Hegelund <steen.hegelund@...rochip.com>,
	Luca Ceresoli <luca.ceresoli@...tlin.com>,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v4 19/29] of: property: Allow fw_devlink device-tree on
 x86
On Wed, Oct 15, 2025 at 09:14:06AM +0200, Herve Codina wrote:
> PCI drivers can use a device-tree overlay to describe the hardware
> available on the PCI board. This is the case, for instance, of the
> LAN966x PCI device driver.
> 
> Adding some more nodes in the device-tree overlay adds some more
> consumer/supplier relationship between devices instantiated from this
> overlay.
> 
> Those fw_node consumer/supplier relationships are handled by fw_devlink
> and are created based on the device-tree parsing done by the
> of_fwnode_add_links() function.
> 
> Those consumer/supplier links are needed in order to ensure a correct PM
> runtime management and a correct removal order between devices.
> 
> For instance, without those links a supplier can be removed before its
> consumers is removed leading to all kind of issue if this consumer still
> want the use the already removed supplier.
> 
> The support for the usage of an overlay from a PCI driver has been added
> on x86 systems in commit 1f340724419ed ("PCI: of: Create device tree PCI
> host bridge node").
> 
> In the past, support for fw_devlink on x86 had been tried but this
> support has been removed in commit 4a48b66b3f52 ("of: property: Disable
> fw_devlink DT support for X86"). Indeed, this support was breaking some
> x86 systems such as OLPC system and the regression was reported in [0].
> 
> Instead of disabling this support for all x86 system, use a finer grain
> and disable this support only for the possible problematic subset of x86
> systems (at least OLPC and CE4100).
> 
> Those systems use a device-tree to describe their hardware. Identify
> those systems using key properties in the device-tree.
> 
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>
> Link: https://lore.kernel.org/lkml/3c1f2473-92ad-bfc4-258e-a5a08ad73dd0@web.de/ [0]
> ---
>  drivers/of/property.c | 31 ++++++++++++++++++++++++++++++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index c1feb631e383..09b568e3b826 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1600,12 +1600,41 @@ static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
>  	return of_irq_get(to_of_node(fwnode), index);
>  }
>  
> +static int match_property_by_path(const char *node_path, const char *prop_name,
> +				  const char *value)
> +{
> +	struct device_node *np __free(device_node) = of_find_node_by_path(node_path);
> +
> +	return of_property_match_string(np, prop_name, value);
> +}
> +
> +static bool of_is_fwnode_add_links_supported(void)
> +{
> +	static int is_supported = -1;
> +
> +	if (is_supported != -1)
> +		return !!is_supported;
> +
All of this:
> +	if (match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0)
> +		goto not_supported;
> +
> +	if (match_property_by_path("/", "architecture", "OLPC") >= 0)
> +		goto not_supported;
> +
> +	is_supported = 1;
> +	return !!is_supported;
> +
> +not_supported:
> +	is_supported = 0;
can be simplified to:
is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) || 
                 (match_property_by_path("/", "architecture", "OLPC") >= 0));
> +	return !!is_supported;
> +}
> +
>  static int of_fwnode_add_links(struct fwnode_handle *fwnode)
>  {
>  	const struct property *p;
>  	struct device_node *con_np = to_of_node(fwnode);
>  
> -	if (IS_ENABLED(CONFIG_X86))
> +	if (IS_ENABLED(CONFIG_X86) && !of_is_fwnode_add_links_supported())
I would move the IS_ENABLED() check to 
of_is_fwnode_add_links_supported().
Rob
Powered by blists - more mailing lists
 
