Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: property: Allow fw_devlink device-tree on x86

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@bootlin.com>
Link: https://lore.kernel.org/lkml/3c1f2473-92ad-bfc4-258e-a5a08ad73dd0@web.de/ [0]
Link: https://patch.msgid.link/20260325143555.451852-18-herve.codina@bootlin.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

authored by

Herve Codina and committed by
Rob Herring (Arm)
c349e45f d08082a8

+25 -1
+25 -1
drivers/of/property.c
··· 1620 1620 return of_irq_get(to_of_node(fwnode), index); 1621 1621 } 1622 1622 1623 + static int match_property_by_path(const char *node_path, const char *prop_name, 1624 + const char *value) 1625 + { 1626 + struct device_node *np __free(device_node) = of_find_node_by_path(node_path); 1627 + 1628 + return of_property_match_string(np, prop_name, value); 1629 + } 1630 + 1631 + static bool of_is_fwnode_add_links_supported(void) 1632 + { 1633 + static int is_supported = -1; 1634 + 1635 + if (!IS_ENABLED(CONFIG_X86)) 1636 + return true; 1637 + 1638 + if (is_supported != -1) 1639 + return !!is_supported; 1640 + 1641 + is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) || 1642 + (match_property_by_path("/", "architecture", "OLPC") >= 0)); 1643 + 1644 + return !!is_supported; 1645 + } 1646 + 1623 1647 static int of_fwnode_add_links(struct fwnode_handle *fwnode) 1624 1648 { 1625 1649 const struct property *p; 1626 1650 struct device_node *con_np = to_of_node(fwnode); 1627 1651 1628 - if (IS_ENABLED(CONFIG_X86)) 1652 + if (!of_is_fwnode_add_links_supported()) 1629 1653 return 0; 1630 1654 1631 1655 if (!con_np)