All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-27  0:11 ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

This patch series improves fw_devlink in the following ways:

1. It no longer cares about a fwnode having a "compatible" property. It
   figures this our more dynamically. The only expectation is that
   fwnode that are converted to devices actually get probed by a driver
   for the dependencies to be enforced correctly.

2. Finer grained dependency tracking. fw_devlink will now create device
   links from the consumer to the actual resource's device (if it has one,
   Eg: gpio_device) instead of the parent supplier device. This improves
   things like async suspend/resume ordering, potentially remove the need
   for frameworks to create device links, more parallelized async probing,
   and better sync_state() tracking.

3. Handle hardware/software quirks where a child firmware node gets
   populated as a device before its parent firmware node AND actually
   supplies a non-optional resource to the parent firmware node's
   device.

4. Way more robust at cycle handling (see patch for the insane cases).

5. Stops depending on OF_POPULATED to figure out some corner cases.

6. Simplifies the work that needs to be done by the firmware specific
   code.

Sorry it took a while to roll in the fixes I gave in the v1 series
thread[1] into a v2 series.

Since I didn't make any additional changes on top of what I already gave
in the v1 thread and Dmitry is very eager to get this series going, I'm
sending it out without testing locally. I already tested these patches a
few months ago as part of the v1 series. So I don't expect any major
issues. I'll test them again on my end in the next few days and will
report here if I actually find anything wrong.

Tony, Naresh, Abel, Sudeep, Geert,

I got the following reviewed by's and tested by's a few months back, but
it's been 5 months since I sent out v1. So I wasn't sure if it was okay
to include them in the v2 commits. Let me know if you are okay with this
being included in the commits and/or if you want to test this series
again.

Reviewed-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Tested-by: Abel Vesa <abel.vesa@linaro.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,

I've Cc-ed you because I had pointed you to v1 of this series + the
patches in that thread at one point or another as a fix to some issue
you were facing. It'd appreciate it if you can test this series and
report any issues, or things it fixed and give Tested-bys.

In addition, if you can also apply a revert of this series[2] and delete
driver_deferred_probe_check_state() from your tree and see if you hit
any issues and report them, that'd be great too! I'm pretty sure some of
you will hit issues with that. I want to fix those next and then
revert[2].

Thanks,
Saravana

[1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
[2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
[3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/

v1 -> v2:
- Fixed Patch 1 to handle a corner case discussed in [3].
- New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
- New patch 11 to add fw_devlink support for SCMI devices.

Cc: Abel Vesa <abel.vesa@linaro.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: John Stultz <jstultz@google.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Maxim Kiselev <bigunclemax@gmail.com>
Cc: Maxim Kochetkov <fido_max@inbox.ru>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Luca Weiss <luca.weiss@fairphone.com>
Cc: Colin Foster <colin.foster@in-advantage.com>
Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: Jean-Philippe Brucker <jpb@kernel.org>

Saravana Kannan (11):
  driver core: fw_devlink: Don't purge child fwnode's consumer links
  driver core: fw_devlink: Improve check for fwnode with no
    device/driver
  soc: renesas: Move away from using OF_POPULATED for fw_devlink
  gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  driver core: fw_devlink: Allow marking a fwnode link as being part of
    a cycle
  driver core: fw_devlink: Consolidate device link flag computation
  driver core: fw_devlink: Make cycle detection more robust
  of: property: Simplify of_link_to_phandle()
  irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
  firmware: arm_scmi: Set fwnode for the scmi_device

 drivers/base/core.c             | 443 +++++++++++++++++++++-----------
 drivers/firmware/arm_scmi/bus.c |   2 +
 drivers/gpio/gpiolib.c          |   6 +
 drivers/irqchip/irq-imx-gpcv2.c |   1 +
 drivers/of/property.c           |  84 +-----
 drivers/soc/imx/gpcv2.c         |   1 +
 drivers/soc/renesas/rcar-sysc.c |   2 +-
 include/linux/device.h          |   1 +
 include/linux/fwnode.h          |  12 +-
 9 files changed, 332 insertions(+), 220 deletions(-)

-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply	[flat|nested] 146+ messages in thread

* [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-27  0:11 ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

This patch series improves fw_devlink in the following ways:

1. It no longer cares about a fwnode having a "compatible" property. It
   figures this our more dynamically. The only expectation is that
   fwnode that are converted to devices actually get probed by a driver
   for the dependencies to be enforced correctly.

2. Finer grained dependency tracking. fw_devlink will now create device
   links from the consumer to the actual resource's device (if it has one,
   Eg: gpio_device) instead of the parent supplier device. This improves
   things like async suspend/resume ordering, potentially remove the need
   for frameworks to create device links, more parallelized async probing,
   and better sync_state() tracking.

3. Handle hardware/software quirks where a child firmware node gets
   populated as a device before its parent firmware node AND actually
   supplies a non-optional resource to the parent firmware node's
   device.

4. Way more robust at cycle handling (see patch for the insane cases).

5. Stops depending on OF_POPULATED to figure out some corner cases.

6. Simplifies the work that needs to be done by the firmware specific
   code.

Sorry it took a while to roll in the fixes I gave in the v1 series
thread[1] into a v2 series.

Since I didn't make any additional changes on top of what I already gave
in the v1 thread and Dmitry is very eager to get this series going, I'm
sending it out without testing locally. I already tested these patches a
few months ago as part of the v1 series. So I don't expect any major
issues. I'll test them again on my end in the next few days and will
report here if I actually find anything wrong.

Tony, Naresh, Abel, Sudeep, Geert,

I got the following reviewed by's and tested by's a few months back, but
it's been 5 months since I sent out v1. So I wasn't sure if it was okay
to include them in the v2 commits. Let me know if you are okay with this
being included in the commits and/or if you want to test this series
again.

Reviewed-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Tested-by: Abel Vesa <abel.vesa@linaro.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,

I've Cc-ed you because I had pointed you to v1 of this series + the
patches in that thread at one point or another as a fix to some issue
you were facing. It'd appreciate it if you can test this series and
report any issues, or things it fixed and give Tested-bys.

In addition, if you can also apply a revert of this series[2] and delete
driver_deferred_probe_check_state() from your tree and see if you hit
any issues and report them, that'd be great too! I'm pretty sure some of
you will hit issues with that. I want to fix those next and then
revert[2].

Thanks,
Saravana

[1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
[2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
[3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/

v1 -> v2:
- Fixed Patch 1 to handle a corner case discussed in [3].
- New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
- New patch 11 to add fw_devlink support for SCMI devices.

Cc: Abel Vesa <abel.vesa@linaro.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: John Stultz <jstultz@google.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Maxim Kiselev <bigunclemax@gmail.com>
Cc: Maxim Kochetkov <fido_max@inbox.ru>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Luca Weiss <luca.weiss@fairphone.com>
Cc: Colin Foster <colin.foster@in-advantage.com>
Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: Jean-Philippe Brucker <jpb@kernel.org>

Saravana Kannan (11):
  driver core: fw_devlink: Don't purge child fwnode's consumer links
  driver core: fw_devlink: Improve check for fwnode with no
    device/driver
  soc: renesas: Move away from using OF_POPULATED for fw_devlink
  gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  driver core: fw_devlink: Allow marking a fwnode link as being part of
    a cycle
  driver core: fw_devlink: Consolidate device link flag computation
  driver core: fw_devlink: Make cycle detection more robust
  of: property: Simplify of_link_to_phandle()
  irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
  firmware: arm_scmi: Set fwnode for the scmi_device

 drivers/base/core.c             | 443 +++++++++++++++++++++-----------
 drivers/firmware/arm_scmi/bus.c |   2 +
 drivers/gpio/gpiolib.c          |   6 +
 drivers/irqchip/irq-imx-gpcv2.c |   1 +
 drivers/of/property.c           |  84 +-----
 drivers/soc/imx/gpcv2.c         |   1 +
 drivers/soc/renesas/rcar-sysc.c |   2 +-
 include/linux/device.h          |   1 +
 include/linux/fwnode.h          |  12 +-
 9 files changed, 332 insertions(+), 220 deletions(-)

-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

When a device X is bound successfully to a driver, if it has a child
firmware node Y that doesn't have a struct device created by then, we
delete fwnode links where the child firmware node Y is the supplier. We
did this to avoid blocking the consumers of the child firmware node Y
from deferring probe indefinitely.

While that a step in the right direction, it's better to make the
consumers of the child firmware node Y to be consumers of the device X
because device X is probably implementing whatever functionality is
represented by child firmware node Y. By doing this, we capture the
device dependencies more accurately and ensure better
probe/suspend/resume ordering.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 97 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 79 insertions(+), 18 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index a3e14143ec0c..b6d98cc82f26 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -54,11 +54,12 @@ static LIST_HEAD(deferred_sync);
 static unsigned int defer_sync_state_count = 1;
 static DEFINE_MUTEX(fwnode_link_lock);
 static bool fw_devlink_is_permissive(void);
+static void __fw_devlink_link_to_consumers(struct device *dev);
 static bool fw_devlink_drv_reg_done;
 static bool fw_devlink_best_effort;
 
 /**
- * fwnode_link_add - Create a link between two fwnode_handles.
+ * __fwnode_link_add - Create a link between two fwnode_handles.
  * @con: Consumer end of the link.
  * @sup: Supplier end of the link.
  *
@@ -74,22 +75,18 @@ static bool fw_devlink_best_effort;
  * Attempts to create duplicate links between the same pair of fwnode handles
  * are ignored and there is no reference counting.
  */
-int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
+static int __fwnode_link_add(struct fwnode_handle *con,
+			     struct fwnode_handle *sup)
 {
 	struct fwnode_link *link;
-	int ret = 0;
-
-	mutex_lock(&fwnode_link_lock);
 
 	list_for_each_entry(link, &sup->consumers, s_hook)
 		if (link->consumer == con)
-			goto out;
+			return 0;
 
 	link = kzalloc(sizeof(*link), GFP_KERNEL);
-	if (!link) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!link)
+		return -ENOMEM;
 
 	link->supplier = sup;
 	INIT_LIST_HEAD(&link->s_hook);
@@ -100,9 +97,17 @@ int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
 	list_add(&link->c_hook, &con->suppliers);
 	pr_debug("%pfwP Linked as a fwnode consumer to %pfwP\n",
 		 con, sup);
-out:
-	mutex_unlock(&fwnode_link_lock);
 
+	return 0;
+}
+
+int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
+{
+	int ret = 0;
+
+	mutex_lock(&fwnode_link_lock);
+	ret = __fwnode_link_add(con, sup);
+	mutex_unlock(&fwnode_link_lock);
 	return ret;
 }
 
@@ -181,6 +186,51 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(fw_devlink_purge_absent_suppliers);
 
+/**
+ * __fwnode_links_move_consumers - Move consumer from @from to @to fwnode_handle
+ * @from: move consumers away from this fwnode
+ * @to: move consumers to this fwnode
+ *
+ * Move all consumer links from @from fwnode to @to fwnode.
+ */
+static void __fwnode_links_move_consumers(struct fwnode_handle *from,
+					  struct fwnode_handle *to)
+{
+	struct fwnode_link *link, *tmp;
+
+	list_for_each_entry_safe(link, tmp, &from->consumers, s_hook) {
+		__fwnode_link_add(link->consumer, to);
+		__fwnode_link_del(link);
+	}
+}
+
+/**
+ * __fw_devlink_pickup_dangling_consumers - Pick up dangling consumers
+ * @fwnode: fwnode from which to pick up dangling consumers
+ * @new_sup: fwnode of new supplier
+ *
+ * If the @fwnode has a corresponding struct device and the device supports
+ * probing (that is, added to a bus), then we want to let fw_devlink create
+ * MANAGED device links to this device, so leave @fwnode and its descendant's
+ * fwnode links alone.
+ *
+ * Otherwise, move its consumers to the new supplier @new_sup.
+ */
+static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
+						   struct fwnode_handle *new_sup)
+{
+	struct fwnode_handle *child;
+
+	if (fwnode->dev && fwnode->dev->bus)
+		return;
+
+	fwnode->flags |= FWNODE_FLAG_NOT_DEVICE;
+	__fwnode_links_move_consumers(fwnode, new_sup);
+
+	fwnode_for_each_available_child_node(fwnode, child)
+		__fw_devlink_pickup_dangling_consumers(child, new_sup);
+}
+
 #ifdef CONFIG_SRCU
 static DEFINE_MUTEX(device_links_lock);
 DEFINE_STATIC_SRCU(device_links_srcu);
@@ -1267,16 +1317,23 @@ void device_links_driver_bound(struct device *dev)
 	 * them. So, fw_devlink no longer needs to create device links to any
 	 * of the device's suppliers.
 	 *
-	 * Also, if a child firmware node of this bound device is not added as
-	 * a device by now, assume it is never going to be added and make sure
-	 * other devices don't defer probe indefinitely by waiting for such a
-	 * child device.
+	 * Also, if a child firmware node of this bound device is not added as a
+	 * device by now, assume it is never going to be added. Make this bound
+	 * device the fallback supplier to the dangling consumers of the child
+	 * firmware node because this bound device is probably implementing the
+	 * child firmware node functionality and we don't want the dangling
+	 * consumers to defer probe indefinitely waiting for a device for the
+	 * child firmware node.
 	 */
 	if (dev->fwnode && dev->fwnode->dev == dev) {
 		struct fwnode_handle *child;
 		fwnode_links_purge_suppliers(dev->fwnode);
+		mutex_lock(&fwnode_link_lock);
 		fwnode_for_each_available_child_node(dev->fwnode, child)
-			fw_devlink_purge_absent_suppliers(child);
+			__fw_devlink_pickup_dangling_consumers(child,
+							       dev->fwnode);
+		__fw_devlink_link_to_consumers(dev);
+		mutex_unlock(&fwnode_link_lock);
 	}
 	device_remove_file(dev, &dev_attr_waiting_for_supplier);
 
@@ -1855,7 +1912,11 @@ static int fw_devlink_create_devlink(struct device *con,
 	    fwnode_is_ancestor_of(sup_handle, con->fwnode))
 		return -EINVAL;
 
-	sup_dev = get_dev_from_fwnode(sup_handle);
+	if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
+		sup_dev = fwnode_get_next_parent_dev(sup_handle);
+	else
+		sup_dev = get_dev_from_fwnode(sup_handle);
+
 	if (sup_dev) {
 		/*
 		 * If it's one of those drivers that don't actually bind to
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

When a device X is bound successfully to a driver, if it has a child
firmware node Y that doesn't have a struct device created by then, we
delete fwnode links where the child firmware node Y is the supplier. We
did this to avoid blocking the consumers of the child firmware node Y
from deferring probe indefinitely.

While that a step in the right direction, it's better to make the
consumers of the child firmware node Y to be consumers of the device X
because device X is probably implementing whatever functionality is
represented by child firmware node Y. By doing this, we capture the
device dependencies more accurately and ensure better
probe/suspend/resume ordering.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 97 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 79 insertions(+), 18 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index a3e14143ec0c..b6d98cc82f26 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -54,11 +54,12 @@ static LIST_HEAD(deferred_sync);
 static unsigned int defer_sync_state_count = 1;
 static DEFINE_MUTEX(fwnode_link_lock);
 static bool fw_devlink_is_permissive(void);
+static void __fw_devlink_link_to_consumers(struct device *dev);
 static bool fw_devlink_drv_reg_done;
 static bool fw_devlink_best_effort;
 
 /**
- * fwnode_link_add - Create a link between two fwnode_handles.
+ * __fwnode_link_add - Create a link between two fwnode_handles.
  * @con: Consumer end of the link.
  * @sup: Supplier end of the link.
  *
@@ -74,22 +75,18 @@ static bool fw_devlink_best_effort;
  * Attempts to create duplicate links between the same pair of fwnode handles
  * are ignored and there is no reference counting.
  */
-int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
+static int __fwnode_link_add(struct fwnode_handle *con,
+			     struct fwnode_handle *sup)
 {
 	struct fwnode_link *link;
-	int ret = 0;
-
-	mutex_lock(&fwnode_link_lock);
 
 	list_for_each_entry(link, &sup->consumers, s_hook)
 		if (link->consumer == con)
-			goto out;
+			return 0;
 
 	link = kzalloc(sizeof(*link), GFP_KERNEL);
-	if (!link) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!link)
+		return -ENOMEM;
 
 	link->supplier = sup;
 	INIT_LIST_HEAD(&link->s_hook);
@@ -100,9 +97,17 @@ int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
 	list_add(&link->c_hook, &con->suppliers);
 	pr_debug("%pfwP Linked as a fwnode consumer to %pfwP\n",
 		 con, sup);
-out:
-	mutex_unlock(&fwnode_link_lock);
 
+	return 0;
+}
+
+int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
+{
+	int ret = 0;
+
+	mutex_lock(&fwnode_link_lock);
+	ret = __fwnode_link_add(con, sup);
+	mutex_unlock(&fwnode_link_lock);
 	return ret;
 }
 
@@ -181,6 +186,51 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(fw_devlink_purge_absent_suppliers);
 
+/**
+ * __fwnode_links_move_consumers - Move consumer from @from to @to fwnode_handle
+ * @from: move consumers away from this fwnode
+ * @to: move consumers to this fwnode
+ *
+ * Move all consumer links from @from fwnode to @to fwnode.
+ */
+static void __fwnode_links_move_consumers(struct fwnode_handle *from,
+					  struct fwnode_handle *to)
+{
+	struct fwnode_link *link, *tmp;
+
+	list_for_each_entry_safe(link, tmp, &from->consumers, s_hook) {
+		__fwnode_link_add(link->consumer, to);
+		__fwnode_link_del(link);
+	}
+}
+
+/**
+ * __fw_devlink_pickup_dangling_consumers - Pick up dangling consumers
+ * @fwnode: fwnode from which to pick up dangling consumers
+ * @new_sup: fwnode of new supplier
+ *
+ * If the @fwnode has a corresponding struct device and the device supports
+ * probing (that is, added to a bus), then we want to let fw_devlink create
+ * MANAGED device links to this device, so leave @fwnode and its descendant's
+ * fwnode links alone.
+ *
+ * Otherwise, move its consumers to the new supplier @new_sup.
+ */
+static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
+						   struct fwnode_handle *new_sup)
+{
+	struct fwnode_handle *child;
+
+	if (fwnode->dev && fwnode->dev->bus)
+		return;
+
+	fwnode->flags |= FWNODE_FLAG_NOT_DEVICE;
+	__fwnode_links_move_consumers(fwnode, new_sup);
+
+	fwnode_for_each_available_child_node(fwnode, child)
+		__fw_devlink_pickup_dangling_consumers(child, new_sup);
+}
+
 #ifdef CONFIG_SRCU
 static DEFINE_MUTEX(device_links_lock);
 DEFINE_STATIC_SRCU(device_links_srcu);
@@ -1267,16 +1317,23 @@ void device_links_driver_bound(struct device *dev)
 	 * them. So, fw_devlink no longer needs to create device links to any
 	 * of the device's suppliers.
 	 *
-	 * Also, if a child firmware node of this bound device is not added as
-	 * a device by now, assume it is never going to be added and make sure
-	 * other devices don't defer probe indefinitely by waiting for such a
-	 * child device.
+	 * Also, if a child firmware node of this bound device is not added as a
+	 * device by now, assume it is never going to be added. Make this bound
+	 * device the fallback supplier to the dangling consumers of the child
+	 * firmware node because this bound device is probably implementing the
+	 * child firmware node functionality and we don't want the dangling
+	 * consumers to defer probe indefinitely waiting for a device for the
+	 * child firmware node.
 	 */
 	if (dev->fwnode && dev->fwnode->dev == dev) {
 		struct fwnode_handle *child;
 		fwnode_links_purge_suppliers(dev->fwnode);
+		mutex_lock(&fwnode_link_lock);
 		fwnode_for_each_available_child_node(dev->fwnode, child)
-			fw_devlink_purge_absent_suppliers(child);
+			__fw_devlink_pickup_dangling_consumers(child,
+							       dev->fwnode);
+		__fw_devlink_link_to_consumers(dev);
+		mutex_unlock(&fwnode_link_lock);
 	}
 	device_remove_file(dev, &dev_attr_waiting_for_supplier);
 
@@ -1855,7 +1912,11 @@ static int fw_devlink_create_devlink(struct device *con,
 	    fwnode_is_ancestor_of(sup_handle, con->fwnode))
 		return -EINVAL;
 
-	sup_dev = get_dev_from_fwnode(sup_handle);
+	if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
+		sup_dev = fwnode_get_next_parent_dev(sup_handle);
+	else
+		sup_dev = get_dev_from_fwnode(sup_handle);
+
 	if (sup_dev) {
 		/*
 		 * If it's one of those drivers that don't actually bind to
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 02/11] driver core: fw_devlink: Improve check for fwnode with no device/driver
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink shouldn't defer the probe of a device to wait on a supplier
that'll never have a struct device or will never be probed by a driver.
We currently check if a supplier falls into this category, but don't
check its ancestors. We need to check the ancestors too because if the
ancestor will never probe, then the supplier will never probe either.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b6d98cc82f26..919728e784e8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1867,6 +1867,35 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 	return ret;
 }
 
+static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct device *dev;
+	bool ret;
+
+	if (!(fwnode->flags & FWNODE_FLAG_INITIALIZED))
+		return false;
+
+	dev = get_dev_from_fwnode(fwnode);
+	ret = !dev || dev->links.status == DL_DEV_NO_DRIVER;
+	put_device(dev);
+
+	return ret;
+}
+
+static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct fwnode_handle *parent;
+
+	fwnode_for_each_parent_node(fwnode, parent) {
+		if (fwnode_init_without_drv(parent)) {
+			fwnode_handle_put(parent);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 /**
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
@@ -1948,9 +1977,16 @@ static int fw_devlink_create_devlink(struct device *con,
 		goto out;
 	}
 
-	/* Supplier that's already initialized without a struct device. */
-	if (sup_handle->flags & FWNODE_FLAG_INITIALIZED)
+	/*
+	 * Supplier or supplier's ancestor already initialized without a struct
+	 * device or being probed by a driver.
+	 */
+	if (fwnode_init_without_drv(sup_handle) ||
+	    fwnode_ancestor_init_without_drv(sup_handle)) {
+		dev_dbg(con, "Not linking %pfwP - Might never probe\n",
+			sup_handle);
 		return -EINVAL;
+	}
 
 	/*
 	 * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 02/11] driver core: fw_devlink: Improve check for fwnode with no device/driver
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink shouldn't defer the probe of a device to wait on a supplier
that'll never have a struct device or will never be probed by a driver.
We currently check if a supplier falls into this category, but don't
check its ancestors. We need to check the ancestors too because if the
ancestor will never probe, then the supplier will never probe either.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b6d98cc82f26..919728e784e8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1867,6 +1867,35 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 	return ret;
 }
 
+static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct device *dev;
+	bool ret;
+
+	if (!(fwnode->flags & FWNODE_FLAG_INITIALIZED))
+		return false;
+
+	dev = get_dev_from_fwnode(fwnode);
+	ret = !dev || dev->links.status == DL_DEV_NO_DRIVER;
+	put_device(dev);
+
+	return ret;
+}
+
+static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
+{
+	struct fwnode_handle *parent;
+
+	fwnode_for_each_parent_node(fwnode, parent) {
+		if (fwnode_init_without_drv(parent)) {
+			fwnode_handle_put(parent);
+			return true;
+		}
+	}
+
+	return false;
+}
+
 /**
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
@@ -1948,9 +1977,16 @@ static int fw_devlink_create_devlink(struct device *con,
 		goto out;
 	}
 
-	/* Supplier that's already initialized without a struct device. */
-	if (sup_handle->flags & FWNODE_FLAG_INITIALIZED)
+	/*
+	 * Supplier or supplier's ancestor already initialized without a struct
+	 * device or being probed by a driver.
+	 */
+	if (fwnode_init_without_drv(sup_handle) ||
+	    fwnode_ancestor_init_without_drv(sup_handle)) {
+		dev_dbg(con, "Not linking %pfwP - Might never probe\n",
+			sup_handle);
 		return -EINVAL;
+	}
 
 	/*
 	 * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

The OF_POPULATED flag was set to let fw_devlink know that the device
tree node will not have a struct device created for it. This information
is used by fw_devlink to avoid deferring the probe of consumers of this
device tree node.

Let's use fwnode_dev_initialized() instead because it achieves the same
effect without using OF specific flags. This allows more generic code to
be written in driver core.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/soc/renesas/rcar-sysc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index b0a80de34c98..03246ed4a79e 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
 
 	error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
 	if (!error)
-		of_node_set_flag(np, OF_POPULATED);
+		fwnode_dev_initialized(&np->fwnode, true);
 
 out_put:
 	of_node_put(np);
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

The OF_POPULATED flag was set to let fw_devlink know that the device
tree node will not have a struct device created for it. This information
is used by fw_devlink to avoid deferring the probe of consumers of this
device tree node.

Let's use fwnode_dev_initialized() instead because it achieves the same
effect without using OF specific flags. This allows more generic code to
be written in driver core.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/soc/renesas/rcar-sysc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index b0a80de34c98..03246ed4a79e 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
 
 	error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
 	if (!error)
-		of_node_set_flag(np, OF_POPULATED);
+		fwnode_dev_initialized(&np->fwnode, true);
 
 out_put:
 	of_node_put(np);
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Registering an irqdomain sets the flag for the fwnode. But having the
flag set when a device is added is interpreted by fw_devlink to mean the
device has already been initialized and will never probe. This prevents
fw_devlink from creating device links with the gpio_device as a
supplier. So, clear the flag before adding the device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 drivers/gpio/gpiolib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 939c776b9488..b23140c6485f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -578,6 +578,12 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
 {
 	int ret;
 
+	/*
+	 * If fwnode doesn't belong to another device, it's safe to clear its
+	 * initialized flag.
+	 */
+	if (!gdev->dev.fwnode->dev)
+		fwnode_dev_initialized(gdev->dev.fwnode, false);
 	ret = gcdev_register(gdev, gpio_devt);
 	if (ret)
 		return ret;
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Registering an irqdomain sets the flag for the fwnode. But having the
flag set when a device is added is interpreted by fw_devlink to mean the
device has already been initialized and will never probe. This prevents
fw_devlink from creating device links with the gpio_device as a
supplier. So, clear the flag before adding the device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 drivers/gpio/gpiolib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 939c776b9488..b23140c6485f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -578,6 +578,12 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
 {
 	int ret;
 
+	/*
+	 * If fwnode doesn't belong to another device, it's safe to clear its
+	 * initialized flag.
+	 */
+	if (!gdev->dev.fwnode->dev)
+		fwnode_dev_initialized(gdev->dev.fwnode, false);
 	ret = gcdev_register(gdev, gpio_devt);
 	if (ret)
 		return ret;
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
purposes:

1. To allow a parent device to proxy its child device's dependency on a
   supplier so that the supplier doesn't get its sync_state() callback
   before the child device/consumer can be added and probed. In this
   usage scenario, we need to ignore cycles for ensure correctness of
   sync_state() callbacks.

2. When there are dependency cycles in firmware, we don't know which of
   those dependencies are valid. So, we have to ignore them all wrt
   probe ordering while still making sure the sync_state() callbacks
   come correctly.

However, when detecting dependency cycles, there can be multiple
dependency cycles between two devices that we need to detect. For
example:

A -> B -> A and A -> C -> B -> A.

To detect multiple cycles correct, we need to be able to differentiate
DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.

To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
dependency cycles.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 28 ++++++++++++++++++----------
 include/linux/device.h |  1 +
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 919728e784e8..e5390b09a02f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -322,6 +322,12 @@ static bool device_is_ancestor(struct device *dev, struct device *target)
 	return false;
 }
 
+static inline bool device_link_flag_is_sync_state_only(u32 flags)
+{
+	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
+		== (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
+}
+
 /**
  * device_is_dependent - Check if one device depends on another one
  * @dev: Device to check dependencies for.
@@ -348,8 +354,7 @@ int device_is_dependent(struct device *dev, void *target)
 		return ret;
 
 	list_for_each_entry(link, &dev->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (device_link_flag_is_sync_state_only(link->flags))
 			continue;
 
 		if (link->consumer == target)
@@ -422,8 +427,7 @@ static int device_reorder_to_tail(struct device *dev, void *not_used)
 
 	device_for_each_child(dev, NULL, device_reorder_to_tail);
 	list_for_each_entry(link, &dev->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (device_link_flag_is_sync_state_only(link->flags))
 			continue;
 		device_reorder_to_tail(link->consumer, NULL);
 	}
@@ -684,7 +688,8 @@ postcore_initcall(devlink_class_init);
 			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
 			       DL_FLAG_AUTOPROBE_CONSUMER  | \
 			       DL_FLAG_SYNC_STATE_ONLY | \
-			       DL_FLAG_INFERRED)
+			       DL_FLAG_INFERRED | \
+			       DL_FLAG_CYCLE)
 
 #define DL_ADD_VALID_FLAGS (DL_MANAGED_LINK_FLAGS | DL_FLAG_STATELESS | \
 			    DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE)
@@ -753,8 +758,6 @@ struct device_link *device_link_add(struct device *consumer,
 	if (!consumer || !supplier || consumer == supplier ||
 	    flags & ~DL_ADD_VALID_FLAGS ||
 	    (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) ||
-	    (flags & DL_FLAG_SYNC_STATE_ONLY &&
-	     (flags & ~DL_FLAG_INFERRED) != DL_FLAG_SYNC_STATE_ONLY) ||
 	    (flags & DL_FLAG_AUTOPROBE_CONSUMER &&
 	     flags & (DL_FLAG_AUTOREMOVE_CONSUMER |
 		      DL_FLAG_AUTOREMOVE_SUPPLIER)))
@@ -770,6 +773,10 @@ struct device_link *device_link_add(struct device *consumer,
 	if (!(flags & DL_FLAG_STATELESS))
 		flags |= DL_FLAG_MANAGED;
 
+	if (flags & DL_FLAG_SYNC_STATE_ONLY &&
+	    !device_link_flag_is_sync_state_only(flags))
+		return NULL;
+
 	device_links_write_lock();
 	device_pm_lock();
 
@@ -1729,7 +1736,7 @@ static void fw_devlink_relax_link(struct device_link *link)
 	if (!(link->flags & DL_FLAG_INFERRED))
 		return;
 
-	if (link->flags == (DL_FLAG_MANAGED | FW_DEVLINK_FLAGS_PERMISSIVE))
+	if (device_link_flag_is_sync_state_only(link->flags))
 		return;
 
 	pm_runtime_drop_link(link);
@@ -1853,8 +1860,8 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 		return ret;
 
 	list_for_each_entry(link, &con->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (!(link->flags & DL_FLAG_CYCLE) &&
+		    device_link_flag_is_sync_state_only(link->flags))
 			continue;
 
 		if (!fw_devlink_relax_cycle(link->consumer, sup))
@@ -1863,6 +1870,7 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 		ret = 1;
 
 		fw_devlink_relax_link(link);
+		link->flags |= DL_FLAG_CYCLE;
 	}
 	return ret;
 }
diff --git a/include/linux/device.h b/include/linux/device.h
index 44e3acae7b36..f4d20655d2d7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -328,6 +328,7 @@ enum device_link_state {
 #define DL_FLAG_MANAGED			BIT(6)
 #define DL_FLAG_SYNC_STATE_ONLY		BIT(7)
 #define DL_FLAG_INFERRED		BIT(8)
+#define DL_FLAG_CYCLE			BIT(9)
 
 /**
  * enum dl_dev_state - Device driver presence tracking information.
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
purposes:

1. To allow a parent device to proxy its child device's dependency on a
   supplier so that the supplier doesn't get its sync_state() callback
   before the child device/consumer can be added and probed. In this
   usage scenario, we need to ignore cycles for ensure correctness of
   sync_state() callbacks.

2. When there are dependency cycles in firmware, we don't know which of
   those dependencies are valid. So, we have to ignore them all wrt
   probe ordering while still making sure the sync_state() callbacks
   come correctly.

However, when detecting dependency cycles, there can be multiple
dependency cycles between two devices that we need to detect. For
example:

A -> B -> A and A -> C -> B -> A.

To detect multiple cycles correct, we need to be able to differentiate
DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.

To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
dependency cycles.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 28 ++++++++++++++++++----------
 include/linux/device.h |  1 +
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 919728e784e8..e5390b09a02f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -322,6 +322,12 @@ static bool device_is_ancestor(struct device *dev, struct device *target)
 	return false;
 }
 
+static inline bool device_link_flag_is_sync_state_only(u32 flags)
+{
+	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
+		== (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
+}
+
 /**
  * device_is_dependent - Check if one device depends on another one
  * @dev: Device to check dependencies for.
@@ -348,8 +354,7 @@ int device_is_dependent(struct device *dev, void *target)
 		return ret;
 
 	list_for_each_entry(link, &dev->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (device_link_flag_is_sync_state_only(link->flags))
 			continue;
 
 		if (link->consumer == target)
@@ -422,8 +427,7 @@ static int device_reorder_to_tail(struct device *dev, void *not_used)
 
 	device_for_each_child(dev, NULL, device_reorder_to_tail);
 	list_for_each_entry(link, &dev->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (device_link_flag_is_sync_state_only(link->flags))
 			continue;
 		device_reorder_to_tail(link->consumer, NULL);
 	}
@@ -684,7 +688,8 @@ postcore_initcall(devlink_class_init);
 			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
 			       DL_FLAG_AUTOPROBE_CONSUMER  | \
 			       DL_FLAG_SYNC_STATE_ONLY | \
-			       DL_FLAG_INFERRED)
+			       DL_FLAG_INFERRED | \
+			       DL_FLAG_CYCLE)
 
 #define DL_ADD_VALID_FLAGS (DL_MANAGED_LINK_FLAGS | DL_FLAG_STATELESS | \
 			    DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE)
@@ -753,8 +758,6 @@ struct device_link *device_link_add(struct device *consumer,
 	if (!consumer || !supplier || consumer == supplier ||
 	    flags & ~DL_ADD_VALID_FLAGS ||
 	    (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) ||
-	    (flags & DL_FLAG_SYNC_STATE_ONLY &&
-	     (flags & ~DL_FLAG_INFERRED) != DL_FLAG_SYNC_STATE_ONLY) ||
 	    (flags & DL_FLAG_AUTOPROBE_CONSUMER &&
 	     flags & (DL_FLAG_AUTOREMOVE_CONSUMER |
 		      DL_FLAG_AUTOREMOVE_SUPPLIER)))
@@ -770,6 +773,10 @@ struct device_link *device_link_add(struct device *consumer,
 	if (!(flags & DL_FLAG_STATELESS))
 		flags |= DL_FLAG_MANAGED;
 
+	if (flags & DL_FLAG_SYNC_STATE_ONLY &&
+	    !device_link_flag_is_sync_state_only(flags))
+		return NULL;
+
 	device_links_write_lock();
 	device_pm_lock();
 
@@ -1729,7 +1736,7 @@ static void fw_devlink_relax_link(struct device_link *link)
 	if (!(link->flags & DL_FLAG_INFERRED))
 		return;
 
-	if (link->flags == (DL_FLAG_MANAGED | FW_DEVLINK_FLAGS_PERMISSIVE))
+	if (device_link_flag_is_sync_state_only(link->flags))
 		return;
 
 	pm_runtime_drop_link(link);
@@ -1853,8 +1860,8 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 		return ret;
 
 	list_for_each_entry(link, &con->links.consumers, s_node) {
-		if ((link->flags & ~DL_FLAG_INFERRED) ==
-		    (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
+		if (!(link->flags & DL_FLAG_CYCLE) &&
+		    device_link_flag_is_sync_state_only(link->flags))
 			continue;
 
 		if (!fw_devlink_relax_cycle(link->consumer, sup))
@@ -1863,6 +1870,7 @@ static int fw_devlink_relax_cycle(struct device *con, void *sup)
 		ret = 1;
 
 		fw_devlink_relax_link(link);
+		link->flags |= DL_FLAG_CYCLE;
 	}
 	return ret;
 }
diff --git a/include/linux/device.h b/include/linux/device.h
index 44e3acae7b36..f4d20655d2d7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -328,6 +328,7 @@ enum device_link_state {
 #define DL_FLAG_MANAGED			BIT(6)
 #define DL_FLAG_SYNC_STATE_ONLY		BIT(7)
 #define DL_FLAG_INFERRED		BIT(8)
+#define DL_FLAG_CYCLE			BIT(9)
 
 /**
  * enum dl_dev_state - Device driver presence tracking information.
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

To improve detection and handling of dependency cycles, we need to be
able to mark fwnode links as being part of cycles. fwnode links marked
as being part of a cycle should not block their consumers from probing.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 41 +++++++++++++++++++++++++++++++++++------
 include/linux/fwnode.h | 11 ++++++++++-
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index e5390b09a02f..82b29e9070bf 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -126,6 +126,19 @@ static void __fwnode_link_del(struct fwnode_link *link)
 	kfree(link);
 }
 
+/**
+ * __fwnode_link_cycle - Mark a fwnode link as being part of a cycle.
+ * @link: the fwnode_link to be marked
+ *
+ * The fwnode_link_lock needs to be held when this function is called.
+ */
+static void __fwnode_link_cycle(struct fwnode_link *link)
+{
+	pr_debug("%pfwf: Relaxing link with %pfwf\n",
+		 link->consumer, link->supplier);
+	link->flags |= FWLINK_FLAG_CYCLE;
+}
+
 /**
  * fwnode_links_purge_suppliers - Delete all supplier links of fwnode_handle.
  * @fwnode: fwnode whose supplier links need to be deleted
@@ -1041,6 +1054,23 @@ static bool dev_is_best_effort(struct device *dev)
 		(dev->fwnode && (dev->fwnode->flags & FWNODE_FLAG_BEST_EFFORT));
 }
 
+static struct fwnode_handle *fwnode_links_check_suppliers(
+						struct fwnode_handle *fwnode)
+{
+	struct fwnode_link *link;
+
+	if (!fwnode || fw_devlink_is_permissive())
+		return NULL;
+
+	list_for_each_entry(link, &fwnode->suppliers, c_hook) {
+		if (link->flags & FWLINK_FLAG_CYCLE)
+			continue;
+		return link->supplier;
+	}
+
+	return NULL;
+}
+
 /**
  * device_links_check_suppliers - Check presence of supplier drivers.
  * @dev: Consumer device.
@@ -1068,11 +1098,8 @@ int device_links_check_suppliers(struct device *dev)
 	 * probe.
 	 */
 	mutex_lock(&fwnode_link_lock);
-	if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
-	    !fw_devlink_is_permissive()) {
-		sup_fw = list_first_entry(&dev->fwnode->suppliers,
-					  struct fwnode_link,
-					  c_hook)->supplier;
+	sup_fw = fwnode_links_check_suppliers(dev->fwnode);
+	if (sup_fw) {
 		if (!dev_is_best_effort(dev)) {
 			fwnode_ret = -EPROBE_DEFER;
 			dev_err_probe(dev, -EPROBE_DEFER,
@@ -1261,7 +1288,9 @@ static ssize_t waiting_for_supplier_show(struct device *dev,
 	bool val;
 
 	device_lock(dev);
-	val = !list_empty(&dev->fwnode->suppliers);
+	mutex_lock(&fwnode_link_lock);
+	val = !!fwnode_links_check_suppliers(dev->fwnode);
+	mutex_unlock(&fwnode_link_lock);
 	device_unlock(dev);
 	return sysfs_emit(buf, "%u\n", val);
 }
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 89b9bdfca925..fdf2ee0285b7 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -18,7 +18,7 @@ struct fwnode_operations;
 struct device;
 
 /*
- * fwnode link flags
+ * fwnode flags
  *
  * LINKS_ADDED:	The fwnode has already be parsed to add fwnode links.
  * NOT_DEVICE:	The fwnode will never be populated as a struct device.
@@ -36,6 +36,7 @@ struct device;
 #define FWNODE_FLAG_INITIALIZED			BIT(2)
 #define FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD	BIT(3)
 #define FWNODE_FLAG_BEST_EFFORT			BIT(4)
+#define FWNODE_FLAG_VISITED			BIT(5)
 
 struct fwnode_handle {
 	struct fwnode_handle *secondary;
@@ -46,11 +47,19 @@ struct fwnode_handle {
 	u8 flags;
 };
 
+/*
+ * fwnode link flags
+ *
+ * CYCLE:	The fwnode link is part of a cycle. Don't defer probe.
+ */
+#define FWLINK_FLAG_CYCLE			BIT(0)
+
 struct fwnode_link {
 	struct fwnode_handle *supplier;
 	struct list_head s_hook;
 	struct fwnode_handle *consumer;
 	struct list_head c_hook;
+	u8 flags;
 };
 
 /**
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

To improve detection and handling of dependency cycles, we need to be
able to mark fwnode links as being part of cycles. fwnode links marked
as being part of a cycle should not block their consumers from probing.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 41 +++++++++++++++++++++++++++++++++++------
 include/linux/fwnode.h | 11 ++++++++++-
 2 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index e5390b09a02f..82b29e9070bf 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -126,6 +126,19 @@ static void __fwnode_link_del(struct fwnode_link *link)
 	kfree(link);
 }
 
+/**
+ * __fwnode_link_cycle - Mark a fwnode link as being part of a cycle.
+ * @link: the fwnode_link to be marked
+ *
+ * The fwnode_link_lock needs to be held when this function is called.
+ */
+static void __fwnode_link_cycle(struct fwnode_link *link)
+{
+	pr_debug("%pfwf: Relaxing link with %pfwf\n",
+		 link->consumer, link->supplier);
+	link->flags |= FWLINK_FLAG_CYCLE;
+}
+
 /**
  * fwnode_links_purge_suppliers - Delete all supplier links of fwnode_handle.
  * @fwnode: fwnode whose supplier links need to be deleted
@@ -1041,6 +1054,23 @@ static bool dev_is_best_effort(struct device *dev)
 		(dev->fwnode && (dev->fwnode->flags & FWNODE_FLAG_BEST_EFFORT));
 }
 
+static struct fwnode_handle *fwnode_links_check_suppliers(
+						struct fwnode_handle *fwnode)
+{
+	struct fwnode_link *link;
+
+	if (!fwnode || fw_devlink_is_permissive())
+		return NULL;
+
+	list_for_each_entry(link, &fwnode->suppliers, c_hook) {
+		if (link->flags & FWLINK_FLAG_CYCLE)
+			continue;
+		return link->supplier;
+	}
+
+	return NULL;
+}
+
 /**
  * device_links_check_suppliers - Check presence of supplier drivers.
  * @dev: Consumer device.
@@ -1068,11 +1098,8 @@ int device_links_check_suppliers(struct device *dev)
 	 * probe.
 	 */
 	mutex_lock(&fwnode_link_lock);
-	if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
-	    !fw_devlink_is_permissive()) {
-		sup_fw = list_first_entry(&dev->fwnode->suppliers,
-					  struct fwnode_link,
-					  c_hook)->supplier;
+	sup_fw = fwnode_links_check_suppliers(dev->fwnode);
+	if (sup_fw) {
 		if (!dev_is_best_effort(dev)) {
 			fwnode_ret = -EPROBE_DEFER;
 			dev_err_probe(dev, -EPROBE_DEFER,
@@ -1261,7 +1288,9 @@ static ssize_t waiting_for_supplier_show(struct device *dev,
 	bool val;
 
 	device_lock(dev);
-	val = !list_empty(&dev->fwnode->suppliers);
+	mutex_lock(&fwnode_link_lock);
+	val = !!fwnode_links_check_suppliers(dev->fwnode);
+	mutex_unlock(&fwnode_link_lock);
 	device_unlock(dev);
 	return sysfs_emit(buf, "%u\n", val);
 }
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 89b9bdfca925..fdf2ee0285b7 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -18,7 +18,7 @@ struct fwnode_operations;
 struct device;
 
 /*
- * fwnode link flags
+ * fwnode flags
  *
  * LINKS_ADDED:	The fwnode has already be parsed to add fwnode links.
  * NOT_DEVICE:	The fwnode will never be populated as a struct device.
@@ -36,6 +36,7 @@ struct device;
 #define FWNODE_FLAG_INITIALIZED			BIT(2)
 #define FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD	BIT(3)
 #define FWNODE_FLAG_BEST_EFFORT			BIT(4)
+#define FWNODE_FLAG_VISITED			BIT(5)
 
 struct fwnode_handle {
 	struct fwnode_handle *secondary;
@@ -46,11 +47,19 @@ struct fwnode_handle {
 	u8 flags;
 };
 
+/*
+ * fwnode link flags
+ *
+ * CYCLE:	The fwnode link is part of a cycle. Don't defer probe.
+ */
+#define FWLINK_FLAG_CYCLE			BIT(0)
+
 struct fwnode_link {
 	struct fwnode_handle *supplier;
 	struct list_head s_hook;
 	struct fwnode_handle *consumer;
 	struct list_head c_hook;
+	u8 flags;
 };
 
 /**
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 07/11] driver core: fw_devlink: Consolidate device link flag computation
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Consolidate the code that computes the flags to be used when creating a
device link from a fwnode link.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 28 +++++++++++++++-------------
 include/linux/fwnode.h |  1 -
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 82b29e9070bf..b61d5d86a600 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1726,8 +1726,11 @@ static int __init fw_devlink_strict_setup(char *arg)
 }
 early_param("fw_devlink.strict", fw_devlink_strict_setup);
 
-u32 fw_devlink_get_flags(void)
+static inline u32 fw_devlink_get_flags(u8 fwlink_flags)
 {
+	if (fwlink_flags & FWLINK_FLAG_CYCLE)
+		return FW_DEVLINK_FLAGS_PERMISSIVE | DL_FLAG_CYCLE;
+
 	return fw_devlink_flags;
 }
 
@@ -1937,7 +1940,7 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
  * @sup_handle: fwnode handle of supplier
- * @flags: devlink flags
+ * @link: fwnode link that's being converted to a device link
  *
  * This function will try to create a device link between the consumer device
  * @con and the supplier device represented by @sup_handle.
@@ -1954,10 +1957,17 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
  *  possible to do that in the future
  */
 static int fw_devlink_create_devlink(struct device *con,
-				     struct fwnode_handle *sup_handle, u32 flags)
+				     struct fwnode_handle *sup_handle,
+				     struct fwnode_link *link)
 {
 	struct device *sup_dev;
 	int ret = 0;
+	u32 flags;
+
+	if (con->fwnode == link->consumer)
+		flags = fw_devlink_get_flags(link->flags);
+	else
+		flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 
 	/*
 	 * In some cases, a device P might also be a supplier to its child node
@@ -2090,7 +2100,6 @@ static void __fw_devlink_link_to_consumers(struct device *dev)
 	struct fwnode_link *link, *tmp;
 
 	list_for_each_entry_safe(link, tmp, &fwnode->consumers, s_hook) {
-		u32 dl_flags = fw_devlink_get_flags();
 		struct device *con_dev;
 		bool own_link = true;
 		int ret;
@@ -2120,14 +2129,13 @@ static void __fw_devlink_link_to_consumers(struct device *dev)
 				con_dev = NULL;
 			} else {
 				own_link = false;
-				dl_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 			}
 		}
 
 		if (!con_dev)
 			continue;
 
-		ret = fw_devlink_create_devlink(con_dev, fwnode, dl_flags);
+		ret = fw_devlink_create_devlink(con_dev, fwnode, link);
 		put_device(con_dev);
 		if (!own_link || ret == -EAGAIN)
 			continue;
@@ -2168,19 +2176,13 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 	bool own_link = (dev->fwnode == fwnode);
 	struct fwnode_link *link, *tmp;
 	struct fwnode_handle *child = NULL;
-	u32 dl_flags;
-
-	if (own_link)
-		dl_flags = fw_devlink_get_flags();
-	else
-		dl_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 
 	list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook) {
 		int ret;
 		struct device *sup_dev;
 		struct fwnode_handle *sup = link->supplier;
 
-		ret = fw_devlink_create_devlink(dev, sup, dl_flags);
+		ret = fw_devlink_create_devlink(dev, sup, link);
 		if (!own_link || ret == -EAGAIN)
 			continue;
 
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index fdf2ee0285b7..5700451b300f 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -207,7 +207,6 @@ static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode,
 		fwnode->flags &= ~FWNODE_FLAG_INITIALIZED;
 }
 
-extern u32 fw_devlink_get_flags(void);
 extern bool fw_devlink_is_strict(void);
 int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup);
 void fwnode_links_purge(struct fwnode_handle *fwnode);
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 07/11] driver core: fw_devlink: Consolidate device link flag computation
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Consolidate the code that computes the flags to be used when creating a
device link from a fwnode link.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c    | 28 +++++++++++++++-------------
 include/linux/fwnode.h |  1 -
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 82b29e9070bf..b61d5d86a600 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1726,8 +1726,11 @@ static int __init fw_devlink_strict_setup(char *arg)
 }
 early_param("fw_devlink.strict", fw_devlink_strict_setup);
 
-u32 fw_devlink_get_flags(void)
+static inline u32 fw_devlink_get_flags(u8 fwlink_flags)
 {
+	if (fwlink_flags & FWLINK_FLAG_CYCLE)
+		return FW_DEVLINK_FLAGS_PERMISSIVE | DL_FLAG_CYCLE;
+
 	return fw_devlink_flags;
 }
 
@@ -1937,7 +1940,7 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
  * @sup_handle: fwnode handle of supplier
- * @flags: devlink flags
+ * @link: fwnode link that's being converted to a device link
  *
  * This function will try to create a device link between the consumer device
  * @con and the supplier device represented by @sup_handle.
@@ -1954,10 +1957,17 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
  *  possible to do that in the future
  */
 static int fw_devlink_create_devlink(struct device *con,
-				     struct fwnode_handle *sup_handle, u32 flags)
+				     struct fwnode_handle *sup_handle,
+				     struct fwnode_link *link)
 {
 	struct device *sup_dev;
 	int ret = 0;
+	u32 flags;
+
+	if (con->fwnode == link->consumer)
+		flags = fw_devlink_get_flags(link->flags);
+	else
+		flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 
 	/*
 	 * In some cases, a device P might also be a supplier to its child node
@@ -2090,7 +2100,6 @@ static void __fw_devlink_link_to_consumers(struct device *dev)
 	struct fwnode_link *link, *tmp;
 
 	list_for_each_entry_safe(link, tmp, &fwnode->consumers, s_hook) {
-		u32 dl_flags = fw_devlink_get_flags();
 		struct device *con_dev;
 		bool own_link = true;
 		int ret;
@@ -2120,14 +2129,13 @@ static void __fw_devlink_link_to_consumers(struct device *dev)
 				con_dev = NULL;
 			} else {
 				own_link = false;
-				dl_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 			}
 		}
 
 		if (!con_dev)
 			continue;
 
-		ret = fw_devlink_create_devlink(con_dev, fwnode, dl_flags);
+		ret = fw_devlink_create_devlink(con_dev, fwnode, link);
 		put_device(con_dev);
 		if (!own_link || ret == -EAGAIN)
 			continue;
@@ -2168,19 +2176,13 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 	bool own_link = (dev->fwnode == fwnode);
 	struct fwnode_link *link, *tmp;
 	struct fwnode_handle *child = NULL;
-	u32 dl_flags;
-
-	if (own_link)
-		dl_flags = fw_devlink_get_flags();
-	else
-		dl_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
 
 	list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook) {
 		int ret;
 		struct device *sup_dev;
 		struct fwnode_handle *sup = link->supplier;
 
-		ret = fw_devlink_create_devlink(dev, sup, dl_flags);
+		ret = fw_devlink_create_devlink(dev, sup, link);
 		if (!own_link || ret == -EAGAIN)
 			continue;
 
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index fdf2ee0285b7..5700451b300f 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -207,7 +207,6 @@ static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode,
 		fwnode->flags &= ~FWNODE_FLAG_INITIALIZED;
 }
 
-extern u32 fw_devlink_get_flags(void);
 extern bool fw_devlink_is_strict(void);
 int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup);
 void fwnode_links_purge(struct fwnode_handle *fwnode);
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink could only detect a single and simple cycle because it relied
mainly on device link cycle detection code that only checked for cycles
between devices. The expectation was that the firmware wouldn't have
complicated cycles and multiple cycles between devices. That expectation
has been proven to be wrong.

For example, fw_devlink could handle:

+-+        +-+
|A+------> |B+
+-+        +++
 ^          |
 |          |
 +----------+

But it couldn't handle even something as "simple" as:

 +---------------------+
 |                     |
 v                     |
+-+        +-+        +++
|A+------> |B+------> |C|
+-+        +++        +-+
 ^          |
 |          |
 +----------+

But firmware has even more complicated cycles like:

    +---------------------+
    |                     |
    v                     |
   +-+       +---+       +++
+--+A+------>| B +-----> |C|<--+
|  +-+       ++--+       +++   |
|   ^         | ^         |    |
|   |         | |         |    |
|   +---------+ +---------+    |
|                              |
+------------------------------+

And this is without including parent child dependencies or nodes in the
cycle that are just firmware nodes that'll never have a struct device
created for them.

The proper way to treat these devices it to not force any probe ordering
between them, while still enforce dependencies between node in the
cycles (A, B and C) and their consumers.

So this patch goes all out and just deals with all types of cycles. It
does this by:

1. Following dependencies across device links, parent-child and fwnode
   links.
2. When it find cycles, it mark the device links and fwnode links as
   such instead of just deleting them or making the indistinguishable
   from proxy SYNC_STATE_ONLY device links.

This way, when new nodes get added, we can immediately find and mark any
new cycles whether the new node is a device or firmware node.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 245 +++++++++++++++++++++++---------------------
 1 file changed, 130 insertions(+), 115 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b61d5d86a600..fbb843220458 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1865,47 +1865,6 @@ static void fw_devlink_unblock_consumers(struct device *dev)
 	device_links_write_unlock();
 }
 
-/**
- * fw_devlink_relax_cycle - Convert cyclic links to SYNC_STATE_ONLY links
- * @con: Device to check dependencies for.
- * @sup: Device to check against.
- *
- * Check if @sup depends on @con or any device dependent on it (its child or
- * its consumer etc).  When such a cyclic dependency is found, convert all
- * device links created solely by fw_devlink into SYNC_STATE_ONLY device links.
- * This is the equivalent of doing fw_devlink=permissive just between the
- * devices in the cycle. We need to do this because, at this point, fw_devlink
- * can't tell which of these dependencies is not a real dependency.
- *
- * Return 1 if a cycle is found. Otherwise, return 0.
- */
-static int fw_devlink_relax_cycle(struct device *con, void *sup)
-{
-	struct device_link *link;
-	int ret;
-
-	if (con == sup)
-		return 1;
-
-	ret = device_for_each_child(con, sup, fw_devlink_relax_cycle);
-	if (ret)
-		return ret;
-
-	list_for_each_entry(link, &con->links.consumers, s_node) {
-		if (!(link->flags & DL_FLAG_CYCLE) &&
-		    device_link_flag_is_sync_state_only(link->flags))
-			continue;
-
-		if (!fw_devlink_relax_cycle(link->consumer, sup))
-			continue;
-
-		ret = 1;
-
-		fw_devlink_relax_link(link);
-		link->flags |= DL_FLAG_CYCLE;
-	}
-	return ret;
-}
 
 static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
 {
@@ -1936,6 +1895,113 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
 	return false;
 }
 
+/**
+ * __fw_devlink_relax_cycles - Relax and mark dependency cycles.
+ * @con: Potential consumer device.
+ * @sup_handle: Potential supplier's fwnode.
+ *
+ * Needs to be called with fwnode_lock and device link lock held.
+ *
+ * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
+ * depend on @con.  This function can detect multiple cyles between @sup_handle
+ * and @con. When such dependency cycles are found, convert all device links
+ * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark
+ * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
+ * converted into a device link in the future, they are created as
+ * SYNC_STATE_ONLY device links.  This is the equivalent of doing
+ * fw_devlink=permissive just between the devices in the cycle. We need to do
+ * this because, at this point, fw_devlink can't tell which of these
+ * dependencies is not a real dependency.
+ *
+ * Return true if one or more cycles were found. Otherwise, return false.
+ */
+static bool __fw_devlink_relax_cycles(struct device *con,
+				 struct fwnode_handle *sup_handle)
+{
+	struct fwnode_link *link;
+	struct device_link *dev_link;
+	struct device *sup_dev = NULL, *par_dev = NULL;
+	bool ret = false;
+
+	if (!sup_handle)
+		return false;
+
+	/*
+	 * We aren't trying to find all cycles. Just a cycle between con and
+	 * sup_handle.
+	 */
+	if (sup_handle->flags & FWNODE_FLAG_VISITED)
+		return false;
+
+	sup_handle->flags |= FWNODE_FLAG_VISITED;
+
+	sup_dev = get_dev_from_fwnode(sup_handle);
+
+	/* Termination condition. */
+	if (sup_dev == con) {
+		ret = true;
+		goto out;
+	}
+
+	/*
+	 * If sup_dev is bound to a driver and @con hasn't started binding to
+	 * a driver, @sup_dev can't be a consumer of @con.  So, no need to
+	 * check further.
+	 */
+	if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&
+	    con->links.status == DL_DEV_NO_DRIVER) {
+		ret = false;
+		goto out;
+	}
+
+	list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
+		if (__fw_devlink_relax_cycles(con, link->supplier)) {
+			__fwnode_link_cycle(link);
+			ret = true;
+		}
+	}
+
+	/*
+	 * Give priority to device parent over fwnode parent to account for any
+	 * quirks in how fwnodes are converted to devices.
+	 */
+	if (sup_dev) {
+		par_dev = sup_dev->parent;
+		get_device(par_dev);
+	} else {
+		par_dev = fwnode_get_next_parent_dev(sup_handle);
+	}
+
+	if (par_dev)
+		ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);
+
+	if (!sup_dev)
+		goto out;
+
+	list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
+		/*
+		 * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
+		 * such due to a cycle.
+		 */
+		if (device_link_flag_is_sync_state_only(dev_link->flags) &&
+		    !(dev_link->flags & DL_FLAG_CYCLE))
+			continue;
+
+		if (__fw_devlink_relax_cycles(con,
+					      dev_link->supplier->fwnode)) {
+			fw_devlink_relax_link(dev_link);
+			dev_link->flags |= DL_FLAG_CYCLE;
+			ret = true;
+		}
+	}
+
+out:
+	sup_handle->flags &= ~FWNODE_FLAG_VISITED;
+	put_device(sup_dev);
+	put_device(par_dev);
+	return ret;
+}
+
 /**
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
@@ -1988,6 +2054,21 @@ static int fw_devlink_create_devlink(struct device *con,
 	    fwnode_is_ancestor_of(sup_handle, con->fwnode))
 		return -EINVAL;
 
+	/*
+	 * SYNC_STATE_ONLY device links don't block probing and supports cycles.
+	 * So cycle detection isn't necessary and shouldn't be done.
+	 */
+	if (!(flags & DL_FLAG_SYNC_STATE_ONLY)) {
+		device_links_write_lock();
+		if (__fw_devlink_relax_cycles(con, sup_handle)) {
+			__fwnode_link_cycle(link);
+			flags = fw_devlink_get_flags(link->flags);
+			dev_info(con, "Fixed dependency cycle(s) with %pfwf\n",
+				 sup_handle);
+		}
+		device_links_write_unlock();
+	}
+
 	if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
 		sup_dev = fwnode_get_next_parent_dev(sup_handle);
 	else
@@ -2001,23 +2082,16 @@ static int fw_devlink_create_devlink(struct device *con,
 		 */
 		if (sup_dev->links.status == DL_DEV_NO_DRIVER &&
 		    sup_handle->flags & FWNODE_FLAG_INITIALIZED) {
+			dev_dbg(con,
+				"Not linking %pfwf - dev might never probe\n",
+				sup_handle);
 			ret = -EINVAL;
 			goto out;
 		}
 
-		/*
-		 * If this fails, it is due to cycles in device links.  Just
-		 * give up on this link and treat it as invalid.
-		 */
-		if (!device_link_add(con, sup_dev, flags) &&
-		    !(flags & DL_FLAG_SYNC_STATE_ONLY)) {
-			dev_info(con, "Fixing up cyclic dependency with %s\n",
-				 dev_name(sup_dev));
-			device_links_write_lock();
-			fw_devlink_relax_cycle(con, sup_dev);
-			device_links_write_unlock();
-			device_link_add(con, sup_dev,
-					FW_DEVLINK_FLAGS_PERMISSIVE);
+		if (!device_link_add(con, sup_dev, flags)) {
+			dev_err(con, "Failed to create device link with %s\n",
+				dev_name(sup_dev));
 			ret = -EINVAL;
 		}
 
@@ -2030,49 +2104,12 @@ static int fw_devlink_create_devlink(struct device *con,
 	 */
 	if (fwnode_init_without_drv(sup_handle) ||
 	    fwnode_ancestor_init_without_drv(sup_handle)) {
-		dev_dbg(con, "Not linking %pfwP - Might never probe\n",
+		dev_dbg(con, "Not linking %pfwf - might never become dev\n",
 			sup_handle);
 		return -EINVAL;
 	}
 
-	/*
-	 * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
-	 * cycles. So cycle detection isn't necessary and shouldn't be
-	 * done.
-	 */
-	if (flags & DL_FLAG_SYNC_STATE_ONLY)
-		return -EAGAIN;
-
-	/*
-	 * If we can't find the supplier device from its fwnode, it might be
-	 * due to a cyclic dependency between fwnodes. Some of these cycles can
-	 * be broken by applying logic. Check for these types of cycles and
-	 * break them so that devices in the cycle probe properly.
-	 *
-	 * If the supplier's parent is dependent on the consumer, then the
-	 * consumer and supplier have a cyclic dependency. Since fw_devlink
-	 * can't tell which of the inferred dependencies are incorrect, don't
-	 * enforce probe ordering between any of the devices in this cyclic
-	 * dependency. Do this by relaxing all the fw_devlink device links in
-	 * this cycle and by treating the fwnode link between the consumer and
-	 * the supplier as an invalid dependency.
-	 */
-	sup_dev = fwnode_get_next_parent_dev(sup_handle);
-	if (sup_dev && device_is_dependent(con, sup_dev)) {
-		dev_info(con, "Fixing up cyclic dependency with %pfwP (%s)\n",
-			 sup_handle, dev_name(sup_dev));
-		device_links_write_lock();
-		fw_devlink_relax_cycle(con, sup_dev);
-		device_links_write_unlock();
-		ret = -EINVAL;
-	} else {
-		/*
-		 * Can't check for cycles or no cycles. So let's try
-		 * again later.
-		 */
-		ret = -EAGAIN;
-	}
-
+	ret = -EAGAIN;
 out:
 	put_device(sup_dev);
 	return ret;
@@ -2179,7 +2216,6 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 
 	list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook) {
 		int ret;
-		struct device *sup_dev;
 		struct fwnode_handle *sup = link->supplier;
 
 		ret = fw_devlink_create_devlink(dev, sup, link);
@@ -2187,27 +2223,6 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 			continue;
 
 		__fwnode_link_del(link);
-
-		/* If no device link was created, nothing more to do. */
-		if (ret)
-			continue;
-
-		/*
-		 * If a device link was successfully created to a supplier, we
-		 * now need to try and link the supplier to all its suppliers.
-		 *
-		 * This is needed to detect and delete false dependencies in
-		 * fwnode links that haven't been converted to a device link
-		 * yet. See comments in fw_devlink_create_devlink() for more
-		 * details on the false dependency.
-		 *
-		 * Without deleting these false dependencies, some devices will
-		 * never probe because they'll keep waiting for their false
-		 * dependency fwnode links to be converted to device links.
-		 */
-		sup_dev = get_dev_from_fwnode(sup);
-		__fw_devlink_link_to_suppliers(sup_dev, sup_dev->fwnode);
-		put_device(sup_dev);
 	}
 
 	/*
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

fw_devlink could only detect a single and simple cycle because it relied
mainly on device link cycle detection code that only checked for cycles
between devices. The expectation was that the firmware wouldn't have
complicated cycles and multiple cycles between devices. That expectation
has been proven to be wrong.

For example, fw_devlink could handle:

+-+        +-+
|A+------> |B+
+-+        +++
 ^          |
 |          |
 +----------+

But it couldn't handle even something as "simple" as:

 +---------------------+
 |                     |
 v                     |
+-+        +-+        +++
|A+------> |B+------> |C|
+-+        +++        +-+
 ^          |
 |          |
 +----------+

But firmware has even more complicated cycles like:

    +---------------------+
    |                     |
    v                     |
   +-+       +---+       +++
+--+A+------>| B +-----> |C|<--+
|  +-+       ++--+       +++   |
|   ^         | ^         |    |
|   |         | |         |    |
|   +---------+ +---------+    |
|                              |
+------------------------------+

And this is without including parent child dependencies or nodes in the
cycle that are just firmware nodes that'll never have a struct device
created for them.

The proper way to treat these devices it to not force any probe ordering
between them, while still enforce dependencies between node in the
cycles (A, B and C) and their consumers.

So this patch goes all out and just deals with all types of cycles. It
does this by:

1. Following dependencies across device links, parent-child and fwnode
   links.
2. When it find cycles, it mark the device links and fwnode links as
   such instead of just deleting them or making the indistinguishable
   from proxy SYNC_STATE_ONLY device links.

This way, when new nodes get added, we can immediately find and mark any
new cycles whether the new node is a device or firmware node.

Fixes: 2de9d8e0d2fe ("driver core: fw_devlink: Improve handling of cyclic dependencies")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 245 +++++++++++++++++++++++---------------------
 1 file changed, 130 insertions(+), 115 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index b61d5d86a600..fbb843220458 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1865,47 +1865,6 @@ static void fw_devlink_unblock_consumers(struct device *dev)
 	device_links_write_unlock();
 }
 
-/**
- * fw_devlink_relax_cycle - Convert cyclic links to SYNC_STATE_ONLY links
- * @con: Device to check dependencies for.
- * @sup: Device to check against.
- *
- * Check if @sup depends on @con or any device dependent on it (its child or
- * its consumer etc).  When such a cyclic dependency is found, convert all
- * device links created solely by fw_devlink into SYNC_STATE_ONLY device links.
- * This is the equivalent of doing fw_devlink=permissive just between the
- * devices in the cycle. We need to do this because, at this point, fw_devlink
- * can't tell which of these dependencies is not a real dependency.
- *
- * Return 1 if a cycle is found. Otherwise, return 0.
- */
-static int fw_devlink_relax_cycle(struct device *con, void *sup)
-{
-	struct device_link *link;
-	int ret;
-
-	if (con == sup)
-		return 1;
-
-	ret = device_for_each_child(con, sup, fw_devlink_relax_cycle);
-	if (ret)
-		return ret;
-
-	list_for_each_entry(link, &con->links.consumers, s_node) {
-		if (!(link->flags & DL_FLAG_CYCLE) &&
-		    device_link_flag_is_sync_state_only(link->flags))
-			continue;
-
-		if (!fw_devlink_relax_cycle(link->consumer, sup))
-			continue;
-
-		ret = 1;
-
-		fw_devlink_relax_link(link);
-		link->flags |= DL_FLAG_CYCLE;
-	}
-	return ret;
-}
 
 static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
 {
@@ -1936,6 +1895,113 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
 	return false;
 }
 
+/**
+ * __fw_devlink_relax_cycles - Relax and mark dependency cycles.
+ * @con: Potential consumer device.
+ * @sup_handle: Potential supplier's fwnode.
+ *
+ * Needs to be called with fwnode_lock and device link lock held.
+ *
+ * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
+ * depend on @con.  This function can detect multiple cyles between @sup_handle
+ * and @con. When such dependency cycles are found, convert all device links
+ * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark
+ * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
+ * converted into a device link in the future, they are created as
+ * SYNC_STATE_ONLY device links.  This is the equivalent of doing
+ * fw_devlink=permissive just between the devices in the cycle. We need to do
+ * this because, at this point, fw_devlink can't tell which of these
+ * dependencies is not a real dependency.
+ *
+ * Return true if one or more cycles were found. Otherwise, return false.
+ */
+static bool __fw_devlink_relax_cycles(struct device *con,
+				 struct fwnode_handle *sup_handle)
+{
+	struct fwnode_link *link;
+	struct device_link *dev_link;
+	struct device *sup_dev = NULL, *par_dev = NULL;
+	bool ret = false;
+
+	if (!sup_handle)
+		return false;
+
+	/*
+	 * We aren't trying to find all cycles. Just a cycle between con and
+	 * sup_handle.
+	 */
+	if (sup_handle->flags & FWNODE_FLAG_VISITED)
+		return false;
+
+	sup_handle->flags |= FWNODE_FLAG_VISITED;
+
+	sup_dev = get_dev_from_fwnode(sup_handle);
+
+	/* Termination condition. */
+	if (sup_dev == con) {
+		ret = true;
+		goto out;
+	}
+
+	/*
+	 * If sup_dev is bound to a driver and @con hasn't started binding to
+	 * a driver, @sup_dev can't be a consumer of @con.  So, no need to
+	 * check further.
+	 */
+	if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&
+	    con->links.status == DL_DEV_NO_DRIVER) {
+		ret = false;
+		goto out;
+	}
+
+	list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
+		if (__fw_devlink_relax_cycles(con, link->supplier)) {
+			__fwnode_link_cycle(link);
+			ret = true;
+		}
+	}
+
+	/*
+	 * Give priority to device parent over fwnode parent to account for any
+	 * quirks in how fwnodes are converted to devices.
+	 */
+	if (sup_dev) {
+		par_dev = sup_dev->parent;
+		get_device(par_dev);
+	} else {
+		par_dev = fwnode_get_next_parent_dev(sup_handle);
+	}
+
+	if (par_dev)
+		ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);
+
+	if (!sup_dev)
+		goto out;
+
+	list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
+		/*
+		 * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
+		 * such due to a cycle.
+		 */
+		if (device_link_flag_is_sync_state_only(dev_link->flags) &&
+		    !(dev_link->flags & DL_FLAG_CYCLE))
+			continue;
+
+		if (__fw_devlink_relax_cycles(con,
+					      dev_link->supplier->fwnode)) {
+			fw_devlink_relax_link(dev_link);
+			dev_link->flags |= DL_FLAG_CYCLE;
+			ret = true;
+		}
+	}
+
+out:
+	sup_handle->flags &= ~FWNODE_FLAG_VISITED;
+	put_device(sup_dev);
+	put_device(par_dev);
+	return ret;
+}
+
 /**
  * fw_devlink_create_devlink - Create a device link from a consumer to fwnode
  * @con: consumer device for the device link
@@ -1988,6 +2054,21 @@ static int fw_devlink_create_devlink(struct device *con,
 	    fwnode_is_ancestor_of(sup_handle, con->fwnode))
 		return -EINVAL;
 
+	/*
+	 * SYNC_STATE_ONLY device links don't block probing and supports cycles.
+	 * So cycle detection isn't necessary and shouldn't be done.
+	 */
+	if (!(flags & DL_FLAG_SYNC_STATE_ONLY)) {
+		device_links_write_lock();
+		if (__fw_devlink_relax_cycles(con, sup_handle)) {
+			__fwnode_link_cycle(link);
+			flags = fw_devlink_get_flags(link->flags);
+			dev_info(con, "Fixed dependency cycle(s) with %pfwf\n",
+				 sup_handle);
+		}
+		device_links_write_unlock();
+	}
+
 	if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
 		sup_dev = fwnode_get_next_parent_dev(sup_handle);
 	else
@@ -2001,23 +2082,16 @@ static int fw_devlink_create_devlink(struct device *con,
 		 */
 		if (sup_dev->links.status == DL_DEV_NO_DRIVER &&
 		    sup_handle->flags & FWNODE_FLAG_INITIALIZED) {
+			dev_dbg(con,
+				"Not linking %pfwf - dev might never probe\n",
+				sup_handle);
 			ret = -EINVAL;
 			goto out;
 		}
 
-		/*
-		 * If this fails, it is due to cycles in device links.  Just
-		 * give up on this link and treat it as invalid.
-		 */
-		if (!device_link_add(con, sup_dev, flags) &&
-		    !(flags & DL_FLAG_SYNC_STATE_ONLY)) {
-			dev_info(con, "Fixing up cyclic dependency with %s\n",
-				 dev_name(sup_dev));
-			device_links_write_lock();
-			fw_devlink_relax_cycle(con, sup_dev);
-			device_links_write_unlock();
-			device_link_add(con, sup_dev,
-					FW_DEVLINK_FLAGS_PERMISSIVE);
+		if (!device_link_add(con, sup_dev, flags)) {
+			dev_err(con, "Failed to create device link with %s\n",
+				dev_name(sup_dev));
 			ret = -EINVAL;
 		}
 
@@ -2030,49 +2104,12 @@ static int fw_devlink_create_devlink(struct device *con,
 	 */
 	if (fwnode_init_without_drv(sup_handle) ||
 	    fwnode_ancestor_init_without_drv(sup_handle)) {
-		dev_dbg(con, "Not linking %pfwP - Might never probe\n",
+		dev_dbg(con, "Not linking %pfwf - might never become dev\n",
 			sup_handle);
 		return -EINVAL;
 	}
 
-	/*
-	 * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports
-	 * cycles. So cycle detection isn't necessary and shouldn't be
-	 * done.
-	 */
-	if (flags & DL_FLAG_SYNC_STATE_ONLY)
-		return -EAGAIN;
-
-	/*
-	 * If we can't find the supplier device from its fwnode, it might be
-	 * due to a cyclic dependency between fwnodes. Some of these cycles can
-	 * be broken by applying logic. Check for these types of cycles and
-	 * break them so that devices in the cycle probe properly.
-	 *
-	 * If the supplier's parent is dependent on the consumer, then the
-	 * consumer and supplier have a cyclic dependency. Since fw_devlink
-	 * can't tell which of the inferred dependencies are incorrect, don't
-	 * enforce probe ordering between any of the devices in this cyclic
-	 * dependency. Do this by relaxing all the fw_devlink device links in
-	 * this cycle and by treating the fwnode link between the consumer and
-	 * the supplier as an invalid dependency.
-	 */
-	sup_dev = fwnode_get_next_parent_dev(sup_handle);
-	if (sup_dev && device_is_dependent(con, sup_dev)) {
-		dev_info(con, "Fixing up cyclic dependency with %pfwP (%s)\n",
-			 sup_handle, dev_name(sup_dev));
-		device_links_write_lock();
-		fw_devlink_relax_cycle(con, sup_dev);
-		device_links_write_unlock();
-		ret = -EINVAL;
-	} else {
-		/*
-		 * Can't check for cycles or no cycles. So let's try
-		 * again later.
-		 */
-		ret = -EAGAIN;
-	}
-
+	ret = -EAGAIN;
 out:
 	put_device(sup_dev);
 	return ret;
@@ -2179,7 +2216,6 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 
 	list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook) {
 		int ret;
-		struct device *sup_dev;
 		struct fwnode_handle *sup = link->supplier;
 
 		ret = fw_devlink_create_devlink(dev, sup, link);
@@ -2187,27 +2223,6 @@ static void __fw_devlink_link_to_suppliers(struct device *dev,
 			continue;
 
 		__fwnode_link_del(link);
-
-		/* If no device link was created, nothing more to do. */
-		if (ret)
-			continue;
-
-		/*
-		 * If a device link was successfully created to a supplier, we
-		 * now need to try and link the supplier to all its suppliers.
-		 *
-		 * This is needed to detect and delete false dependencies in
-		 * fwnode links that haven't been converted to a device link
-		 * yet. See comments in fw_devlink_create_devlink() for more
-		 * details on the false dependency.
-		 *
-		 * Without deleting these false dependencies, some devices will
-		 * never probe because they'll keep waiting for their false
-		 * dependency fwnode links to be converted to device links.
-		 */
-		sup_dev = get_dev_from_fwnode(sup);
-		__fw_devlink_link_to_suppliers(sup_dev, sup_dev->fwnode);
-		put_device(sup_dev);
 	}
 
 	/*
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

The driver core now:
- Has the parent device of a supplier pick up the consumers if the
  supplier never has a device created for it.
- Ignores a supplier if the supplier has no parent device and will never
  be probed by a driver

And already prevents creating a device link with the consumer as a
supplier of a parent.

So, we no longer need to find the "compatible" node of the supplier or
do any other checks in of_link_to_phandle(). We simply need to make sure
that the supplier is available in DT.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/of/property.c | 84 +++++++------------------------------------
 1 file changed, 13 insertions(+), 71 deletions(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 134cfc980b70..c651aad6f34b 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
 	return of_device_get_match_data(dev);
 }
 
-static bool of_is_ancestor_of(struct device_node *test_ancestor,
-			      struct device_node *child)
-{
-	of_node_get(child);
-	while (child) {
-		if (child == test_ancestor) {
-			of_node_put(child);
-			return true;
-		}
-		child = of_get_next_parent(child);
-	}
-	return false;
-}
-
 static struct device_node *of_get_compat_node(struct device_node *np)
 {
 	of_node_get(np);
@@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
 	return node;
 }
 
-/**
- * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
- * @con_np: consumer device tree node
- * @sup_np: supplier device tree node
- *
- * Given a phandle to a supplier device tree node (@sup_np), this function
- * finds the device that owns the supplier device tree node and creates a
- * device link from @dev consumer device to the supplier device. This function
- * doesn't create device links for invalid scenarios such as trying to create a
- * link with a parent device as the consumer of its child device. In such
- * cases, it returns an error.
- *
- * Returns:
- * - 0 if fwnode link successfully created to supplier
- * - -EINVAL if the supplier link is invalid and should not be created
- * - -ENODEV if struct device will never be create for supplier
- */
-static int of_link_to_phandle(struct device_node *con_np,
+static void of_link_to_phandle(struct device_node *con_np,
 			      struct device_node *sup_np)
 {
-	struct device *sup_dev;
-	struct device_node *tmp_np = sup_np;
+	struct device_node *tmp_np = of_node_get(sup_np);
 
-	/*
-	 * Find the device node that contains the supplier phandle.  It may be
-	 * @sup_np or it may be an ancestor of @sup_np.
-	 */
-	sup_np = of_get_compat_node(sup_np);
-	if (!sup_np) {
-		pr_debug("Not linking %pOFP to %pOFP - No device\n",
-			 con_np, tmp_np);
-		return -ENODEV;
-	}
+	/* Check that sup_np and its ancestors are available. */
+	while (tmp_np) {
+		if (of_fwnode_handle(tmp_np)->dev) {
+			of_node_put(tmp_np);
+			break;
+		}
 
-	/*
-	 * Don't allow linking a device node as a consumer of one of its
-	 * descendant nodes. By definition, a child node can't be a functional
-	 * dependency for the parent node.
-	 */
-	if (of_is_ancestor_of(con_np, sup_np)) {
-		pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
-			 con_np, sup_np);
-		of_node_put(sup_np);
-		return -EINVAL;
-	}
+		if (!of_device_is_available(tmp_np)) {
+			of_node_put(tmp_np);
+			return;
+		}
 
-	/*
-	 * Don't create links to "early devices" that won't have struct devices
-	 * created for them.
-	 */
-	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-	if (!sup_dev &&
-	    (of_node_check_flag(sup_np, OF_POPULATED) ||
-	     sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
-		pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
-			 con_np, sup_np);
-		of_node_put(sup_np);
-		return -ENODEV;
+		tmp_np = of_get_next_parent(tmp_np);
 	}
-	put_device(sup_dev);
 
 	fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));
-	of_node_put(sup_np);
-
-	return 0;
 }
 
 /**
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

The driver core now:
- Has the parent device of a supplier pick up the consumers if the
  supplier never has a device created for it.
- Ignores a supplier if the supplier has no parent device and will never
  be probed by a driver

And already prevents creating a device link with the consumer as a
supplier of a parent.

So, we no longer need to find the "compatible" node of the supplier or
do any other checks in of_link_to_phandle(). We simply need to make sure
that the supplier is available in DT.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/of/property.c | 84 +++++++------------------------------------
 1 file changed, 13 insertions(+), 71 deletions(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 134cfc980b70..c651aad6f34b 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
 	return of_device_get_match_data(dev);
 }
 
-static bool of_is_ancestor_of(struct device_node *test_ancestor,
-			      struct device_node *child)
-{
-	of_node_get(child);
-	while (child) {
-		if (child == test_ancestor) {
-			of_node_put(child);
-			return true;
-		}
-		child = of_get_next_parent(child);
-	}
-	return false;
-}
-
 static struct device_node *of_get_compat_node(struct device_node *np)
 {
 	of_node_get(np);
@@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
 	return node;
 }
 
-/**
- * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
- * @con_np: consumer device tree node
- * @sup_np: supplier device tree node
- *
- * Given a phandle to a supplier device tree node (@sup_np), this function
- * finds the device that owns the supplier device tree node and creates a
- * device link from @dev consumer device to the supplier device. This function
- * doesn't create device links for invalid scenarios such as trying to create a
- * link with a parent device as the consumer of its child device. In such
- * cases, it returns an error.
- *
- * Returns:
- * - 0 if fwnode link successfully created to supplier
- * - -EINVAL if the supplier link is invalid and should not be created
- * - -ENODEV if struct device will never be create for supplier
- */
-static int of_link_to_phandle(struct device_node *con_np,
+static void of_link_to_phandle(struct device_node *con_np,
 			      struct device_node *sup_np)
 {
-	struct device *sup_dev;
-	struct device_node *tmp_np = sup_np;
+	struct device_node *tmp_np = of_node_get(sup_np);
 
-	/*
-	 * Find the device node that contains the supplier phandle.  It may be
-	 * @sup_np or it may be an ancestor of @sup_np.
-	 */
-	sup_np = of_get_compat_node(sup_np);
-	if (!sup_np) {
-		pr_debug("Not linking %pOFP to %pOFP - No device\n",
-			 con_np, tmp_np);
-		return -ENODEV;
-	}
+	/* Check that sup_np and its ancestors are available. */
+	while (tmp_np) {
+		if (of_fwnode_handle(tmp_np)->dev) {
+			of_node_put(tmp_np);
+			break;
+		}
 
-	/*
-	 * Don't allow linking a device node as a consumer of one of its
-	 * descendant nodes. By definition, a child node can't be a functional
-	 * dependency for the parent node.
-	 */
-	if (of_is_ancestor_of(con_np, sup_np)) {
-		pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
-			 con_np, sup_np);
-		of_node_put(sup_np);
-		return -EINVAL;
-	}
+		if (!of_device_is_available(tmp_np)) {
+			of_node_put(tmp_np);
+			return;
+		}
 
-	/*
-	 * Don't create links to "early devices" that won't have struct devices
-	 * created for them.
-	 */
-	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
-	if (!sup_dev &&
-	    (of_node_check_flag(sup_np, OF_POPULATED) ||
-	     sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
-		pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
-			 con_np, sup_np);
-		of_node_put(sup_np);
-		return -ENODEV;
+		tmp_np = of_get_next_parent(tmp_np);
 	}
-	put_device(sup_dev);
 
 	fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));
-	of_node_put(sup_np);
-
-	return 0;
 }
 
 /**
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Since this device is only partially initialized by the irqchip driver,
we need to mark the fwnode device as not initialized. This is to let
fw_devlink know that the device will be completely initialized at a
later point. That way, fw_devlink will continue to defer the probe of
the power domain consumers till the power domain driver successfully
binds to the struct device and completes the initialization of the
device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/irqchip/irq-imx-gpcv2.c | 1 +
 drivers/soc/imx/gpcv2.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c
index b9c22f764b4d..8a0e82067924 100644
--- a/drivers/irqchip/irq-imx-gpcv2.c
+++ b/drivers/irqchip/irq-imx-gpcv2.c
@@ -283,6 +283,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
 	 * later the GPC power domain driver will not be skipped.
 	 */
 	of_node_clear_flag(node, OF_POPULATED);
+	fwnode_dev_initialized(domain->fwnode, false);
 	return 0;
 }
 
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 7a47d14fde44..b24f9ab634dc 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -1519,6 +1519,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
 
 		pd_pdev->dev.parent = dev;
 		pd_pdev->dev.of_node = np;
+		pd_pdev->dev.fwnode = of_fwnode_handle(np);
 
 		ret = platform_device_add(pd_pdev);
 		if (ret) {
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Since this device is only partially initialized by the irqchip driver,
we need to mark the fwnode device as not initialized. This is to let
fw_devlink know that the device will be completely initialized at a
later point. That way, fw_devlink will continue to defer the probe of
the power domain consumers till the power domain driver successfully
binds to the struct device and completes the initialization of the
device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/irqchip/irq-imx-gpcv2.c | 1 +
 drivers/soc/imx/gpcv2.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c
index b9c22f764b4d..8a0e82067924 100644
--- a/drivers/irqchip/irq-imx-gpcv2.c
+++ b/drivers/irqchip/irq-imx-gpcv2.c
@@ -283,6 +283,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
 	 * later the GPC power domain driver will not be skipped.
 	 */
 	of_node_clear_flag(node, OF_POPULATED);
+	fwnode_dev_initialized(domain->fwnode, false);
 	return 0;
 }
 
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 7a47d14fde44..b24f9ab634dc 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -1519,6 +1519,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
 
 		pd_pdev->dev.parent = dev;
 		pd_pdev->dev.of_node = np;
+		pd_pdev->dev.fwnode = of_fwnode_handle(np);
 
 		ret = platform_device_add(pd_pdev);
 		if (ret) {
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27  0:11   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

This allows fw_devlink to track and enforce supplier-consumer
dependencies for scmi_device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/firmware/arm_scmi/bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 35bb70724d44..1d8a6a8d9906 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/device.h>
+#include <linux/of.h>
 
 #include "common.h"
 
@@ -192,6 +193,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol,
 	scmi_dev->protocol_id = protocol;
 	scmi_dev->dev.parent = parent;
 	scmi_dev->dev.of_node = np;
+	scmi_dev->dev.fwnode = of_fwnode_handle(np);
 	scmi_dev->dev.bus = &scmi_bus_type;
 	scmi_dev->dev.release = scmi_device_release;
 	dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id);
-- 
2.39.1.456.gfc5497dd1b-goog


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
@ 2023-01-27  0:11   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Saravana Kannan
  Cc: Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

This allows fw_devlink to track and enforce supplier-consumer
dependencies for scmi_device.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/firmware/arm_scmi/bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 35bb70724d44..1d8a6a8d9906 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/device.h>
+#include <linux/of.h>
 
 #include "common.h"
 
@@ -192,6 +193,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol,
 	scmi_dev->protocol_id = protocol;
 	scmi_dev->dev.parent = parent;
 	scmi_dev->dev.of_node = np;
+	scmi_dev->dev.fwnode = of_fwnode_handle(np);
 	scmi_dev->dev.bus = &scmi_bus_type;
 	scmi_dev->dev.release = scmi_device_release;
 	dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id);
-- 
2.39.1.456.gfc5497dd1b-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  8:11     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  8:11 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> The OF_POPULATED flag was set to let fw_devlink know that the device
> tree node will not have a struct device created for it. This information
> is used by fw_devlink to avoid deferring the probe of consumers of this
> device tree node.
>
> Let's use fwnode_dev_initialized() instead because it achieves the same
> effect without using OF specific flags. This allows more generic code to
> be written in driver core.
>
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Thanks for your patch!

> --- a/drivers/soc/renesas/rcar-sysc.c
> +++ b/drivers/soc/renesas/rcar-sysc.c
> @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
>
>         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
>         if (!error)
> -               of_node_set_flag(np, OF_POPULATED);
> +               fwnode_dev_initialized(&np->fwnode, true);

As drivers/soc/renesas/rmobile-sysc.c is already using this method,
it should work fine.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.4.

>
>  out_put:
>         of_node_put(np);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-27  8:11     ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  8:11 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> The OF_POPULATED flag was set to let fw_devlink know that the device
> tree node will not have a struct device created for it. This information
> is used by fw_devlink to avoid deferring the probe of consumers of this
> device tree node.
>
> Let's use fwnode_dev_initialized() instead because it achieves the same
> effect without using OF specific flags. This allows more generic code to
> be written in driver core.
>
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Thanks for your patch!

> --- a/drivers/soc/renesas/rcar-sysc.c
> +++ b/drivers/soc/renesas/rcar-sysc.c
> @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
>
>         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
>         if (!error)
> -               of_node_set_flag(np, OF_POPULATED);
> +               fwnode_dev_initialized(&np->fwnode, true);

As drivers/soc/renesas/rmobile-sysc.c is already using this method,
it should work fine.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.4.

>
>  out_put:
>         of_node_put(np);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:21     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:21 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:
> When a device X is bound successfully to a driver, if it has a child
> firmware node Y that doesn't have a struct device created by then, we
> delete fwnode links where the child firmware node Y is the supplier. We
> did this to avoid blocking the consumers of the child firmware node Y
> from deferring probe indefinitely.
> 
> While that a step in the right direction, it's better to make the
> consumers of the child firmware node Y to be consumers of the device X
> because device X is probably implementing whatever functionality is
> represented by child firmware node Y. By doing this, we capture the
> device dependencies more accurately and ensure better
> probe/suspend/resume ordering.

...

>  static unsigned int defer_sync_state_count = 1;
>  static DEFINE_MUTEX(fwnode_link_lock);
>  static bool fw_devlink_is_permissive(void);
> +static void __fw_devlink_link_to_consumers(struct device *dev);
>  static bool fw_devlink_drv_reg_done;
>  static bool fw_devlink_best_effort;

I'm wondering if may avoid adding more forward declarations...

Perhaps it's a sign that devlink code should be split to its own
module?

...

> -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> +static int __fwnode_link_add(struct fwnode_handle *con,
> +			     struct fwnode_handle *sup)

I believe we tolerate a bit longer lines, so you may still have it on a single
line.

...

> +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> +{

> +	int ret = 0;

Redundant assignment.

> +	mutex_lock(&fwnode_link_lock);
> +	ret = __fwnode_link_add(con, sup);
> +	mutex_unlock(&fwnode_link_lock);
>  	return ret;
>  }

...

>  	if (dev->fwnode && dev->fwnode->dev == dev) {

You may have above something like


	fwnode = dev_fwnode(dev);
	if (fwnode && fwnode->dev == dev) {

>  		struct fwnode_handle *child;
>  		fwnode_links_purge_suppliers(dev->fwnode);
> +		mutex_lock(&fwnode_link_lock);
>  		fwnode_for_each_available_child_node(dev->fwnode, child)
> -			fw_devlink_purge_absent_suppliers(child);
> +			__fw_devlink_pickup_dangling_consumers(child,
> +							       dev->fwnode);

			__fw_devlink_pickup_dangling_consumers(child, fwnode);

> +		__fw_devlink_link_to_consumers(dev);
> +		mutex_unlock(&fwnode_link_lock);
>  	}

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
@ 2023-01-27  9:21     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:21 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:
> When a device X is bound successfully to a driver, if it has a child
> firmware node Y that doesn't have a struct device created by then, we
> delete fwnode links where the child firmware node Y is the supplier. We
> did this to avoid blocking the consumers of the child firmware node Y
> from deferring probe indefinitely.
> 
> While that a step in the right direction, it's better to make the
> consumers of the child firmware node Y to be consumers of the device X
> because device X is probably implementing whatever functionality is
> represented by child firmware node Y. By doing this, we capture the
> device dependencies more accurately and ensure better
> probe/suspend/resume ordering.

...

>  static unsigned int defer_sync_state_count = 1;
>  static DEFINE_MUTEX(fwnode_link_lock);
>  static bool fw_devlink_is_permissive(void);
> +static void __fw_devlink_link_to_consumers(struct device *dev);
>  static bool fw_devlink_drv_reg_done;
>  static bool fw_devlink_best_effort;

I'm wondering if may avoid adding more forward declarations...

Perhaps it's a sign that devlink code should be split to its own
module?

...

> -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> +static int __fwnode_link_add(struct fwnode_handle *con,
> +			     struct fwnode_handle *sup)

I believe we tolerate a bit longer lines, so you may still have it on a single
line.

...

> +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> +{

> +	int ret = 0;

Redundant assignment.

> +	mutex_lock(&fwnode_link_lock);
> +	ret = __fwnode_link_add(con, sup);
> +	mutex_unlock(&fwnode_link_lock);
>  	return ret;
>  }

...

>  	if (dev->fwnode && dev->fwnode->dev == dev) {

You may have above something like


	fwnode = dev_fwnode(dev);
	if (fwnode && fwnode->dev == dev) {

>  		struct fwnode_handle *child;
>  		fwnode_links_purge_suppliers(dev->fwnode);
> +		mutex_lock(&fwnode_link_lock);
>  		fwnode_for_each_available_child_node(dev->fwnode, child)
> -			fw_devlink_purge_absent_suppliers(child);
> +			__fw_devlink_pickup_dangling_consumers(child,
> +							       dev->fwnode);

			__fw_devlink_pickup_dangling_consumers(child, fwnode);

> +		__fw_devlink_link_to_consumers(dev);
> +		mutex_unlock(&fwnode_link_lock);
>  	}

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:25     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:25 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:
> The OF_POPULATED flag was set to let fw_devlink know that the device
> tree node will not have a struct device created for it. This information
> is used by fw_devlink to avoid deferring the probe of consumers of this
> device tree node.
> 
> Let's use fwnode_dev_initialized() instead because it achieves the same
> effect without using OF specific flags. This allows more generic code to
> be written in driver core.

...

> -		of_node_set_flag(np, OF_POPULATED);
> +		fwnode_dev_initialized(&np->fwnode, true);

of_fwnode_handle(np) ?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-27  9:25     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:25 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:
> The OF_POPULATED flag was set to let fw_devlink know that the device
> tree node will not have a struct device created for it. This information
> is used by fw_devlink to avoid deferring the probe of consumers of this
> device tree node.
> 
> Let's use fwnode_dev_initialized() instead because it achieves the same
> effect without using OF specific flags. This allows more generic code to
> be written in driver core.

...

> -		of_node_set_flag(np, OF_POPULATED);
> +		fwnode_dev_initialized(&np->fwnode, true);

of_fwnode_handle(np) ?

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:27     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:27 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> Registering an irqdomain sets the flag for the fwnode. But having the
> flag set when a device is added is interpreted by fw_devlink to mean the
> device has already been initialized and will never probe. This prevents
> fw_devlink from creating device links with the gpio_device as a
> supplier. So, clear the flag before adding the device.

...

> +	/*
> +	 * If fwnode doesn't belong to another device, it's safe to clear its
> +	 * initialized flag.
> +	 */
> +	if (!gdev->dev.fwnode->dev)
> +		fwnode_dev_initialized(gdev->dev.fwnode, false);

Do not dereference fwnode in struct device. Use dev_fwnode() for that.

	struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);

	if (!fwnode->dev)
		fwnode_dev_initialized(fwnode, false);

+ Blank line.

>  	ret = gcdev_register(gdev, gpio_devt);
>  	if (ret)
>  		return ret;

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-27  9:27     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:27 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> Registering an irqdomain sets the flag for the fwnode. But having the
> flag set when a device is added is interpreted by fw_devlink to mean the
> device has already been initialized and will never probe. This prevents
> fw_devlink from creating device links with the gpio_device as a
> supplier. So, clear the flag before adding the device.

...

> +	/*
> +	 * If fwnode doesn't belong to another device, it's safe to clear its
> +	 * initialized flag.
> +	 */
> +	if (!gdev->dev.fwnode->dev)
> +		fwnode_dev_initialized(gdev->dev.fwnode, false);

Do not dereference fwnode in struct device. Use dev_fwnode() for that.

	struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);

	if (!fwnode->dev)
		fwnode_dev_initialized(fwnode, false);

+ Blank line.

>  	ret = gcdev_register(gdev, gpio_devt);
>  	if (ret)
>  		return ret;

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:29     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:29 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:
> fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
> purposes:
> 
> 1. To allow a parent device to proxy its child device's dependency on a
>    supplier so that the supplier doesn't get its sync_state() callback
>    before the child device/consumer can be added and probed. In this
>    usage scenario, we need to ignore cycles for ensure correctness of
>    sync_state() callbacks.
> 
> 2. When there are dependency cycles in firmware, we don't know which of
>    those dependencies are valid. So, we have to ignore them all wrt
>    probe ordering while still making sure the sync_state() callbacks
>    come correctly.
> 
> However, when detecting dependency cycles, there can be multiple
> dependency cycles between two devices that we need to detect. For
> example:
> 
> A -> B -> A and A -> C -> B -> A.
> 
> To detect multiple cycles correct, we need to be able to differentiate
> DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.
> 
> To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
> mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
> DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
> dependency cycles.

...

> +static inline bool device_link_flag_is_sync_state_only(u32 flags)
> +{
> +	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
> +		== (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);

Weird indentation, why not

	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) ==
	       (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);

?

> +}

...

>  			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
>  			       DL_FLAG_AUTOPROBE_CONSUMER  | \
>  			       DL_FLAG_SYNC_STATE_ONLY | \
> -			       DL_FLAG_INFERRED)
> +			       DL_FLAG_INFERRED | \
> +			       DL_FLAG_CYCLE)

You can make less churn by squeezing the new one above the last one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-27  9:29     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:29 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:
> fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
> purposes:
> 
> 1. To allow a parent device to proxy its child device's dependency on a
>    supplier so that the supplier doesn't get its sync_state() callback
>    before the child device/consumer can be added and probed. In this
>    usage scenario, we need to ignore cycles for ensure correctness of
>    sync_state() callbacks.
> 
> 2. When there are dependency cycles in firmware, we don't know which of
>    those dependencies are valid. So, we have to ignore them all wrt
>    probe ordering while still making sure the sync_state() callbacks
>    come correctly.
> 
> However, when detecting dependency cycles, there can be multiple
> dependency cycles between two devices that we need to detect. For
> example:
> 
> A -> B -> A and A -> C -> B -> A.
> 
> To detect multiple cycles correct, we need to be able to differentiate
> DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.
> 
> To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
> mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
> DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
> dependency cycles.

...

> +static inline bool device_link_flag_is_sync_state_only(u32 flags)
> +{
> +	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
> +		== (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);

Weird indentation, why not

	return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) ==
	       (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);

?

> +}

...

>  			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
>  			       DL_FLAG_AUTOPROBE_CONSUMER  | \
>  			       DL_FLAG_SYNC_STATE_ONLY | \
> -			       DL_FLAG_INFERRED)
> +			       DL_FLAG_INFERRED | \
> +			       DL_FLAG_CYCLE)

You can make less churn by squeezing the new one above the last one.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-27  9:29     ` Andy Shevchenko
@ 2023-01-27  9:30       ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:30 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:29:43AM +0200, Andy Shevchenko wrote:
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

...

> >  			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >  			       DL_FLAG_AUTOPROBE_CONSUMER  | \
> >  			       DL_FLAG_SYNC_STATE_ONLY | \
> > -			       DL_FLAG_INFERRED)
> > +			       DL_FLAG_INFERRED | \
> > +			       DL_FLAG_CYCLE)
> 
> You can make less churn by squeezing the new one above the last one.

Or even define a mask with all necessary bits in the header and use it.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-27  9:30       ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:30 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:29:43AM +0200, Andy Shevchenko wrote:
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

...

> >  			       DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >  			       DL_FLAG_AUTOPROBE_CONSUMER  | \
> >  			       DL_FLAG_SYNC_STATE_ONLY | \
> > -			       DL_FLAG_INFERRED)
> > +			       DL_FLAG_INFERRED | \
> > +			       DL_FLAG_CYCLE)
> 
> You can make less churn by squeezing the new one above the last one.

Or even define a mask with all necessary bits in the header and use it.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  9:25     ` Andy Shevchenko
@ 2023-01-27  9:30       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 10:25 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:
> > The OF_POPULATED flag was set to let fw_devlink know that the device
> > tree node will not have a struct device created for it. This information
> > is used by fw_devlink to avoid deferring the probe of consumers of this
> > device tree node.
> >
> > Let's use fwnode_dev_initialized() instead because it achieves the same
> > effect without using OF specific flags. This allows more generic code to
> > be written in driver core.
>
> ...
>
> > -             of_node_set_flag(np, OF_POPULATED);
> > +             fwnode_dev_initialized(&np->fwnode, true);
>
> of_fwnode_handle(np) ?

Or of_node_to_fwnode(). Looks like we have (at least) two of them...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-27  9:30       ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 10:25 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:
> > The OF_POPULATED flag was set to let fw_devlink know that the device
> > tree node will not have a struct device created for it. This information
> > is used by fw_devlink to avoid deferring the probe of consumers of this
> > device tree node.
> >
> > Let's use fwnode_dev_initialized() instead because it achieves the same
> > effect without using OF specific flags. This allows more generic code to
> > be written in driver core.
>
> ...
>
> > -             of_node_set_flag(np, OF_POPULATED);
> > +             fwnode_dev_initialized(&np->fwnode, true);
>
> of_fwnode_handle(np) ?

Or of_node_to_fwnode(). Looks like we have (at least) two of them...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:33     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:33 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:
> To improve detection and handling of dependency cycles, we need to be
> able to mark fwnode links as being part of cycles. fwnode links marked
> as being part of a cycle should not block their consumers from probing.

...

> +	list_for_each_entry(link, &fwnode->suppliers, c_hook) {
> +		if (link->flags & FWLINK_FLAG_CYCLE)
> +			continue;
> +		return link->supplier;

Hmm...

		if (!(link->flags & FWLINK_FLAG_CYCLE))
			return link->supplier;

?

> +	}
> +
> +	return NULL;

...

> -	if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> -	    !fw_devlink_is_permissive()) {
> -		sup_fw = list_first_entry(&dev->fwnode->suppliers,
> -					  struct fwnode_link,
> -					  c_hook)->supplier;
> +	sup_fw = fwnode_links_check_suppliers(dev->fwnode);

dev_fwnode() ?

...

> -	val = !list_empty(&dev->fwnode->suppliers);
> +	mutex_lock(&fwnode_link_lock);
> +	val = !!fwnode_links_check_suppliers(dev->fwnode);

Ditto?

> +	mutex_unlock(&fwnode_link_lock);

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
@ 2023-01-27  9:33     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:33 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:
> To improve detection and handling of dependency cycles, we need to be
> able to mark fwnode links as being part of cycles. fwnode links marked
> as being part of a cycle should not block their consumers from probing.

...

> +	list_for_each_entry(link, &fwnode->suppliers, c_hook) {
> +		if (link->flags & FWLINK_FLAG_CYCLE)
> +			continue;
> +		return link->supplier;

Hmm...

		if (!(link->flags & FWLINK_FLAG_CYCLE))
			return link->supplier;

?

> +	}
> +
> +	return NULL;

...

> -	if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> -	    !fw_devlink_is_permissive()) {
> -		sup_fw = list_first_entry(&dev->fwnode->suppliers,
> -					  struct fwnode_link,
> -					  c_hook)->supplier;
> +	sup_fw = fwnode_links_check_suppliers(dev->fwnode);

dev_fwnode() ?

...

> -	val = !list_empty(&dev->fwnode->suppliers);
> +	mutex_lock(&fwnode_link_lock);
> +	val = !!fwnode_links_check_suppliers(dev->fwnode);

Ditto?

> +	mutex_unlock(&fwnode_link_lock);

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:43     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:43 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> fw_devlink could only detect a single and simple cycle because it relied
> mainly on device link cycle detection code that only checked for cycles
> between devices. The expectation was that the firmware wouldn't have
> complicated cycles and multiple cycles between devices. That expectation
> has been proven to be wrong.
> 
> For example, fw_devlink could handle:
> 
> +-+        +-+
> |A+------> |B+
> +-+        +++
>  ^          |
>  |          |
>  +----------+
> 
> But it couldn't handle even something as "simple" as:
> 
>  +---------------------+
>  |                     |
>  v                     |
> +-+        +-+        +++
> |A+------> |B+------> |C|
> +-+        +++        +-+
>  ^          |
>  |          |
>  +----------+
> 
> But firmware has even more complicated cycles like:
> 
>     +---------------------+
>     |                     |
>     v                     |
>    +-+       +---+       +++
> +--+A+------>| B +-----> |C|<--+
> |  +-+       ++--+       +++   |
> |   ^         | ^         |    |
> |   |         | |         |    |
> |   +---------+ +---------+    |
> |                              |
> +------------------------------+
> 
> And this is without including parent child dependencies or nodes in the
> cycle that are just firmware nodes that'll never have a struct device
> created for them.
> 
> The proper way to treat these devices it to not force any probe ordering
> between them, while still enforce dependencies between node in the
> cycles (A, B and C) and their consumers.
> 
> So this patch goes all out and just deals with all types of cycles. It
> does this by:
> 
> 1. Following dependencies across device links, parent-child and fwnode
>    links.
> 2. When it find cycles, it mark the device links and fwnode links as
>    such instead of just deleting them or making the indistinguishable
>    from proxy SYNC_STATE_ONLY device links.
> 
> This way, when new nodes get added, we can immediately find and mark any
> new cycles whether the new node is a device or firmware node.

...

> + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> + * depend on @con.  This function can detect multiple cyles between @sup_handle

A single space is enough.

> + * and @con. When such dependency cycles are found, convert all device links
> + * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark

Ditto.

> + * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
> + * converted into a device link in the future, they are created as
> + * SYNC_STATE_ONLY device links.  This is the equivalent of doing

Ditto.

> + * fw_devlink=permissive just between the devices in the cycle. We need to do
> + * this because, at this point, fw_devlink can't tell which of these
> + * dependencies is not a real dependency.
> + *
> + * Return true if one or more cycles were found. Otherwise, return false.

Return:

(you may run `kernel-doc -v ...` to see all warnings)

...

> +static bool __fw_devlink_relax_cycles(struct device *con,
> +				 struct fwnode_handle *sup_handle)
> +{
> +	struct fwnode_link *link;
> +	struct device_link *dev_link;

> +	struct device *sup_dev = NULL, *par_dev = NULL;

You can put it the first line since it's long enough.
But why do you need sup_dev assignment?

> +	bool ret = false;
> +
> +	if (!sup_handle)
> +		return false;
> +
> +	/*
> +	 * We aren't trying to find all cycles. Just a cycle between con and
> +	 * sup_handle.
> +	 */
> +	if (sup_handle->flags & FWNODE_FLAG_VISITED)
> +		return false;
> +
> +	sup_handle->flags |= FWNODE_FLAG_VISITED;

> +	sup_dev = get_dev_from_fwnode(sup_handle);
> +

I would put it closer to the condition:

> +	/* Termination condition. */
> +	if (sup_dev == con) {

	/* Get supplier device and check for termination condition */
	sup_dev = get_dev_from_fwnode(sup_handle);
	if (sup_dev == con) {

> +		ret = true;
> +		goto out;
> +	}
> +
> +	/*
> +	 * If sup_dev is bound to a driver and @con hasn't started binding to
> +	 * a driver, @sup_dev can't be a consumer of @con.  So, no need to

sup_dev or @sup_dev? What's the difference? Should you spell one of them
in full?

> +	 * check further.
> +	 */
> +	if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&

As in the comment above, the single space is enough.

> +	    con->links.status == DL_DEV_NO_DRIVER) {
> +		ret = false;
> +		goto out;
> +	}
> +
> +	list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
> +		if (__fw_devlink_relax_cycles(con, link->supplier)) {
> +			__fwnode_link_cycle(link);
> +			ret = true;
> +		}
> +	}
> +
> +	/*
> +	 * Give priority to device parent over fwnode parent to account for any
> +	 * quirks in how fwnodes are converted to devices.
> +	 */

> +	if (sup_dev) {
> +		par_dev = sup_dev->parent;
> +		get_device(par_dev);
> +	} else {
> +		par_dev = fwnode_get_next_parent_dev(sup_handle);
> +	}

	if (sup_dev)
		par_dev = get_device(sup_dev->parent);
	else
		par_dev = fwnode_get_next_parent_dev(sup_handle);

> +	if (par_dev)
> +		ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);

Instead I would rather do a similar pattern of the ret assignment as elsewhere
in the function.

	if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode))
		ret = true;

> +	if (!sup_dev)
> +		goto out;
> +
> +	list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
> +		/*
> +		 * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
> +		 * such due to a cycle.
> +		 */
> +		if (device_link_flag_is_sync_state_only(dev_link->flags) &&
> +		    !(dev_link->flags & DL_FLAG_CYCLE))
> +			continue;
> +
> +		if (__fw_devlink_relax_cycles(con,
> +					      dev_link->supplier->fwnode)) {

Keep it on one line.

> +			fw_devlink_relax_link(dev_link);
> +			dev_link->flags |= DL_FLAG_CYCLE;
> +			ret = true;
> +		}
> +	}
> +
> +out:
> +	sup_handle->flags &= ~FWNODE_FLAG_VISITED;
> +	put_device(sup_dev);
> +	put_device(par_dev);
> +	return ret;
> +}

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-27  9:43     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:43 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> fw_devlink could only detect a single and simple cycle because it relied
> mainly on device link cycle detection code that only checked for cycles
> between devices. The expectation was that the firmware wouldn't have
> complicated cycles and multiple cycles between devices. That expectation
> has been proven to be wrong.
> 
> For example, fw_devlink could handle:
> 
> +-+        +-+
> |A+------> |B+
> +-+        +++
>  ^          |
>  |          |
>  +----------+
> 
> But it couldn't handle even something as "simple" as:
> 
>  +---------------------+
>  |                     |
>  v                     |
> +-+        +-+        +++
> |A+------> |B+------> |C|
> +-+        +++        +-+
>  ^          |
>  |          |
>  +----------+
> 
> But firmware has even more complicated cycles like:
> 
>     +---------------------+
>     |                     |
>     v                     |
>    +-+       +---+       +++
> +--+A+------>| B +-----> |C|<--+
> |  +-+       ++--+       +++   |
> |   ^         | ^         |    |
> |   |         | |         |    |
> |   +---------+ +---------+    |
> |                              |
> +------------------------------+
> 
> And this is without including parent child dependencies or nodes in the
> cycle that are just firmware nodes that'll never have a struct device
> created for them.
> 
> The proper way to treat these devices it to not force any probe ordering
> between them, while still enforce dependencies between node in the
> cycles (A, B and C) and their consumers.
> 
> So this patch goes all out and just deals with all types of cycles. It
> does this by:
> 
> 1. Following dependencies across device links, parent-child and fwnode
>    links.
> 2. When it find cycles, it mark the device links and fwnode links as
>    such instead of just deleting them or making the indistinguishable
>    from proxy SYNC_STATE_ONLY device links.
> 
> This way, when new nodes get added, we can immediately find and mark any
> new cycles whether the new node is a device or firmware node.

...

> + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> + * depend on @con.  This function can detect multiple cyles between @sup_handle

A single space is enough.

> + * and @con. When such dependency cycles are found, convert all device links
> + * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark

Ditto.

> + * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
> + * converted into a device link in the future, they are created as
> + * SYNC_STATE_ONLY device links.  This is the equivalent of doing

Ditto.

> + * fw_devlink=permissive just between the devices in the cycle. We need to do
> + * this because, at this point, fw_devlink can't tell which of these
> + * dependencies is not a real dependency.
> + *
> + * Return true if one or more cycles were found. Otherwise, return false.

Return:

(you may run `kernel-doc -v ...` to see all warnings)

...

> +static bool __fw_devlink_relax_cycles(struct device *con,
> +				 struct fwnode_handle *sup_handle)
> +{
> +	struct fwnode_link *link;
> +	struct device_link *dev_link;

> +	struct device *sup_dev = NULL, *par_dev = NULL;

You can put it the first line since it's long enough.
But why do you need sup_dev assignment?

> +	bool ret = false;
> +
> +	if (!sup_handle)
> +		return false;
> +
> +	/*
> +	 * We aren't trying to find all cycles. Just a cycle between con and
> +	 * sup_handle.
> +	 */
> +	if (sup_handle->flags & FWNODE_FLAG_VISITED)
> +		return false;
> +
> +	sup_handle->flags |= FWNODE_FLAG_VISITED;

> +	sup_dev = get_dev_from_fwnode(sup_handle);
> +

I would put it closer to the condition:

> +	/* Termination condition. */
> +	if (sup_dev == con) {

	/* Get supplier device and check for termination condition */
	sup_dev = get_dev_from_fwnode(sup_handle);
	if (sup_dev == con) {

> +		ret = true;
> +		goto out;
> +	}
> +
> +	/*
> +	 * If sup_dev is bound to a driver and @con hasn't started binding to
> +	 * a driver, @sup_dev can't be a consumer of @con.  So, no need to

sup_dev or @sup_dev? What's the difference? Should you spell one of them
in full?

> +	 * check further.
> +	 */
> +	if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&

As in the comment above, the single space is enough.

> +	    con->links.status == DL_DEV_NO_DRIVER) {
> +		ret = false;
> +		goto out;
> +	}
> +
> +	list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
> +		if (__fw_devlink_relax_cycles(con, link->supplier)) {
> +			__fwnode_link_cycle(link);
> +			ret = true;
> +		}
> +	}
> +
> +	/*
> +	 * Give priority to device parent over fwnode parent to account for any
> +	 * quirks in how fwnodes are converted to devices.
> +	 */

> +	if (sup_dev) {
> +		par_dev = sup_dev->parent;
> +		get_device(par_dev);
> +	} else {
> +		par_dev = fwnode_get_next_parent_dev(sup_handle);
> +	}

	if (sup_dev)
		par_dev = get_device(sup_dev->parent);
	else
		par_dev = fwnode_get_next_parent_dev(sup_handle);

> +	if (par_dev)
> +		ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);

Instead I would rather do a similar pattern of the ret assignment as elsewhere
in the function.

	if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode))
		ret = true;

> +	if (!sup_dev)
> +		goto out;
> +
> +	list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
> +		/*
> +		 * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
> +		 * such due to a cycle.
> +		 */
> +		if (device_link_flag_is_sync_state_only(dev_link->flags) &&
> +		    !(dev_link->flags & DL_FLAG_CYCLE))
> +			continue;
> +
> +		if (__fw_devlink_relax_cycles(con,
> +					      dev_link->supplier->fwnode)) {

Keep it on one line.

> +			fw_devlink_relax_link(dev_link);
> +			dev_link->flags |= DL_FLAG_CYCLE;
> +			ret = true;
> +		}
> +	}
> +
> +out:
> +	sup_handle->flags &= ~FWNODE_FLAG_VISITED;
> +	put_device(sup_dev);
> +	put_device(par_dev);
> +	return ret;
> +}

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  9:30       ` Geert Uytterhoeven
@ 2023-01-27  9:44         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:30:35AM +0100, Geert Uytterhoeven wrote:
> On Fri, Jan 27, 2023 at 10:25 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:

...

> > > -             of_node_set_flag(np, OF_POPULATED);
> > > +             fwnode_dev_initialized(&np->fwnode, true);
> >
> > of_fwnode_handle(np) ?
> 
> Or of_node_to_fwnode().

Not really.

> Looks like we have (at least) two of them...

Yes, and the latter one is IRQ subsystem invention. Should gone in favour of
the generic helper.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-27  9:44         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:30:35AM +0100, Geert Uytterhoeven wrote:
> On Fri, Jan 27, 2023 at 10:25 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:30PM -0800, Saravana Kannan wrote:

...

> > > -             of_node_set_flag(np, OF_POPULATED);
> > > +             fwnode_dev_initialized(&np->fwnode, true);
> >
> > of_fwnode_handle(np) ?
> 
> Or of_node_to_fwnode().

Not really.

> Looks like we have (at least) two of them...

Yes, and the latter one is IRQ subsystem invention. Should gone in favour of
the generic helper.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:51     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:51 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:37PM -0800, Saravana Kannan wrote:
> Since this device is only partially initialized by the irqchip driver,
> we need to mark the fwnode device as not initialized. This is to let
> fw_devlink know that the device will be completely initialized at a
> later point. That way, fw_devlink will continue to defer the probe of
> the power domain consumers till the power domain driver successfully
> binds to the struct device and completes the initialization of the
> device.

...

>  		pd_pdev->dev.of_node = np;
> +		pd_pdev->dev.fwnode = of_fwnode_handle(np);

Instead,

		device_set_node(&pd_dev->dev, of_fwnode_handle(np));

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
@ 2023-01-27  9:51     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:51 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:37PM -0800, Saravana Kannan wrote:
> Since this device is only partially initialized by the irqchip driver,
> we need to mark the fwnode device as not initialized. This is to let
> fw_devlink know that the device will be completely initialized at a
> later point. That way, fw_devlink will continue to defer the probe of
> the power domain consumers till the power domain driver successfully
> binds to the struct device and completes the initialization of the
> device.

...

>  		pd_pdev->dev.of_node = np;
> +		pd_pdev->dev.fwnode = of_fwnode_handle(np);

Instead,

		device_set_node(&pd_dev->dev, of_fwnode_handle(np));

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27  9:43     ` Andy Shevchenko
@ 2023-01-27  9:52       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > + * depend on @con.  This function can detect multiple cyles between @sup_handle
>
> A single space is enough.

It's very common to write two spaces after a full stop.
When joining two sentences on separate lines in vim using SHIFT-J,
vim will make sure there are two spaces.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-27  9:52       ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > + * depend on @con.  This function can detect multiple cyles between @sup_handle
>
> A single space is enough.

It's very common to write two spaces after a full stop.
When joining two sentences on separate lines in vim using SHIFT-J,
vim will make sure there are two spaces.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27  9:52     ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:52 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:38PM -0800, Saravana Kannan wrote:
> This allows fw_devlink to track and enforce supplier-consumer
> dependencies for scmi_device.

...

>  	scmi_dev->dev.of_node = np;
> +	scmi_dev->dev.fwnode = of_fwnode_handle(np);

As per previous patch:

	device_set_node(&scmi_dev->dev, of_fwnode_handle(np));

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
@ 2023-01-27  9:52     ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27  9:52 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:38PM -0800, Saravana Kannan wrote:
> This allows fw_devlink to track and enforce supplier-consumer
> dependencies for scmi_device.

...

>  	scmi_dev->dev.of_node = np;
> +	scmi_dev->dev.fwnode = of_fwnode_handle(np);

As per previous patch:

	device_set_node(&scmi_dev->dev, of_fwnode_handle(np));

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-27  9:29     ` Andy Shevchenko
@ 2023-01-27  9:55       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

> >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> >                              DL_FLAG_SYNC_STATE_ONLY | \
> > -                            DL_FLAG_INFERRED)
> > +                            DL_FLAG_INFERRED | \
> > +                            DL_FLAG_CYCLE)
>
> You can make less churn by squeezing the new one above the last one.

And avoiding some future churn by introducing alphabetical order.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-27  9:55       ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27  9:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

> >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> >                              DL_FLAG_SYNC_STATE_ONLY | \
> > -                            DL_FLAG_INFERRED)
> > +                            DL_FLAG_INFERRED | \
> > +                            DL_FLAG_CYCLE)
>
> You can make less churn by squeezing the new one above the last one.

And avoiding some future churn by introducing alphabetical order.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27  9:52       ` Geert Uytterhoeven
@ 2023-01-27 10:10         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27 10:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:52:02AM +0100, Geert Uytterhoeven wrote:
> On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > > + * depend on @con.  This function can detect multiple cyles between @sup_handle
> >
> > A single space is enough.
> 
> It's very common to write two spaces after a full stop.
> When joining two sentences on separate lines in vim using SHIFT-J,
> vim will make sure there are two spaces.

But is this consistent with all kernel doc comments in the core.c?

I'm fine with either as long as it's consistent.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-27 10:10         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-27 10:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 10:52:02AM +0100, Geert Uytterhoeven wrote:
> On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > > + * depend on @con.  This function can detect multiple cyles between @sup_handle
> >
> > A single space is enough.
> 
> It's very common to write two spaces after a full stop.
> When joining two sentences on separate lines in vim using SHIFT-J,
> vim will make sure there are two spaces.

But is this consistent with all kernel doc comments in the core.c?

I'm fine with either as long as it's consistent.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27 10:10         ` Andy Shevchenko
@ 2023-01-27 10:29           ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27 10:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 11:10 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Fri, Jan 27, 2023 at 10:52:02AM +0100, Geert Uytterhoeven wrote:
> > On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > > > + * depend on @con.  This function can detect multiple cyles between @sup_handle
> > >
> > > A single space is enough.
> >
> > It's very common to write two spaces after a full stop.

See e.g.:

    git grep "\.  [^ ]

> > When joining two sentences on separate lines in vim using SHIFT-J,
> > vim will make sure there are two spaces.
>
> But is this consistent with all kernel doc comments in the core.c?

Probably there are inconsistencies...
(Aren't there everywhere?)

> I'm fine with either as long as it's consistent.

At least the kerneldoc source will look similar to the PDF output
(LaTeX inserts more space after a full stop automatically ;-).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-27 10:29           ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-27 10:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Fri, Jan 27, 2023 at 11:10 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Fri, Jan 27, 2023 at 10:52:02AM +0100, Geert Uytterhoeven wrote:
> > On Fri, Jan 27, 2023 at 10:43 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > > > + * depend on @con.  This function can detect multiple cyles between @sup_handle
> > >
> > > A single space is enough.
> >
> > It's very common to write two spaces after a full stop.

See e.g.:

    git grep "\.  [^ ]

> > When joining two sentences on separate lines in vim using SHIFT-J,
> > vim will make sure there are two spaces.
>
> But is this consistent with all kernel doc comments in the core.c?

Probably there are inconsistencies...
(Aren't there everywhere?)

> I'm fine with either as long as it's consistent.

At least the kerneldoc source will look similar to the PDF output
(LaTeX inserts more space after a full stop automatically ;-).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-27 10:48     ` Sudeep Holla
  -1 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-27 10:48 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Cristian Marussi,
	Sudeep Holla, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:38PM -0800, Saravana Kannan wrote:
> This allows fw_devlink to track and enforce supplier-consumer
> dependencies for scmi_device.
>

Is there any dependency in the series, if so

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

after you incorporate Andy's suggestion.

Let me know if you want me to pick this up.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device
@ 2023-01-27 10:48     ` Sudeep Holla
  0 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-27 10:48 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Cristian Marussi,
	Sudeep Holla, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:38PM -0800, Saravana Kannan wrote:
> This allows fw_devlink to track and enforce supplier-consumer
> dependencies for scmi_device.
>

Is there any dependency in the series, if so

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

after you incorporate Andy's suggestion.

Let me know if you want me to pick this up.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-27 20:30   ` Colin Foster
  -1 siblings, 0 replies; 146+ messages in thread
From: Colin Foster @ 2023-01-27 20:30 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:27PM -0800, Saravana Kannan wrote:
> Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> 
> I've Cc-ed you because I had pointed you to v1 of this series + the
> patches in that thread at one point or another as a fix to some issue
> you were facing. It'd appreciate it if you can test this series and
> report any issues, or things it fixed and give Tested-bys.

I applied this on my working net-next/main development branch and can
confirm I am able to successfully boot the Beaglebone Black.

Tested-by: Colin Foster <colin.foster@in-advantage.com>

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-27 20:30   ` Colin Foster
  0 siblings, 0 replies; 146+ messages in thread
From: Colin Foster @ 2023-01-27 20:30 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:27PM -0800, Saravana Kannan wrote:
> Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> 
> I've Cc-ed you because I had pointed you to v1 of this series + the
> patches in that thread at one point or another as a fix to some issue
> you were facing. It'd appreciate it if you can test this series and
> report any issues, or things it fixed and give Tested-bys.

I applied this on my working net-next/main development branch and can
confirm I am able to successfully boot the Beaglebone Black.

Tested-by: Colin Foster <colin.foster@in-advantage.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-27 20:30   ` Colin Foster
@ 2023-01-27 21:35     ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27 21:35 UTC (permalink / raw)
  To: Colin Foster
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 12:30 PM Colin Foster
<colin.foster@in-advantage.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:27PM -0800, Saravana Kannan wrote:
> > Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> >
> > I've Cc-ed you because I had pointed you to v1 of this series + the
> > patches in that thread at one point or another as a fix to some issue
> > you were facing. It'd appreciate it if you can test this series and
> > report any issues, or things it fixed and give Tested-bys.
>
> I applied this on my working net-next/main development branch and can
> confirm I am able to successfully boot the Beaglebone Black.
>
> Tested-by: Colin Foster <colin.foster@in-advantage.com>

Thanks!

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-27 21:35     ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-27 21:35 UTC (permalink / raw)
  To: Colin Foster
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 12:30 PM Colin Foster
<colin.foster@in-advantage.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:27PM -0800, Saravana Kannan wrote:
> > Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> >
> > I've Cc-ed you because I had pointed you to v1 of this series + the
> > patches in that thread at one point or another as a fix to some issue
> > you were facing. It'd appreciate it if you can test this series and
> > report any issues, or things it fixed and give Tested-bys.
>
> I applied this on my working net-next/main development branch and can
> confirm I am able to successfully boot the Beaglebone Black.
>
> Tested-by: Colin Foster <colin.foster@in-advantage.com>

Thanks!

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-27  8:11     ` Geert Uytterhoeven
@ 2023-01-28  7:18       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > The OF_POPULATED flag was set to let fw_devlink know that the device
> > tree node will not have a struct device created for it. This information
> > is used by fw_devlink to avoid deferring the probe of consumers of this
> > device tree node.
> >
> > Let's use fwnode_dev_initialized() instead because it achieves the same
> > effect without using OF specific flags. This allows more generic code to
> > be written in driver core.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
>
> Thanks for your patch!
>
> > --- a/drivers/soc/renesas/rcar-sysc.c
> > +++ b/drivers/soc/renesas/rcar-sysc.c
> > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> >
> >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> >         if (!error)
> > -               of_node_set_flag(np, OF_POPULATED);
> > +               fwnode_dev_initialized(&np->fwnode, true);
>
> As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> it should work fine.
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> i.e. will queue in renesas-devel for v6.4.

Thanks! Does that mean I should drop this from this series? If two
maintainers pick the same patch up, will it cause problems? I'm
eventually expecting this series to be picked up by Greg into
driver-core-next.

-Saravana

>
> >
> >  out_put:
> >         of_node_put(np);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-28  7:18       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > The OF_POPULATED flag was set to let fw_devlink know that the device
> > tree node will not have a struct device created for it. This information
> > is used by fw_devlink to avoid deferring the probe of consumers of this
> > device tree node.
> >
> > Let's use fwnode_dev_initialized() instead because it achieves the same
> > effect without using OF specific flags. This allows more generic code to
> > be written in driver core.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
>
> Thanks for your patch!
>
> > --- a/drivers/soc/renesas/rcar-sysc.c
> > +++ b/drivers/soc/renesas/rcar-sysc.c
> > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> >
> >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> >         if (!error)
> > -               of_node_set_flag(np, OF_POPULATED);
> > +               fwnode_dev_initialized(&np->fwnode, true);
>
> As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> it should work fine.
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> i.e. will queue in renesas-devel for v6.4.

Thanks! Does that mean I should drop this from this series? If two
maintainers pick the same patch up, will it cause problems? I'm
eventually expecting this series to be picked up by Greg into
driver-core-next.

-Saravana

>
> >
> >  out_put:
> >         of_node_put(np);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
  2023-01-27  9:21     ` Andy Shevchenko
@ 2023-01-28  7:33       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:22 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:
> > When a device X is bound successfully to a driver, if it has a child
> > firmware node Y that doesn't have a struct device created by then, we
> > delete fwnode links where the child firmware node Y is the supplier. We
> > did this to avoid blocking the consumers of the child firmware node Y
> > from deferring probe indefinitely.
> >
> > While that a step in the right direction, it's better to make the
> > consumers of the child firmware node Y to be consumers of the device X
> > because device X is probably implementing whatever functionality is
> > represented by child firmware node Y. By doing this, we capture the
> > device dependencies more accurately and ensure better
> > probe/suspend/resume ordering.
>
> ...
>
> >  static unsigned int defer_sync_state_count = 1;
> >  static DEFINE_MUTEX(fwnode_link_lock);
> >  static bool fw_devlink_is_permissive(void);
> > +static void __fw_devlink_link_to_consumers(struct device *dev);
> >  static bool fw_devlink_drv_reg_done;
> >  static bool fw_devlink_best_effort;
>
> I'm wondering if may avoid adding more forward declarations...
>
> Perhaps it's a sign that devlink code should be split to its own
> module?

I've thought about that before, but I'm not there yet. Maybe once my
remaining refactors and TODOs are done, it'd be a good time to revisit
this question.

But I don't think it should be done for the reason of forward
declaration as we'd just end up moving these into base.h and we can do
that even today.

>
> ...
>
> > -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > +static int __fwnode_link_add(struct fwnode_handle *con,
> > +                          struct fwnode_handle *sup)
>
> I believe we tolerate a bit longer lines, so you may still have it on a single
> line.

That'd make it >80 cols. I'm going to leave it as is.

>
> ...
>
> > +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > +{
>
> > +     int ret = 0;
>
> Redundant assignment.

Thanks. Will fix in v3.

>
> > +     mutex_lock(&fwnode_link_lock);
> > +     ret = __fwnode_link_add(con, sup);
> > +     mutex_unlock(&fwnode_link_lock);
> >       return ret;
> >  }
>
> ...
>
> >       if (dev->fwnode && dev->fwnode->dev == dev) {
>
> You may have above something like
>
>
>         fwnode = dev_fwnode(dev);

I'll leave it as-is for now. I see dev->fwnode vs dev_fwnode() don't
always give the same results. I need to re-examine other places I use
dev->fwnode in fw_devlink code before I start using that function. But
in general it seems like a good idea. I'll add this to my TODOs.

>         if (fwnode && fwnode->dev == dev) {
>
> >               struct fwnode_handle *child;
> >               fwnode_links_purge_suppliers(dev->fwnode);
> > +             mutex_lock(&fwnode_link_lock);
> >               fwnode_for_each_available_child_node(dev->fwnode, child)
> > -                     fw_devlink_purge_absent_suppliers(child);
> > +                     __fw_devlink_pickup_dangling_consumers(child,
> > +                                                            dev->fwnode);
>
>                         __fw_devlink_pickup_dangling_consumers(child, fwnode);

I like the dev->fwnode->dev == dev check. It makes it super clear that
I'm checking "The device's fwnode points back to the device". If I
just use fwnode->dev == dev, then one will have to go back and read
what fwnode is set to, etc. Also, when reading all these function
calls it's easier to see that I'm working on the dev's fwnode (where
dev is the device that was just bound to a driver) instead of some
other fwnode.

So I find it more readable as is and the compiler would optimize it
anyway. If you feel strongly about this, I can change to use fwnode
instead of dev->fwnode.

Thanks,
Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
@ 2023-01-28  7:33       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:22 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:
> > When a device X is bound successfully to a driver, if it has a child
> > firmware node Y that doesn't have a struct device created by then, we
> > delete fwnode links where the child firmware node Y is the supplier. We
> > did this to avoid blocking the consumers of the child firmware node Y
> > from deferring probe indefinitely.
> >
> > While that a step in the right direction, it's better to make the
> > consumers of the child firmware node Y to be consumers of the device X
> > because device X is probably implementing whatever functionality is
> > represented by child firmware node Y. By doing this, we capture the
> > device dependencies more accurately and ensure better
> > probe/suspend/resume ordering.
>
> ...
>
> >  static unsigned int defer_sync_state_count = 1;
> >  static DEFINE_MUTEX(fwnode_link_lock);
> >  static bool fw_devlink_is_permissive(void);
> > +static void __fw_devlink_link_to_consumers(struct device *dev);
> >  static bool fw_devlink_drv_reg_done;
> >  static bool fw_devlink_best_effort;
>
> I'm wondering if may avoid adding more forward declarations...
>
> Perhaps it's a sign that devlink code should be split to its own
> module?

I've thought about that before, but I'm not there yet. Maybe once my
remaining refactors and TODOs are done, it'd be a good time to revisit
this question.

But I don't think it should be done for the reason of forward
declaration as we'd just end up moving these into base.h and we can do
that even today.

>
> ...
>
> > -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > +static int __fwnode_link_add(struct fwnode_handle *con,
> > +                          struct fwnode_handle *sup)
>
> I believe we tolerate a bit longer lines, so you may still have it on a single
> line.

That'd make it >80 cols. I'm going to leave it as is.

>
> ...
>
> > +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > +{
>
> > +     int ret = 0;
>
> Redundant assignment.

Thanks. Will fix in v3.

>
> > +     mutex_lock(&fwnode_link_lock);
> > +     ret = __fwnode_link_add(con, sup);
> > +     mutex_unlock(&fwnode_link_lock);
> >       return ret;
> >  }
>
> ...
>
> >       if (dev->fwnode && dev->fwnode->dev == dev) {
>
> You may have above something like
>
>
>         fwnode = dev_fwnode(dev);

I'll leave it as-is for now. I see dev->fwnode vs dev_fwnode() don't
always give the same results. I need to re-examine other places I use
dev->fwnode in fw_devlink code before I start using that function. But
in general it seems like a good idea. I'll add this to my TODOs.

>         if (fwnode && fwnode->dev == dev) {
>
> >               struct fwnode_handle *child;
> >               fwnode_links_purge_suppliers(dev->fwnode);
> > +             mutex_lock(&fwnode_link_lock);
> >               fwnode_for_each_available_child_node(dev->fwnode, child)
> > -                     fw_devlink_purge_absent_suppliers(child);
> > +                     __fw_devlink_pickup_dangling_consumers(child,
> > +                                                            dev->fwnode);
>
>                         __fw_devlink_pickup_dangling_consumers(child, fwnode);

I like the dev->fwnode->dev == dev check. It makes it super clear that
I'm checking "The device's fwnode points back to the device". If I
just use fwnode->dev == dev, then one will have to go back and read
what fwnode is set to, etc. Also, when reading all these function
calls it's easier to see that I'm working on the dev's fwnode (where
dev is the device that was just bound to a driver) instead of some
other fwnode.

So I find it more readable as is and the compiler would optimize it
anyway. If you feel strongly about this, I can change to use fwnode
instead of dev->fwnode.

Thanks,
Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-27  9:27     ` Andy Shevchenko
@ 2023-01-28  7:33       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:27 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > Registering an irqdomain sets the flag for the fwnode. But having the
> > flag set when a device is added is interpreted by fw_devlink to mean the
> > device has already been initialized and will never probe. This prevents
> > fw_devlink from creating device links with the gpio_device as a
> > supplier. So, clear the flag before adding the device.
>
> ...
>
> > +     /*
> > +      * If fwnode doesn't belong to another device, it's safe to clear its
> > +      * initialized flag.
> > +      */
> > +     if (!gdev->dev.fwnode->dev)
> > +             fwnode_dev_initialized(gdev->dev.fwnode, false);
>
> Do not dereference fwnode in struct device. Use dev_fwnode() for that.
>
>         struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
>
>         if (!fwnode->dev)
>                 fwnode_dev_initialized(fwnode, false);

Honestly, we should work towards NOT needing dev_fwnode(). The
function literally dereferences dev->fwnode or the one inside of_node.
So my dereference is fine. The whole "fwnode might not be set for
devices with of_node" is wrong and we should fix that instead of
writing wrappers to work around it.

Also, for now I'm going to leave this as if for the same reasons as I
mentioned in Patch 1.

>
> + Blank line.

Ack.


-Saravana

>
> >       ret = gcdev_register(gdev, gpio_devt);
> >       if (ret)
> >               return ret;
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-28  7:33       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:27 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > Registering an irqdomain sets the flag for the fwnode. But having the
> > flag set when a device is added is interpreted by fw_devlink to mean the
> > device has already been initialized and will never probe. This prevents
> > fw_devlink from creating device links with the gpio_device as a
> > supplier. So, clear the flag before adding the device.
>
> ...
>
> > +     /*
> > +      * If fwnode doesn't belong to another device, it's safe to clear its
> > +      * initialized flag.
> > +      */
> > +     if (!gdev->dev.fwnode->dev)
> > +             fwnode_dev_initialized(gdev->dev.fwnode, false);
>
> Do not dereference fwnode in struct device. Use dev_fwnode() for that.
>
>         struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
>
>         if (!fwnode->dev)
>                 fwnode_dev_initialized(fwnode, false);

Honestly, we should work towards NOT needing dev_fwnode(). The
function literally dereferences dev->fwnode or the one inside of_node.
So my dereference is fine. The whole "fwnode might not be set for
devices with of_node" is wrong and we should fix that instead of
writing wrappers to work around it.

Also, for now I'm going to leave this as if for the same reasons as I
mentioned in Patch 1.

>
> + Blank line.

Ack.


-Saravana

>
> >       ret = gcdev_register(gdev, gpio_devt);
> >       if (ret)
> >               return ret;
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-27  9:29     ` Andy Shevchenko
@ 2023-01-28  7:34       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:
> > fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
> > purposes:
> >
> > 1. To allow a parent device to proxy its child device's dependency on a
> >    supplier so that the supplier doesn't get its sync_state() callback
> >    before the child device/consumer can be added and probed. In this
> >    usage scenario, we need to ignore cycles for ensure correctness of
> >    sync_state() callbacks.
> >
> > 2. When there are dependency cycles in firmware, we don't know which of
> >    those dependencies are valid. So, we have to ignore them all wrt
> >    probe ordering while still making sure the sync_state() callbacks
> >    come correctly.
> >
> > However, when detecting dependency cycles, there can be multiple
> > dependency cycles between two devices that we need to detect. For
> > example:
> >
> > A -> B -> A and A -> C -> B -> A.
> >
> > To detect multiple cycles correct, we need to be able to differentiate
> > DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.
> >
> > To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
> > mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
> > DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
> > dependency cycles.
>
> ...
>
> > +static inline bool device_link_flag_is_sync_state_only(u32 flags)
> > +{
> > +     return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
> > +             == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
>
> Weird indentation, why not
>
>         return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) ==
>                (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
>
> ?

Ack. Will fix in v3.

>
> > +}
>
> ...
>
> >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> >                              DL_FLAG_SYNC_STATE_ONLY | \
> > -                            DL_FLAG_INFERRED)
> > +                            DL_FLAG_INFERRED | \
> > +                            DL_FLAG_CYCLE)
>
> You can make less churn by squeezing the new one above the last one.

I feel like this part is getting bike shedded. I'm going to leave it
as is. It's done in the order it's defined in the header and keeping
it that way makes it way more easier to read than worry about a single
line churn.


-Saravana

>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-28  7:34       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:
> > fw_devlink uses DL_FLAG_SYNC_STATE_ONLY device link flag for two
> > purposes:
> >
> > 1. To allow a parent device to proxy its child device's dependency on a
> >    supplier so that the supplier doesn't get its sync_state() callback
> >    before the child device/consumer can be added and probed. In this
> >    usage scenario, we need to ignore cycles for ensure correctness of
> >    sync_state() callbacks.
> >
> > 2. When there are dependency cycles in firmware, we don't know which of
> >    those dependencies are valid. So, we have to ignore them all wrt
> >    probe ordering while still making sure the sync_state() callbacks
> >    come correctly.
> >
> > However, when detecting dependency cycles, there can be multiple
> > dependency cycles between two devices that we need to detect. For
> > example:
> >
> > A -> B -> A and A -> C -> B -> A.
> >
> > To detect multiple cycles correct, we need to be able to differentiate
> > DL_FLAG_SYNC_STATE_ONLY device links used for (1) vs (2) above.
> >
> > To allow this differentiation, add a DL_FLAG_CYCLE that can be use to
> > mark use case (2). We can then use the DL_FLAG_CYCLE to decide which
> > DL_FLAG_SYNC_STATE_ONLY device links to follow when looking for
> > dependency cycles.
>
> ...
>
> > +static inline bool device_link_flag_is_sync_state_only(u32 flags)
> > +{
> > +     return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE))
> > +             == (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
>
> Weird indentation, why not
>
>         return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) ==
>                (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED);
>
> ?

Ack. Will fix in v3.

>
> > +}
>
> ...
>
> >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> >                              DL_FLAG_SYNC_STATE_ONLY | \
> > -                            DL_FLAG_INFERRED)
> > +                            DL_FLAG_INFERRED | \
> > +                            DL_FLAG_CYCLE)
>
> You can make less churn by squeezing the new one above the last one.

I feel like this part is getting bike shedded. I'm going to leave it
as is. It's done in the order it's defined in the header and keeping
it that way makes it way more easier to read than worry about a single
line churn.


-Saravana

>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
  2023-01-27  9:33     ` Andy Shevchenko
@ 2023-01-28  7:34       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:33 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:
> > To improve detection and handling of dependency cycles, we need to be
> > able to mark fwnode links as being part of cycles. fwnode links marked
> > as being part of a cycle should not block their consumers from probing.
>
> ...
>
> > +     list_for_each_entry(link, &fwnode->suppliers, c_hook) {
> > +             if (link->flags & FWLINK_FLAG_CYCLE)
> > +                     continue;
> > +             return link->supplier;
>
> Hmm...

Thanks!

>
>                 if (!(link->flags & FWLINK_FLAG_CYCLE))
>                         return link->supplier;
>
> ?
>
> > +     }
> > +
> > +     return NULL;
>
> ...
>
> > -     if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> > -         !fw_devlink_is_permissive()) {
> > -             sup_fw = list_first_entry(&dev->fwnode->suppliers,
> > -                                       struct fwnode_link,
> > -                                       c_hook)->supplier;
> > +     sup_fw = fwnode_links_check_suppliers(dev->fwnode);
>
> dev_fwnode() ?
>
> ...
>
> > -     val = !list_empty(&dev->fwnode->suppliers);
> > +     mutex_lock(&fwnode_link_lock);
> > +     val = !!fwnode_links_check_suppliers(dev->fwnode);
>
> Ditto?

Similar response as Patch 1 and Patch 4.


-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
@ 2023-01-28  7:34       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:33 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:
> > To improve detection and handling of dependency cycles, we need to be
> > able to mark fwnode links as being part of cycles. fwnode links marked
> > as being part of a cycle should not block their consumers from probing.
>
> ...
>
> > +     list_for_each_entry(link, &fwnode->suppliers, c_hook) {
> > +             if (link->flags & FWLINK_FLAG_CYCLE)
> > +                     continue;
> > +             return link->supplier;
>
> Hmm...

Thanks!

>
>                 if (!(link->flags & FWLINK_FLAG_CYCLE))
>                         return link->supplier;
>
> ?
>
> > +     }
> > +
> > +     return NULL;
>
> ...
>
> > -     if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> > -         !fw_devlink_is_permissive()) {
> > -             sup_fw = list_first_entry(&dev->fwnode->suppliers,
> > -                                       struct fwnode_link,
> > -                                       c_hook)->supplier;
> > +     sup_fw = fwnode_links_check_suppliers(dev->fwnode);
>
> dev_fwnode() ?
>
> ...
>
> > -     val = !list_empty(&dev->fwnode->suppliers);
> > +     mutex_lock(&fwnode_link_lock);
> > +     val = !!fwnode_links_check_suppliers(dev->fwnode);
>
> Ditto?

Similar response as Patch 1 and Patch 4.


-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-27  9:43     ` Andy Shevchenko
@ 2023-01-28  7:34       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > fw_devlink could only detect a single and simple cycle because it relied
> > mainly on device link cycle detection code that only checked for cycles
> > between devices. The expectation was that the firmware wouldn't have
> > complicated cycles and multiple cycles between devices. That expectation
> > has been proven to be wrong.
> >
> > For example, fw_devlink could handle:
> >
> > +-+        +-+
> > |A+------> |B+
> > +-+        +++
> >  ^          |
> >  |          |
> >  +----------+
> >
> > But it couldn't handle even something as "simple" as:
> >
> >  +---------------------+
> >  |                     |
> >  v                     |
> > +-+        +-+        +++
> > |A+------> |B+------> |C|
> > +-+        +++        +-+
> >  ^          |
> >  |          |
> >  +----------+
> >
> > But firmware has even more complicated cycles like:
> >
> >     +---------------------+
> >     |                     |
> >     v                     |
> >    +-+       +---+       +++
> > +--+A+------>| B +-----> |C|<--+
> > |  +-+       ++--+       +++   |
> > |   ^         | ^         |    |
> > |   |         | |         |    |
> > |   +---------+ +---------+    |
> > |                              |
> > +------------------------------+
> >
> > And this is without including parent child dependencies or nodes in the
> > cycle that are just firmware nodes that'll never have a struct device
> > created for them.
> >
> > The proper way to treat these devices it to not force any probe ordering
> > between them, while still enforce dependencies between node in the
> > cycles (A, B and C) and their consumers.
> >
> > So this patch goes all out and just deals with all types of cycles. It
> > does this by:
> >
> > 1. Following dependencies across device links, parent-child and fwnode
> >    links.
> > 2. When it find cycles, it mark the device links and fwnode links as
> >    such instead of just deleting them or making the indistinguishable
> >    from proxy SYNC_STATE_ONLY device links.
> >
> > This way, when new nodes get added, we can immediately find and mark any
> > new cycles whether the new node is a device or firmware node.
>
> ...
>
> > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > + * depend on @con.  This function can detect multiple cyles between @sup_handle
>
> A single space is enough.
>
> > + * and @con. When such dependency cycles are found, convert all device links
> > + * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark
>
> Ditto.
>
> > + * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
> > + * converted into a device link in the future, they are created as
> > + * SYNC_STATE_ONLY device links.  This is the equivalent of doing
>
> Ditto.

Lol, you are the king of nit picks :) I don't know how you even notice
these :) I don't like the double spacing either, but as Geert pointed
out, vim inserts them when I use it to auto word-wrap comment blocks.
I'll try to address them as I find them, but I'm not going to send out
revisions of patches just for double spaces.

>
> > + * fw_devlink=permissive just between the devices in the cycle. We need to do
> > + * this because, at this point, fw_devlink can't tell which of these
> > + * dependencies is not a real dependency.
> > + *
> > + * Return true if one or more cycles were found. Otherwise, return false.
>
> Return:

I'm following the rest of the function docs in this file.

>
> (you may run `kernel-doc -v ...` to see all warnings)

Hmmm I ran it on the patch file and it didn't give me anything useful.
Running it on the whole file is just a lot of lines to dig through.

>
> ...
>
> > +static bool __fw_devlink_relax_cycles(struct device *con,
> > +                              struct fwnode_handle *sup_handle)
> > +{
> > +     struct fwnode_link *link;
> > +     struct device_link *dev_link;
>
> > +     struct device *sup_dev = NULL, *par_dev = NULL;
>
> You can put it the first line since it's long enough.

Wait, is that a style guideline to have the longer lines first?

> But why do you need sup_dev assignment?

Defensive programming I suppose. I can see this function being
refactored in the future where a goto out; is inserted before sup_dev
is assigned. And then the put_device(sup_dev) at "out" will end up
operating on some junk value and causing memory corruption.

>
> > +     bool ret = false;
> > +
> > +     if (!sup_handle)
> > +             return false;
> > +
> > +     /*
> > +      * We aren't trying to find all cycles. Just a cycle between con and
> > +      * sup_handle.
> > +      */
> > +     if (sup_handle->flags & FWNODE_FLAG_VISITED)
> > +             return false;
> > +
> > +     sup_handle->flags |= FWNODE_FLAG_VISITED;
>
> > +     sup_dev = get_dev_from_fwnode(sup_handle);
> > +
>
> I would put it closer to the condition:
>
> > +     /* Termination condition. */
> > +     if (sup_dev == con) {
>
>         /* Get supplier device and check for termination condition */
>         sup_dev = get_dev_from_fwnode(sup_handle);
>         if (sup_dev == con) {

I put it the way it is because sup_dev is used for more than just
checking for termination condition.

>
> > +             ret = true;
> > +             goto out;
> > +     }
> > +
> > +     /*
> > +      * If sup_dev is bound to a driver and @con hasn't started binding to
> > +      * a driver, @sup_dev can't be a consumer of @con.  So, no need to
>
> sup_dev or @sup_dev? What's the difference? Should you spell one of them
> in full?

Probably copy-pasta from a function doc. I'll make it sup_dev.

>
> > +      * check further.
> > +      */
> > +     if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&
>
> As in the comment above, the single space is enough.
>
> > +         con->links.status == DL_DEV_NO_DRIVER) {
> > +             ret = false;
> > +             goto out;
> > +     }
> > +
> > +     list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
> > +             if (__fw_devlink_relax_cycles(con, link->supplier)) {
> > +                     __fwnode_link_cycle(link);
> > +                     ret = true;
> > +             }
> > +     }
> > +
> > +     /*
> > +      * Give priority to device parent over fwnode parent to account for any
> > +      * quirks in how fwnodes are converted to devices.
> > +      */
>
> > +     if (sup_dev) {
> > +             par_dev = sup_dev->parent;
> > +             get_device(par_dev);
> > +     } else {
> > +             par_dev = fwnode_get_next_parent_dev(sup_handle);
> > +     }
>
>         if (sup_dev)
>                 par_dev = get_device(sup_dev->parent);
>         else
>                 par_dev = fwnode_get_next_parent_dev(sup_handle);

Ack, thanks. Makes it nicer.

>
> > +     if (par_dev)
> > +             ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);
>
> Instead I would rather do a similar pattern of the ret assignment as elsewhere
> in the function.
>
>         if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode))
>                 ret = true;

Ack. Good suggestion!

>
> > +     if (!sup_dev)
> > +             goto out;
> > +
> > +     list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
> > +             /*
> > +              * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
> > +              * such due to a cycle.
> > +              */
> > +             if (device_link_flag_is_sync_state_only(dev_link->flags) &&
> > +                 !(dev_link->flags & DL_FLAG_CYCLE))
> > +                     continue;
> > +
> > +             if (__fw_devlink_relax_cycles(con,
> > +                                           dev_link->supplier->fwnode)) {
>
> Keep it on one line.

It'll make it > 80. Is this some recent change about allowing > 80
cols? I'm leaving it as is for now.


> > +                     fw_devlink_relax_link(dev_link);
> > +                     dev_link->flags |= DL_FLAG_CYCLE;
> > +                     ret = true;
> > +             }
> > +     }
> > +
> > +out:
> > +     sup_handle->flags &= ~FWNODE_FLAG_VISITED;
> > +     put_device(sup_dev);
> > +     put_device(par_dev);
> > +     return ret;
> > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-28  7:34       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > fw_devlink could only detect a single and simple cycle because it relied
> > mainly on device link cycle detection code that only checked for cycles
> > between devices. The expectation was that the firmware wouldn't have
> > complicated cycles and multiple cycles between devices. That expectation
> > has been proven to be wrong.
> >
> > For example, fw_devlink could handle:
> >
> > +-+        +-+
> > |A+------> |B+
> > +-+        +++
> >  ^          |
> >  |          |
> >  +----------+
> >
> > But it couldn't handle even something as "simple" as:
> >
> >  +---------------------+
> >  |                     |
> >  v                     |
> > +-+        +-+        +++
> > |A+------> |B+------> |C|
> > +-+        +++        +-+
> >  ^          |
> >  |          |
> >  +----------+
> >
> > But firmware has even more complicated cycles like:
> >
> >     +---------------------+
> >     |                     |
> >     v                     |
> >    +-+       +---+       +++
> > +--+A+------>| B +-----> |C|<--+
> > |  +-+       ++--+       +++   |
> > |   ^         | ^         |    |
> > |   |         | |         |    |
> > |   +---------+ +---------+    |
> > |                              |
> > +------------------------------+
> >
> > And this is without including parent child dependencies or nodes in the
> > cycle that are just firmware nodes that'll never have a struct device
> > created for them.
> >
> > The proper way to treat these devices it to not force any probe ordering
> > between them, while still enforce dependencies between node in the
> > cycles (A, B and C) and their consumers.
> >
> > So this patch goes all out and just deals with all types of cycles. It
> > does this by:
> >
> > 1. Following dependencies across device links, parent-child and fwnode
> >    links.
> > 2. When it find cycles, it mark the device links and fwnode links as
> >    such instead of just deleting them or making the indistinguishable
> >    from proxy SYNC_STATE_ONLY device links.
> >
> > This way, when new nodes get added, we can immediately find and mark any
> > new cycles whether the new node is a device or firmware node.
>
> ...
>
> > + * Check if @sup_handle or any of its ancestors or suppliers direct/indirectly
> > + * depend on @con.  This function can detect multiple cyles between @sup_handle
>
> A single space is enough.
>
> > + * and @con. When such dependency cycles are found, convert all device links
> > + * created solely by fw_devlink into SYNC_STATE_ONLY device links.  Also, mark
>
> Ditto.
>
> > + * all fwnode links in the cycle with FWLINK_FLAG_CYCLE so that when they are
> > + * converted into a device link in the future, they are created as
> > + * SYNC_STATE_ONLY device links.  This is the equivalent of doing
>
> Ditto.

Lol, you are the king of nit picks :) I don't know how you even notice
these :) I don't like the double spacing either, but as Geert pointed
out, vim inserts them when I use it to auto word-wrap comment blocks.
I'll try to address them as I find them, but I'm not going to send out
revisions of patches just for double spaces.

>
> > + * fw_devlink=permissive just between the devices in the cycle. We need to do
> > + * this because, at this point, fw_devlink can't tell which of these
> > + * dependencies is not a real dependency.
> > + *
> > + * Return true if one or more cycles were found. Otherwise, return false.
>
> Return:

I'm following the rest of the function docs in this file.

>
> (you may run `kernel-doc -v ...` to see all warnings)

Hmmm I ran it on the patch file and it didn't give me anything useful.
Running it on the whole file is just a lot of lines to dig through.

>
> ...
>
> > +static bool __fw_devlink_relax_cycles(struct device *con,
> > +                              struct fwnode_handle *sup_handle)
> > +{
> > +     struct fwnode_link *link;
> > +     struct device_link *dev_link;
>
> > +     struct device *sup_dev = NULL, *par_dev = NULL;
>
> You can put it the first line since it's long enough.

Wait, is that a style guideline to have the longer lines first?

> But why do you need sup_dev assignment?

Defensive programming I suppose. I can see this function being
refactored in the future where a goto out; is inserted before sup_dev
is assigned. And then the put_device(sup_dev) at "out" will end up
operating on some junk value and causing memory corruption.

>
> > +     bool ret = false;
> > +
> > +     if (!sup_handle)
> > +             return false;
> > +
> > +     /*
> > +      * We aren't trying to find all cycles. Just a cycle between con and
> > +      * sup_handle.
> > +      */
> > +     if (sup_handle->flags & FWNODE_FLAG_VISITED)
> > +             return false;
> > +
> > +     sup_handle->flags |= FWNODE_FLAG_VISITED;
>
> > +     sup_dev = get_dev_from_fwnode(sup_handle);
> > +
>
> I would put it closer to the condition:
>
> > +     /* Termination condition. */
> > +     if (sup_dev == con) {
>
>         /* Get supplier device and check for termination condition */
>         sup_dev = get_dev_from_fwnode(sup_handle);
>         if (sup_dev == con) {

I put it the way it is because sup_dev is used for more than just
checking for termination condition.

>
> > +             ret = true;
> > +             goto out;
> > +     }
> > +
> > +     /*
> > +      * If sup_dev is bound to a driver and @con hasn't started binding to
> > +      * a driver, @sup_dev can't be a consumer of @con.  So, no need to
>
> sup_dev or @sup_dev? What's the difference? Should you spell one of them
> in full?

Probably copy-pasta from a function doc. I'll make it sup_dev.

>
> > +      * check further.
> > +      */
> > +     if (sup_dev && sup_dev->links.status ==  DL_DEV_DRIVER_BOUND &&
>
> As in the comment above, the single space is enough.
>
> > +         con->links.status == DL_DEV_NO_DRIVER) {
> > +             ret = false;
> > +             goto out;
> > +     }
> > +
> > +     list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
> > +             if (__fw_devlink_relax_cycles(con, link->supplier)) {
> > +                     __fwnode_link_cycle(link);
> > +                     ret = true;
> > +             }
> > +     }
> > +
> > +     /*
> > +      * Give priority to device parent over fwnode parent to account for any
> > +      * quirks in how fwnodes are converted to devices.
> > +      */
>
> > +     if (sup_dev) {
> > +             par_dev = sup_dev->parent;
> > +             get_device(par_dev);
> > +     } else {
> > +             par_dev = fwnode_get_next_parent_dev(sup_handle);
> > +     }
>
>         if (sup_dev)
>                 par_dev = get_device(sup_dev->parent);
>         else
>                 par_dev = fwnode_get_next_parent_dev(sup_handle);

Ack, thanks. Makes it nicer.

>
> > +     if (par_dev)
> > +             ret |= __fw_devlink_relax_cycles(con, par_dev->fwnode);
>
> Instead I would rather do a similar pattern of the ret assignment as elsewhere
> in the function.
>
>         if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode))
>                 ret = true;

Ack. Good suggestion!

>
> > +     if (!sup_dev)
> > +             goto out;
> > +
> > +     list_for_each_entry(dev_link, &sup_dev->links.suppliers, c_node) {
> > +             /*
> > +              * Ignore a SYNC_STATE_ONLY flag only if it wasn't marked as a
> > +              * such due to a cycle.
> > +              */
> > +             if (device_link_flag_is_sync_state_only(dev_link->flags) &&
> > +                 !(dev_link->flags & DL_FLAG_CYCLE))
> > +                     continue;
> > +
> > +             if (__fw_devlink_relax_cycles(con,
> > +                                           dev_link->supplier->fwnode)) {
>
> Keep it on one line.

It'll make it > 80. Is this some recent change about allowing > 80
cols? I'm leaving it as is for now.


> > +                     fw_devlink_relax_link(dev_link);
> > +                     dev_link->flags |= DL_FLAG_CYCLE;
> > +                     ret = true;
> > +             }
> > +     }
> > +
> > +out:
> > +     sup_handle->flags &= ~FWNODE_FLAG_VISITED;
> > +     put_device(sup_dev);
> > +     put_device(par_dev);
> > +     return ret;
> > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
  2023-01-27  9:51     ` Andy Shevchenko
@ 2023-01-28  7:34       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:51 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:37PM -0800, Saravana Kannan wrote:
> > Since this device is only partially initialized by the irqchip driver,
> > we need to mark the fwnode device as not initialized. This is to let
> > fw_devlink know that the device will be completely initialized at a
> > later point. That way, fw_devlink will continue to defer the probe of
> > the power domain consumers till the power domain driver successfully
> > binds to the struct device and completes the initialization of the
> > device.
>
> ...
>
> >               pd_pdev->dev.of_node = np;
> > +             pd_pdev->dev.fwnode = of_fwnode_handle(np);
>
> Instead,
>
>                 device_set_node(&pd_dev->dev, of_fwnode_handle(np));

Ack


-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
@ 2023-01-28  7:34       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-28  7:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 1:51 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jan 26, 2023 at 04:11:37PM -0800, Saravana Kannan wrote:
> > Since this device is only partially initialized by the irqchip driver,
> > we need to mark the fwnode device as not initialized. This is to let
> > fw_devlink know that the device will be completely initialized at a
> > later point. That way, fw_devlink will continue to defer the probe of
> > the power domain consumers till the power domain driver successfully
> > binds to the struct device and completes the initialization of the
> > device.
>
> ...
>
> >               pd_pdev->dev.of_node = np;
> > +             pd_pdev->dev.fwnode = of_fwnode_handle(np);
>
> Instead,
>
>                 device_set_node(&pd_dev->dev, of_fwnode_handle(np));

Ack


-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-28  7:18       ` Saravana Kannan
@ 2023-01-30  8:42         ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-30  8:42 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > tree node will not have a struct device created for it. This information
> > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > device tree node.
> > >
> > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > effect without using OF specific flags. This allows more generic code to
> > > be written in driver core.
> > >
> > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> >
> > Thanks for your patch!
> >
> > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > >
> > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > >         if (!error)
> > > -               of_node_set_flag(np, OF_POPULATED);
> > > +               fwnode_dev_initialized(&np->fwnode, true);
> >
> > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > it should work fine.
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > i.e. will queue in renesas-devel for v6.4.
>
> Thanks! Does that mean I should drop this from this series? If two
> maintainers pick the same patch up, will it cause problems? I'm
> eventually expecting this series to be picked up by Greg into
> driver-core-next.

Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
through the renesas-devel and soc trees. This patch has no dependencies
on anything else in the series (or vice versa), so there is no reason
to deviate from that, and possibly cause conflicts later.

BTW, I will convert to of_node_to_fwnode() while applying.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-30  8:42         ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-30  8:42 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > tree node will not have a struct device created for it. This information
> > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > device tree node.
> > >
> > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > effect without using OF specific flags. This allows more generic code to
> > > be written in driver core.
> > >
> > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> >
> > Thanks for your patch!
> >
> > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > >
> > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > >         if (!error)
> > > -               of_node_set_flag(np, OF_POPULATED);
> > > +               fwnode_dev_initialized(&np->fwnode, true);
> >
> > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > it should work fine.
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > i.e. will queue in renesas-devel for v6.4.
>
> Thanks! Does that mean I should drop this from this series? If two
> maintainers pick the same patch up, will it cause problems? I'm
> eventually expecting this series to be picked up by Greg into
> driver-core-next.

Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
through the renesas-devel and soc trees. This patch has no dependencies
on anything else in the series (or vice versa), so there is no reason
to deviate from that, and possibly cause conflicts later.

BTW, I will convert to of_node_to_fwnode() while applying.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* [PATCH v2 00/11] fw_devlink improvements
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-30  8:55   ` Naresh Kamboju
  -1 siblings, 0 replies; 146+ messages in thread
From: Naresh Kamboju @ 2023-01-30  8:55 UTC (permalink / raw)
  To: saravanak
  Cc: abel.vesa, alexander.stein, andriy.shevchenko, bigunclemax, brgl,
	colin.foster, cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, naresh.kamboju, rafael,
	robh+dt, s.hauer, sakari.ailus, shawnguo, sudeep.holla, tglx,
	tony

Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
sparc and x86_64.

Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
Boot failed on FVP.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Please refer following link for details of testing.
FVP boot log failed.
https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/


[    2.613437] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[    2.613628] Mem abort info:
[    2.613756]   ESR = 0x0000000096000005
[    2.613904]   EC = 0x25: DABT (current EL), IL = 32 bits
[    2.614071]   SET = 0, FnV = 0
[    2.614215]   EA = 0, S1PTW = 0
[    2.614358]   FSC = 0x05: level 1 translation fault
[    2.614517] Data abort info:
[    2.614647]   ISV = 0, ISS = 0x00000005
[    2.614792]   CM = 0, WnR = 0
[    2.614934] [0000000000000010] user address but active_mm is swapper
[    2.615105] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[    2.615219] Modules linked in:
[    2.615310] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc5 #1
[    2.615445] Hardware name: FVP Base RevC (DT)
[    2.615533] pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
[    2.615685] pc : gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
[    2.615816] lr : gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
[    2.615970] sp : ffff8000081af5e0
[    2.616051] x29: ffff8000081af5e0 x28: 0000000000000000 x27: ffff0008027cb5a0
[    2.616261] x26: 0000000000000000 x25: ffffd7c5d6745910 x24: ffff0008027f4800
[    2.616472] x23: 0000000000000000 x22: ffffd7c5d62b99a8 x21: 0000000000000202
[    2.616679] x20: 0000000000000000 x19: ffff0008027f4800 x18: ffffffffffffffff
[    2.616890] x17: ffffd7c5d6467928 x16: 0000000013e3690a x15: ffff8000081af3b0
[    2.617102] x14: ffff00080275cd8a x13: ffff00080275cd88 x12: 0000000000000001
[    2.617312] x11: 62726568746f6d3a x10: 0000000000000000 x9 : ffffd7c5d3b3ebe0
[    2.617522] x8 : ffff8000081af548 x7 : 0000000000000000 x6 : 0000000000000001
[    2.617727] x5 : 0000000000000000 x4 : ffff000800640000 x3 : ffffd7c5d62b99c8
[    2.617933] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
[    2.618138] Call trace:
[    2.618204] gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
[    2.618337] gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
[    2.618493] devm_gpiochip_add_data_with_key (drivers/gpio/gpiolib-devres.c:478) 
[    2.618654] bgpio_pdev_probe (drivers/gpio/gpio-mmio.c:793) 
[    2.618785] platform_probe (drivers/base/platform.c:1401) 
[    2.618928] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
[    2.619056] __driver_probe_device (drivers/base/dd.c:778) 
[    2.619193] driver_probe_device (drivers/base/dd.c:808) 
[    2.619329] __device_attach_driver (drivers/base/dd.c:937) 
[    2.619464] bus_for_each_drv (drivers/base/bus.c:427) 
[    2.619590] __device_attach (drivers/base/dd.c:1010) 
[    2.619722] device_initial_probe (drivers/base/dd.c:1058) 
[    2.619861] bus_probe_device (drivers/base/bus.c:489) 
[    2.619988] device_add (drivers/base/core.c:3637) 
[    2.620102] platform_device_add (drivers/base/platform.c:717) 
[    2.620251] mfd_add_device (drivers/mfd/mfd-core.c:297) 
[    2.620397] devm_mfd_add_devices (drivers/mfd/mfd-core.c:351 drivers/mfd/mfd-core.c:449) 
[    2.620548] vexpress_sysreg_probe (drivers/mfd/vexpress-sysreg.c:115) 
[    2.620672] platform_probe (drivers/base/platform.c:1401) 
[    2.620814] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
[    2.620940] __driver_probe_device (drivers/base/dd.c:778) 
[    2.621080] driver_probe_device (drivers/base/dd.c:808) 
[    2.621216] __driver_attach (drivers/base/dd.c:1195) 
[    2.621344] bus_for_each_dev (drivers/base/bus.c:301) 
[    2.621467] driver_attach (drivers/base/dd.c:1212) 
[    2.621596] bus_add_driver (drivers/base/bus.c:618) 
[    2.621720] driver_register (drivers/base/driver.c:246) 
[    2.621859] __platform_driver_register (drivers/base/platform.c:868) 
[    2.622012] vexpress_sysreg_driver_init (drivers/mfd/vexpress-sysreg.c:134) 
[    2.622145] do_one_initcall (init/main.c:1306) 
[    2.622269] kernel_init_freeable (init/main.c:1378 init/main.c:1395 init/main.c:1414 init/main.c:1634) 
[    2.622394] kernel_init (init/main.c:1526) 
[    2.622531] ret_from_fork (arch/arm64/kernel/entry.S:864) 
[ 2.622692] Code: 910003fd a90153f3 aa0003f3 f9414c00 (f9400801)
All code
========
   0:*	fd                   	std    		<-- trapping instruction
   1:	03 00                	add    (%rax),%eax
   3:	91                   	xchg   %eax,%ecx
   4:	f3 53                	repz push %rbx
   6:	01 a9 f3 03 00 aa    	add    %ebp,-0x55fffc0d(%rcx)
   c:	00 4c 41 f9          	add    %cl,-0x7(%rcx,%rax,2)
  10:	01 08                	add    %ecx,(%rax)
  12:	40 f9                	rex stc 

Code starting with the faulting instruction
===========================================
   0:	01 08                	add    %ecx,(%rax)
   2:	40 f9                	rex stc 
[    2.622807] ---[ end trace 0000000000000000 ]---
[    2.623043] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.623157] SMP: stopping secondary CPUs
[    2.623303] Kernel Offset: 0x57c5cb400000 from 0xffff800008000000
[    2.623413] PHYS_OFFSET: 0x80000000
[    2.623492] CPU features: 0x00000,001439ff,cd3e772f
[    2.623591] Memory Limit: none
[    2.623679] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---


ref:
 - https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/?results_layout=table&failures_only=false#!?details=#test-results



--
Linaro LKFT
https://lkft.linaro.org


^ permalink raw reply	[flat|nested] 146+ messages in thread

* [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-30  8:55   ` Naresh Kamboju
  0 siblings, 0 replies; 146+ messages in thread
From: Naresh Kamboju @ 2023-01-30  8:55 UTC (permalink / raw)
  To: saravanak
  Cc: abel.vesa, alexander.stein, andriy.shevchenko, bigunclemax, brgl,
	colin.foster, cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, naresh.kamboju, rafael,
	robh+dt, s.hauer, sakari.ailus, shawnguo, sudeep.holla, tglx,
	tony

Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
sparc and x86_64.

Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
Boot failed on FVP.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Please refer following link for details of testing.
FVP boot log failed.
https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/


[    2.613437] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[    2.613628] Mem abort info:
[    2.613756]   ESR = 0x0000000096000005
[    2.613904]   EC = 0x25: DABT (current EL), IL = 32 bits
[    2.614071]   SET = 0, FnV = 0
[    2.614215]   EA = 0, S1PTW = 0
[    2.614358]   FSC = 0x05: level 1 translation fault
[    2.614517] Data abort info:
[    2.614647]   ISV = 0, ISS = 0x00000005
[    2.614792]   CM = 0, WnR = 0
[    2.614934] [0000000000000010] user address but active_mm is swapper
[    2.615105] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[    2.615219] Modules linked in:
[    2.615310] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc5 #1
[    2.615445] Hardware name: FVP Base RevC (DT)
[    2.615533] pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
[    2.615685] pc : gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
[    2.615816] lr : gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
[    2.615970] sp : ffff8000081af5e0
[    2.616051] x29: ffff8000081af5e0 x28: 0000000000000000 x27: ffff0008027cb5a0
[    2.616261] x26: 0000000000000000 x25: ffffd7c5d6745910 x24: ffff0008027f4800
[    2.616472] x23: 0000000000000000 x22: ffffd7c5d62b99a8 x21: 0000000000000202
[    2.616679] x20: 0000000000000000 x19: ffff0008027f4800 x18: ffffffffffffffff
[    2.616890] x17: ffffd7c5d6467928 x16: 0000000013e3690a x15: ffff8000081af3b0
[    2.617102] x14: ffff00080275cd8a x13: ffff00080275cd88 x12: 0000000000000001
[    2.617312] x11: 62726568746f6d3a x10: 0000000000000000 x9 : ffffd7c5d3b3ebe0
[    2.617522] x8 : ffff8000081af548 x7 : 0000000000000000 x6 : 0000000000000001
[    2.617727] x5 : 0000000000000000 x4 : ffff000800640000 x3 : ffffd7c5d62b99c8
[    2.617933] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
[    2.618138] Call trace:
[    2.618204] gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
[    2.618337] gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
[    2.618493] devm_gpiochip_add_data_with_key (drivers/gpio/gpiolib-devres.c:478) 
[    2.618654] bgpio_pdev_probe (drivers/gpio/gpio-mmio.c:793) 
[    2.618785] platform_probe (drivers/base/platform.c:1401) 
[    2.618928] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
[    2.619056] __driver_probe_device (drivers/base/dd.c:778) 
[    2.619193] driver_probe_device (drivers/base/dd.c:808) 
[    2.619329] __device_attach_driver (drivers/base/dd.c:937) 
[    2.619464] bus_for_each_drv (drivers/base/bus.c:427) 
[    2.619590] __device_attach (drivers/base/dd.c:1010) 
[    2.619722] device_initial_probe (drivers/base/dd.c:1058) 
[    2.619861] bus_probe_device (drivers/base/bus.c:489) 
[    2.619988] device_add (drivers/base/core.c:3637) 
[    2.620102] platform_device_add (drivers/base/platform.c:717) 
[    2.620251] mfd_add_device (drivers/mfd/mfd-core.c:297) 
[    2.620397] devm_mfd_add_devices (drivers/mfd/mfd-core.c:351 drivers/mfd/mfd-core.c:449) 
[    2.620548] vexpress_sysreg_probe (drivers/mfd/vexpress-sysreg.c:115) 
[    2.620672] platform_probe (drivers/base/platform.c:1401) 
[    2.620814] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
[    2.620940] __driver_probe_device (drivers/base/dd.c:778) 
[    2.621080] driver_probe_device (drivers/base/dd.c:808) 
[    2.621216] __driver_attach (drivers/base/dd.c:1195) 
[    2.621344] bus_for_each_dev (drivers/base/bus.c:301) 
[    2.621467] driver_attach (drivers/base/dd.c:1212) 
[    2.621596] bus_add_driver (drivers/base/bus.c:618) 
[    2.621720] driver_register (drivers/base/driver.c:246) 
[    2.621859] __platform_driver_register (drivers/base/platform.c:868) 
[    2.622012] vexpress_sysreg_driver_init (drivers/mfd/vexpress-sysreg.c:134) 
[    2.622145] do_one_initcall (init/main.c:1306) 
[    2.622269] kernel_init_freeable (init/main.c:1378 init/main.c:1395 init/main.c:1414 init/main.c:1634) 
[    2.622394] kernel_init (init/main.c:1526) 
[    2.622531] ret_from_fork (arch/arm64/kernel/entry.S:864) 
[ 2.622692] Code: 910003fd a90153f3 aa0003f3 f9414c00 (f9400801)
All code
========
   0:*	fd                   	std    		<-- trapping instruction
   1:	03 00                	add    (%rax),%eax
   3:	91                   	xchg   %eax,%ecx
   4:	f3 53                	repz push %rbx
   6:	01 a9 f3 03 00 aa    	add    %ebp,-0x55fffc0d(%rcx)
   c:	00 4c 41 f9          	add    %cl,-0x7(%rcx,%rax,2)
  10:	01 08                	add    %ecx,(%rax)
  12:	40 f9                	rex stc 

Code starting with the faulting instruction
===========================================
   0:	01 08                	add    %ecx,(%rax)
   2:	40 f9                	rex stc 
[    2.622807] ---[ end trace 0000000000000000 ]---
[    2.623043] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.623157] SMP: stopping secondary CPUs
[    2.623303] Kernel Offset: 0x57c5cb400000 from 0xffff800008000000
[    2.623413] PHYS_OFFSET: 0x80000000
[    2.623492] CPU features: 0x00000,001439ff,cd3e772f
[    2.623591] Memory Limit: none
[    2.623679] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---


ref:
 - https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/?results_layout=table&failures_only=false#!?details=#test-results



--
Linaro LKFT
https://lkft.linaro.org


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-27  0:11 ` Saravana Kannan
@ 2023-01-30 10:48   ` Miquel Raynal
  -1 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-01-30 10:48 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Maxim & Maxim,

saravanak@google.com wrote on Thu, 26 Jan 2023 16:11:27 -0800:

> This patch series improves fw_devlink in the following ways:
> 
> 1. It no longer cares about a fwnode having a "compatible" property. It
>    figures this our more dynamically. The only expectation is that
>    fwnode that are converted to devices actually get probed by a driver
>    for the dependencies to be enforced correctly.
> 
> 2. Finer grained dependency tracking. fw_devlink will now create device
>    links from the consumer to the actual resource's device (if it has one,
>    Eg: gpio_device) instead of the parent supplier device. This improves
>    things like async suspend/resume ordering, potentially remove the need
>    for frameworks to create device links, more parallelized async probing,
>    and better sync_state() tracking.
> 
> 3. Handle hardware/software quirks where a child firmware node gets
>    populated as a device before its parent firmware node AND actually
>    supplies a non-optional resource to the parent firmware node's
>    device.
> 
> 4. Way more robust at cycle handling (see patch for the insane cases).
> 
> 5. Stops depending on OF_POPULATED to figure out some corner cases.
> 
> 6. Simplifies the work that needs to be done by the firmware specific
>    code.
> 
> Sorry it took a while to roll in the fixes I gave in the v1 series
> thread[1] into a v2 series.
> 
> Since I didn't make any additional changes on top of what I already gave
> in the v1 thread and Dmitry is very eager to get this series going, I'm
> sending it out without testing locally. I already tested these patches a
> few months ago as part of the v1 series. So I don't expect any major
> issues. I'll test them again on my end in the next few days and will
> report here if I actually find anything wrong.
> 
> Tony, Naresh, Abel, Sudeep, Geert,
> 
> I got the following reviewed by's and tested by's a few months back, but
> it's been 5 months since I sent out v1. So I wasn't sure if it was okay
> to include them in the v2 commits. Let me know if you are okay with this
> being included in the commits and/or if you want to test this series
> again.
> 
> Reviewed-by: Tony Lindgren <tony@atomide.com>
> Tested-by: Tony Lindgren <tony@atomide.com>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Tested-by: Abel Vesa <abel.vesa@linaro.org>
> Tested-by: Sudeep Holla <sudeep.holla@arm.com>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> 
> I've Cc-ed you because I had pointed you to v1 of this series + the
> patches in that thread at one point or another as a fix to some issue
> you were facing. It'd appreciate it if you can test this series and
> report any issues, or things it fixed and give Tested-bys.

Maxim & Maxim I would really appreciate if you could validate that the
original issue you had is solved with this version? I don't have any
hardware suffering from this issue.

> In addition, if you can also apply a revert of this series[2] and delete
> driver_deferred_probe_check_state() from your tree and see if you hit
> any issues and report them, that'd be great too! I'm pretty sure some of
> you will hit issues with that. I want to fix those next and then
> revert[2].
> 
> Thanks,
> Saravana
> 
> [1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
> [2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
> [3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/
> 
> v1 -> v2:
> - Fixed Patch 1 to handle a corner case discussed in [3].
> - New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
> - New patch 11 to add fw_devlink support for SCMI devices.
> 
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: John Stultz <jstultz@google.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Maxim Kiselev <bigunclemax@gmail.com>
> Cc: Maxim Kochetkov <fido_max@inbox.ru>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Luca Weiss <luca.weiss@fairphone.com>
> Cc: Colin Foster <colin.foster@in-advantage.com>
> Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
> Cc: Jean-Philippe Brucker <jpb@kernel.org>
> 
> Saravana Kannan (11):
>   driver core: fw_devlink: Don't purge child fwnode's consumer links
>   driver core: fw_devlink: Improve check for fwnode with no
>     device/driver
>   soc: renesas: Move away from using OF_POPULATED for fw_devlink
>   gpiolib: Clear the gpio_device's fwnode initialized flag before adding
>   driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
>   driver core: fw_devlink: Allow marking a fwnode link as being part of
>     a cycle
>   driver core: fw_devlink: Consolidate device link flag computation
>   driver core: fw_devlink: Make cycle detection more robust
>   of: property: Simplify of_link_to_phandle()
>   irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
>   firmware: arm_scmi: Set fwnode for the scmi_device
> 
>  drivers/base/core.c             | 443 +++++++++++++++++++++-----------
>  drivers/firmware/arm_scmi/bus.c |   2 +
>  drivers/gpio/gpiolib.c          |   6 +
>  drivers/irqchip/irq-imx-gpcv2.c |   1 +
>  drivers/of/property.c           |  84 +-----
>  drivers/soc/imx/gpcv2.c         |   1 +
>  drivers/soc/renesas/rcar-sysc.c |   2 +-
>  include/linux/device.h          |   1 +
>  include/linux/fwnode.h          |  12 +-
>  9 files changed, 332 insertions(+), 220 deletions(-)
> 


Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-30 10:48   ` Miquel Raynal
  0 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-01-30 10:48 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Maxim & Maxim,

saravanak@google.com wrote on Thu, 26 Jan 2023 16:11:27 -0800:

> This patch series improves fw_devlink in the following ways:
> 
> 1. It no longer cares about a fwnode having a "compatible" property. It
>    figures this our more dynamically. The only expectation is that
>    fwnode that are converted to devices actually get probed by a driver
>    for the dependencies to be enforced correctly.
> 
> 2. Finer grained dependency tracking. fw_devlink will now create device
>    links from the consumer to the actual resource's device (if it has one,
>    Eg: gpio_device) instead of the parent supplier device. This improves
>    things like async suspend/resume ordering, potentially remove the need
>    for frameworks to create device links, more parallelized async probing,
>    and better sync_state() tracking.
> 
> 3. Handle hardware/software quirks where a child firmware node gets
>    populated as a device before its parent firmware node AND actually
>    supplies a non-optional resource to the parent firmware node's
>    device.
> 
> 4. Way more robust at cycle handling (see patch for the insane cases).
> 
> 5. Stops depending on OF_POPULATED to figure out some corner cases.
> 
> 6. Simplifies the work that needs to be done by the firmware specific
>    code.
> 
> Sorry it took a while to roll in the fixes I gave in the v1 series
> thread[1] into a v2 series.
> 
> Since I didn't make any additional changes on top of what I already gave
> in the v1 thread and Dmitry is very eager to get this series going, I'm
> sending it out without testing locally. I already tested these patches a
> few months ago as part of the v1 series. So I don't expect any major
> issues. I'll test them again on my end in the next few days and will
> report here if I actually find anything wrong.
> 
> Tony, Naresh, Abel, Sudeep, Geert,
> 
> I got the following reviewed by's and tested by's a few months back, but
> it's been 5 months since I sent out v1. So I wasn't sure if it was okay
> to include them in the v2 commits. Let me know if you are okay with this
> being included in the commits and/or if you want to test this series
> again.
> 
> Reviewed-by: Tony Lindgren <tony@atomide.com>
> Tested-by: Tony Lindgren <tony@atomide.com>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Tested-by: Abel Vesa <abel.vesa@linaro.org>
> Tested-by: Sudeep Holla <sudeep.holla@arm.com>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> 
> I've Cc-ed you because I had pointed you to v1 of this series + the
> patches in that thread at one point or another as a fix to some issue
> you were facing. It'd appreciate it if you can test this series and
> report any issues, or things it fixed and give Tested-bys.

Maxim & Maxim I would really appreciate if you could validate that the
original issue you had is solved with this version? I don't have any
hardware suffering from this issue.

> In addition, if you can also apply a revert of this series[2] and delete
> driver_deferred_probe_check_state() from your tree and see if you hit
> any issues and report them, that'd be great too! I'm pretty sure some of
> you will hit issues with that. I want to fix those next and then
> revert[2].
> 
> Thanks,
> Saravana
> 
> [1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
> [2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
> [3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/
> 
> v1 -> v2:
> - Fixed Patch 1 to handle a corner case discussed in [3].
> - New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
> - New patch 11 to add fw_devlink support for SCMI devices.
> 
> Cc: Abel Vesa <abel.vesa@linaro.org>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: John Stultz <jstultz@google.com>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Maxim Kiselev <bigunclemax@gmail.com>
> Cc: Maxim Kochetkov <fido_max@inbox.ru>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Luca Weiss <luca.weiss@fairphone.com>
> Cc: Colin Foster <colin.foster@in-advantage.com>
> Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
> Cc: Jean-Philippe Brucker <jpb@kernel.org>
> 
> Saravana Kannan (11):
>   driver core: fw_devlink: Don't purge child fwnode's consumer links
>   driver core: fw_devlink: Improve check for fwnode with no
>     device/driver
>   soc: renesas: Move away from using OF_POPULATED for fw_devlink
>   gpiolib: Clear the gpio_device's fwnode initialized flag before adding
>   driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
>   driver core: fw_devlink: Allow marking a fwnode link as being part of
>     a cycle
>   driver core: fw_devlink: Consolidate device link flag computation
>   driver core: fw_devlink: Make cycle detection more robust
>   of: property: Simplify of_link_to_phandle()
>   irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
>   firmware: arm_scmi: Set fwnode for the scmi_device
> 
>  drivers/base/core.c             | 443 +++++++++++++++++++++-----------
>  drivers/firmware/arm_scmi/bus.c |   2 +
>  drivers/gpio/gpiolib.c          |   6 +
>  drivers/irqchip/irq-imx-gpcv2.c |   1 +
>  drivers/of/property.c           |  84 +-----
>  drivers/soc/imx/gpcv2.c         |   1 +
>  drivers/soc/renesas/rcar-sysc.c |   2 +-
>  include/linux/device.h          |   1 +
>  include/linux/fwnode.h          |  12 +-
>  9 files changed, 332 insertions(+), 220 deletions(-)
> 


Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-30  8:55   ` Naresh Kamboju
@ 2023-01-30 10:49     ` Marc Zyngier
  -1 siblings, 0 replies; 146+ messages in thread
From: Marc Zyngier @ 2023-01-30 10:49 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: saravanak, abel.vesa, alexander.stein, andriy.shevchenko,
	bigunclemax, brgl, colin.foster, cristian.marussi, devicetree,
	dianders, djrscally, dmitry.baryshkov, festevam, fido_max,
	frowand.list, geert+renesas, geert, gregkh, heikki.krogerus, jpb,
	jstultz, kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, sudeep.holla, tglx, tony

On Mon, 30 Jan 2023 08:55:42 +0000,
Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> 
> Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> sparc and x86_64.
> 
> Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> Boot failed on FVP.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> Please refer following link for details of testing.
> FVP boot log failed.
> https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/
> 
> 
> [    2.613437] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
> [    2.613628] Mem abort info:
> [    2.613756]   ESR = 0x0000000096000005
> [    2.613904]   EC = 0x25: DABT (current EL), IL = 32 bits
> [    2.614071]   SET = 0, FnV = 0
> [    2.614215]   EA = 0, S1PTW = 0
> [    2.614358]   FSC = 0x05: level 1 translation fault
> [    2.614517] Data abort info:
> [    2.614647]   ISV = 0, ISS = 0x00000005
> [    2.614792]   CM = 0, WnR = 0
> [    2.614934] [0000000000000010] user address but active_mm is swapper
> [    2.615105] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
> [    2.615219] Modules linked in:
> [    2.615310] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc5 #1
> [    2.615445] Hardware name: FVP Base RevC (DT)
> [    2.615533] pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
> [    2.615685] pc : gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
> [    2.615816] lr : gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
> [    2.615970] sp : ffff8000081af5e0
> [    2.616051] x29: ffff8000081af5e0 x28: 0000000000000000 x27: ffff0008027cb5a0
> [    2.616261] x26: 0000000000000000 x25: ffffd7c5d6745910 x24: ffff0008027f4800
> [    2.616472] x23: 0000000000000000 x22: ffffd7c5d62b99a8 x21: 0000000000000202
> [    2.616679] x20: 0000000000000000 x19: ffff0008027f4800 x18: ffffffffffffffff
> [    2.616890] x17: ffffd7c5d6467928 x16: 0000000013e3690a x15: ffff8000081af3b0
> [    2.617102] x14: ffff00080275cd8a x13: ffff00080275cd88 x12: 0000000000000001
> [    2.617312] x11: 62726568746f6d3a x10: 0000000000000000 x9 : ffffd7c5d3b3ebe0
> [    2.617522] x8 : ffff8000081af548 x7 : 0000000000000000 x6 : 0000000000000001
> [    2.617727] x5 : 0000000000000000 x4 : ffff000800640000 x3 : ffffd7c5d62b99c8
> [    2.617933] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
> [    2.618138] Call trace:
> [    2.618204] gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
> [    2.618337] gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
> [    2.618493] devm_gpiochip_add_data_with_key (drivers/gpio/gpiolib-devres.c:478) 
> [    2.618654] bgpio_pdev_probe (drivers/gpio/gpio-mmio.c:793) 
> [    2.618785] platform_probe (drivers/base/platform.c:1401) 
> [    2.618928] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
> [    2.619056] __driver_probe_device (drivers/base/dd.c:778) 
> [    2.619193] driver_probe_device (drivers/base/dd.c:808) 
> [    2.619329] __device_attach_driver (drivers/base/dd.c:937) 
> [    2.619464] bus_for_each_drv (drivers/base/bus.c:427) 
> [    2.619590] __device_attach (drivers/base/dd.c:1010) 
> [    2.619722] device_initial_probe (drivers/base/dd.c:1058) 
> [    2.619861] bus_probe_device (drivers/base/bus.c:489) 
> [    2.619988] device_add (drivers/base/core.c:3637) 
> [    2.620102] platform_device_add (drivers/base/platform.c:717) 
> [    2.620251] mfd_add_device (drivers/mfd/mfd-core.c:297) 
> [    2.620397] devm_mfd_add_devices (drivers/mfd/mfd-core.c:351 drivers/mfd/mfd-core.c:449) 
> [    2.620548] vexpress_sysreg_probe (drivers/mfd/vexpress-sysreg.c:115) 
> [    2.620672] platform_probe (drivers/base/platform.c:1401) 
> [    2.620814] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
> [    2.620940] __driver_probe_device (drivers/base/dd.c:778) 
> [    2.621080] driver_probe_device (drivers/base/dd.c:808) 
> [    2.621216] __driver_attach (drivers/base/dd.c:1195) 
> [    2.621344] bus_for_each_dev (drivers/base/bus.c:301) 
> [    2.621467] driver_attach (drivers/base/dd.c:1212) 
> [    2.621596] bus_add_driver (drivers/base/bus.c:618) 
> [    2.621720] driver_register (drivers/base/driver.c:246) 
> [    2.621859] __platform_driver_register (drivers/base/platform.c:868) 
> [    2.622012] vexpress_sysreg_driver_init (drivers/mfd/vexpress-sysreg.c:134) 
> [    2.622145] do_one_initcall (init/main.c:1306) 
> [    2.622269] kernel_init_freeable (init/main.c:1378 init/main.c:1395 init/main.c:1414 init/main.c:1634) 
> [    2.622394] kernel_init (init/main.c:1526) 
> [    2.622531] ret_from_fork (arch/arm64/kernel/entry.S:864) 
> [ 2.622692] Code: 910003fd a90153f3 aa0003f3 f9414c00 (f9400801)
> All code
> ========
>    0:*	fd                   	std    		<-- trapping instruction
>    1:	03 00                	add    (%rax),%eax
>    3:	91                   	xchg   %eax,%ecx
>    4:	f3 53                	repz push %rbx
>    6:	01 a9 f3 03 00 aa    	add    %ebp,-0x55fffc0d(%rcx)
>    c:	00 4c 41 f9          	add    %cl,-0x7(%rcx,%rax,2)
>   10:	01 08                	add    %ecx,(%rax)
>   12:	40 f9                	rex stc

Could you please fix your scripts so that they report something that
matches the tested architecture? I like x86 asm as much as the next
guy, but this is an arm64 crash... :-/

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-30 10:49     ` Marc Zyngier
  0 siblings, 0 replies; 146+ messages in thread
From: Marc Zyngier @ 2023-01-30 10:49 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: saravanak, abel.vesa, alexander.stein, andriy.shevchenko,
	bigunclemax, brgl, colin.foster, cristian.marussi, devicetree,
	dianders, djrscally, dmitry.baryshkov, festevam, fido_max,
	frowand.list, geert+renesas, geert, gregkh, heikki.krogerus, jpb,
	jstultz, kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, sudeep.holla, tglx, tony

On Mon, 30 Jan 2023 08:55:42 +0000,
Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> 
> Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> sparc and x86_64.
> 
> Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> Boot failed on FVP.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> Please refer following link for details of testing.
> FVP boot log failed.
> https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/
> 
> 
> [    2.613437] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
> [    2.613628] Mem abort info:
> [    2.613756]   ESR = 0x0000000096000005
> [    2.613904]   EC = 0x25: DABT (current EL), IL = 32 bits
> [    2.614071]   SET = 0, FnV = 0
> [    2.614215]   EA = 0, S1PTW = 0
> [    2.614358]   FSC = 0x05: level 1 translation fault
> [    2.614517] Data abort info:
> [    2.614647]   ISV = 0, ISS = 0x00000005
> [    2.614792]   CM = 0, WnR = 0
> [    2.614934] [0000000000000010] user address but active_mm is swapper
> [    2.615105] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
> [    2.615219] Modules linked in:
> [    2.615310] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc5 #1
> [    2.615445] Hardware name: FVP Base RevC (DT)
> [    2.615533] pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
> [    2.615685] pc : gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
> [    2.615816] lr : gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
> [    2.615970] sp : ffff8000081af5e0
> [    2.616051] x29: ffff8000081af5e0 x28: 0000000000000000 x27: ffff0008027cb5a0
> [    2.616261] x26: 0000000000000000 x25: ffffd7c5d6745910 x24: ffff0008027f4800
> [    2.616472] x23: 0000000000000000 x22: ffffd7c5d62b99a8 x21: 0000000000000202
> [    2.616679] x20: 0000000000000000 x19: ffff0008027f4800 x18: ffffffffffffffff
> [    2.616890] x17: ffffd7c5d6467928 x16: 0000000013e3690a x15: ffff8000081af3b0
> [    2.617102] x14: ffff00080275cd8a x13: ffff00080275cd88 x12: 0000000000000001
> [    2.617312] x11: 62726568746f6d3a x10: 0000000000000000 x9 : ffffd7c5d3b3ebe0
> [    2.617522] x8 : ffff8000081af548 x7 : 0000000000000000 x6 : 0000000000000001
> [    2.617727] x5 : 0000000000000000 x4 : ffff000800640000 x3 : ffffd7c5d62b99c8
> [    2.617933] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
> [    2.618138] Call trace:
> [    2.618204] gpiochip_setup_dev (include/linux/err.h:41 include/linux/fwnode.h:201 drivers/gpio/gpiolib.c:586) 
> [    2.618337] gpiochip_add_data_with_key (drivers/gpio/gpiolib.c:871) 
> [    2.618493] devm_gpiochip_add_data_with_key (drivers/gpio/gpiolib-devres.c:478) 
> [    2.618654] bgpio_pdev_probe (drivers/gpio/gpio-mmio.c:793) 
> [    2.618785] platform_probe (drivers/base/platform.c:1401) 
> [    2.618928] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
> [    2.619056] __driver_probe_device (drivers/base/dd.c:778) 
> [    2.619193] driver_probe_device (drivers/base/dd.c:808) 
> [    2.619329] __device_attach_driver (drivers/base/dd.c:937) 
> [    2.619464] bus_for_each_drv (drivers/base/bus.c:427) 
> [    2.619590] __device_attach (drivers/base/dd.c:1010) 
> [    2.619722] device_initial_probe (drivers/base/dd.c:1058) 
> [    2.619861] bus_probe_device (drivers/base/bus.c:489) 
> [    2.619988] device_add (drivers/base/core.c:3637) 
> [    2.620102] platform_device_add (drivers/base/platform.c:717) 
> [    2.620251] mfd_add_device (drivers/mfd/mfd-core.c:297) 
> [    2.620397] devm_mfd_add_devices (drivers/mfd/mfd-core.c:351 drivers/mfd/mfd-core.c:449) 
> [    2.620548] vexpress_sysreg_probe (drivers/mfd/vexpress-sysreg.c:115) 
> [    2.620672] platform_probe (drivers/base/platform.c:1401) 
> [    2.620814] really_probe (drivers/base/dd.c:560 drivers/base/dd.c:639) 
> [    2.620940] __driver_probe_device (drivers/base/dd.c:778) 
> [    2.621080] driver_probe_device (drivers/base/dd.c:808) 
> [    2.621216] __driver_attach (drivers/base/dd.c:1195) 
> [    2.621344] bus_for_each_dev (drivers/base/bus.c:301) 
> [    2.621467] driver_attach (drivers/base/dd.c:1212) 
> [    2.621596] bus_add_driver (drivers/base/bus.c:618) 
> [    2.621720] driver_register (drivers/base/driver.c:246) 
> [    2.621859] __platform_driver_register (drivers/base/platform.c:868) 
> [    2.622012] vexpress_sysreg_driver_init (drivers/mfd/vexpress-sysreg.c:134) 
> [    2.622145] do_one_initcall (init/main.c:1306) 
> [    2.622269] kernel_init_freeable (init/main.c:1378 init/main.c:1395 init/main.c:1414 init/main.c:1634) 
> [    2.622394] kernel_init (init/main.c:1526) 
> [    2.622531] ret_from_fork (arch/arm64/kernel/entry.S:864) 
> [ 2.622692] Code: 910003fd a90153f3 aa0003f3 f9414c00 (f9400801)
> All code
> ========
>    0:*	fd                   	std    		<-- trapping instruction
>    1:	03 00                	add    (%rax),%eax
>    3:	91                   	xchg   %eax,%ecx
>    4:	f3 53                	repz push %rbx
>    6:	01 a9 f3 03 00 aa    	add    %ebp,-0x55fffc0d(%rcx)
>    c:	00 4c 41 f9          	add    %cl,-0x7(%rcx,%rax,2)
>   10:	01 08                	add    %ecx,(%rax)
>   12:	40 f9                	rex stc

Could you please fix your scripts so that they report something that
matches the tested architecture? I like x86 asm as much as the next
guy, but this is an arm64 crash... :-/

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
  2023-01-28  7:33       ` Saravana Kannan
@ 2023-01-30 12:04         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:04 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:33:28PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:22 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:

...

> > >  static unsigned int defer_sync_state_count = 1;
> > >  static DEFINE_MUTEX(fwnode_link_lock);
> > >  static bool fw_devlink_is_permissive(void);
> > > +static void __fw_devlink_link_to_consumers(struct device *dev);
> > >  static bool fw_devlink_drv_reg_done;
> > >  static bool fw_devlink_best_effort;
> >
> > I'm wondering if may avoid adding more forward declarations...
> >
> > Perhaps it's a sign that devlink code should be split to its own
> > module?
> 
> I've thought about that before, but I'm not there yet. Maybe once my
> remaining refactors and TODOs are done, it'd be a good time to revisit
> this question.
> 
> But I don't think it should be done for the reason of forward
> declaration as we'd just end up moving these into base.h and we can do
> that even today.

What I meant is that the stacking up forward declarations is a good sign that
something has to be done sooner than later.

...

> > > -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > > +static int __fwnode_link_add(struct fwnode_handle *con,
> > > +                          struct fwnode_handle *sup)
> >
> > I believe we tolerate a bit longer lines, so you may still have it on a single
> > line.
> 
> That'd make it >80 cols. I'm going to leave it as is.

Is it a problem?

...

> > >       if (dev->fwnode && dev->fwnode->dev == dev) {
> >
> > You may have above something like
> >
> >         fwnode = dev_fwnode(dev);
> 
> I'll leave it as-is for now. I see dev->fwnode vs dev_fwnode() don't
> always give the same results. I need to re-examine other places I use
> dev->fwnode in fw_devlink code before I start using that function. But
> in general it seems like a good idea. I'll add this to my TODOs.

Please do, the rationale is to actually move the fwnode to the proper layer,
now we have the single linked list defined in struct fwnode_handle and
dereferencing fwnode from struct device without helper adds a lot of
headache in the future. So, I really would like to see that we stopped doing
that.

> >         if (fwnode && fwnode->dev == dev) {
> >
> > >               struct fwnode_handle *child;
> > >               fwnode_links_purge_suppliers(dev->fwnode);
> > > +             mutex_lock(&fwnode_link_lock);
> > >               fwnode_for_each_available_child_node(dev->fwnode, child)
> > > -                     fw_devlink_purge_absent_suppliers(child);
> > > +                     __fw_devlink_pickup_dangling_consumers(child,
> > > +                                                            dev->fwnode);
> >
> >                         __fw_devlink_pickup_dangling_consumers(child, fwnode);
> 
> I like the dev->fwnode->dev == dev check. It makes it super clear that
> I'm checking "The device's fwnode points back to the device". If I
> just use fwnode->dev == dev, then one will have to go back and read
> what fwnode is set to, etc. Also, when reading all these function
> calls it's easier to see that I'm working on the dev's fwnode (where
> dev is the device that was just bound to a driver) instead of some
> other fwnode.
> 
> So I find it more readable as is and the compiler would optimize it
> anyway. If you feel strongly about this, I can change to use fwnode
> instead of dev->fwnode.

Please, read above.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links
@ 2023-01-30 12:04         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:04 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:33:28PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:22 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:28PM -0800, Saravana Kannan wrote:

...

> > >  static unsigned int defer_sync_state_count = 1;
> > >  static DEFINE_MUTEX(fwnode_link_lock);
> > >  static bool fw_devlink_is_permissive(void);
> > > +static void __fw_devlink_link_to_consumers(struct device *dev);
> > >  static bool fw_devlink_drv_reg_done;
> > >  static bool fw_devlink_best_effort;
> >
> > I'm wondering if may avoid adding more forward declarations...
> >
> > Perhaps it's a sign that devlink code should be split to its own
> > module?
> 
> I've thought about that before, but I'm not there yet. Maybe once my
> remaining refactors and TODOs are done, it'd be a good time to revisit
> this question.
> 
> But I don't think it should be done for the reason of forward
> declaration as we'd just end up moving these into base.h and we can do
> that even today.

What I meant is that the stacking up forward declarations is a good sign that
something has to be done sooner than later.

...

> > > -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
> > > +static int __fwnode_link_add(struct fwnode_handle *con,
> > > +                          struct fwnode_handle *sup)
> >
> > I believe we tolerate a bit longer lines, so you may still have it on a single
> > line.
> 
> That'd make it >80 cols. I'm going to leave it as is.

Is it a problem?

...

> > >       if (dev->fwnode && dev->fwnode->dev == dev) {
> >
> > You may have above something like
> >
> >         fwnode = dev_fwnode(dev);
> 
> I'll leave it as-is for now. I see dev->fwnode vs dev_fwnode() don't
> always give the same results. I need to re-examine other places I use
> dev->fwnode in fw_devlink code before I start using that function. But
> in general it seems like a good idea. I'll add this to my TODOs.

Please do, the rationale is to actually move the fwnode to the proper layer,
now we have the single linked list defined in struct fwnode_handle and
dereferencing fwnode from struct device without helper adds a lot of
headache in the future. So, I really would like to see that we stopped doing
that.

> >         if (fwnode && fwnode->dev == dev) {
> >
> > >               struct fwnode_handle *child;
> > >               fwnode_links_purge_suppliers(dev->fwnode);
> > > +             mutex_lock(&fwnode_link_lock);
> > >               fwnode_for_each_available_child_node(dev->fwnode, child)
> > > -                     fw_devlink_purge_absent_suppliers(child);
> > > +                     __fw_devlink_pickup_dangling_consumers(child,
> > > +                                                            dev->fwnode);
> >
> >                         __fw_devlink_pickup_dangling_consumers(child, fwnode);
> 
> I like the dev->fwnode->dev == dev check. It makes it super clear that
> I'm checking "The device's fwnode points back to the device". If I
> just use fwnode->dev == dev, then one will have to go back and read
> what fwnode is set to, etc. Also, when reading all these function
> calls it's easier to see that I'm working on the dev's fwnode (where
> dev is the device that was just bound to a driver) instead of some
> other fwnode.
> 
> So I find it more readable as is and the compiler would optimize it
> anyway. If you feel strongly about this, I can change to use fwnode
> instead of dev->fwnode.

Please, read above.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-28  7:33       ` Saravana Kannan
@ 2023-01-30 12:05         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:05 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:33:38PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:27 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:

...

> > > +     /*
> > > +      * If fwnode doesn't belong to another device, it's safe to clear its
> > > +      * initialized flag.
> > > +      */
> > > +     if (!gdev->dev.fwnode->dev)
> > > +             fwnode_dev_initialized(gdev->dev.fwnode, false);
> >
> > Do not dereference fwnode in struct device. Use dev_fwnode() for that.
> >
> >         struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
> >
> >         if (!fwnode->dev)
> >                 fwnode_dev_initialized(fwnode, false);
> 
> Honestly, we should work towards NOT needing dev_fwnode().

Honestly, it's that We SHOULD go to avoid any direct dereference of fwnode from
the struct device. I explained you in the comment in the other patch.

> The
> function literally dereferences dev->fwnode or the one inside of_node.
> So my dereference is fine. The whole "fwnode might not be set for
> devices with of_node" is wrong and we should fix that instead of
> writing wrappers to work around it.
> 
> Also, for now I'm going to leave this as if for the same reasons as I
> mentioned in Patch 1.

Same.


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-30 12:05         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:05 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:33:38PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:27 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:

...

> > > +     /*
> > > +      * If fwnode doesn't belong to another device, it's safe to clear its
> > > +      * initialized flag.
> > > +      */
> > > +     if (!gdev->dev.fwnode->dev)
> > > +             fwnode_dev_initialized(gdev->dev.fwnode, false);
> >
> > Do not dereference fwnode in struct device. Use dev_fwnode() for that.
> >
> >         struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
> >
> >         if (!fwnode->dev)
> >                 fwnode_dev_initialized(fwnode, false);
> 
> Honestly, we should work towards NOT needing dev_fwnode().

Honestly, it's that We SHOULD go to avoid any direct dereference of fwnode from
the struct device. I explained you in the comment in the other patch.

> The
> function literally dereferences dev->fwnode or the one inside of_node.
> So my dereference is fine. The whole "fwnode might not be set for
> devices with of_node" is wrong and we should fix that instead of
> writing wrappers to work around it.
> 
> Also, for now I'm going to leave this as if for the same reasons as I
> mentioned in Patch 1.

Same.


-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
  2023-01-28  7:34       ` Saravana Kannan
@ 2023-01-30 12:08         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:08 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:11PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

...

> > >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> > >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> > >                              DL_FLAG_SYNC_STATE_ONLY | \
> > > -                            DL_FLAG_INFERRED)
> > > +                            DL_FLAG_INFERRED | \
> > > +                            DL_FLAG_CYCLE)
> >
> > You can make less churn by squeezing the new one above the last one.
> 
> I feel like this part is getting bike shedded. I'm going to leave it
> as is. It's done in the order it's defined in the header and keeping
> it that way makes it way more easier to read than worry about a single
> line churn.

Not at all. What you are showing here is the additional churn for the sake of
the churn. With a no-cost trick you may avoid that.

Also, it will compress better the Git index and save some mW here and there
and in the size of the world and amount of Git copies of the Linux kernel
this may save the planet (I'm serious, no jokes).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
@ 2023-01-30 12:08         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:08 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:11PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:30 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:32PM -0800, Saravana Kannan wrote:

...

> > >                              DL_FLAG_AUTOREMOVE_SUPPLIER | \
> > >                              DL_FLAG_AUTOPROBE_CONSUMER  | \
> > >                              DL_FLAG_SYNC_STATE_ONLY | \
> > > -                            DL_FLAG_INFERRED)
> > > +                            DL_FLAG_INFERRED | \
> > > +                            DL_FLAG_CYCLE)
> >
> > You can make less churn by squeezing the new one above the last one.
> 
> I feel like this part is getting bike shedded. I'm going to leave it
> as is. It's done in the order it's defined in the header and keeping
> it that way makes it way more easier to read than worry about a single
> line churn.

Not at all. What you are showing here is the additional churn for the sake of
the churn. With a no-cost trick you may avoid that.

Also, it will compress better the Git index and save some mW here and there
and in the size of the world and amount of Git copies of the Linux kernel
this may save the planet (I'm serious, no jokes).

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-30 10:48   ` Miquel Raynal
@ 2023-01-30 12:08     ` Maxim Kiselev
  -1 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-01-30 12:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Tony Lindgren,
	Linux Kernel Functional Testing, Naresh Kamboju, Abel Vesa,
	Alexander Stein, Geert Uytterhoeven, John Stultz, Doug Anderson,
	Guenter Roeck, Dmitry Baryshkov, Maxim Kochetkov, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

Hi Saravana & Miquel.

Sorry for the long response. I finally got access to my test device
and tried this patch series.

And unfortunately it didn't solve my issue. I'm still getting a
hanging f1070000.ethernet dependency
from the nvmem-cell mac@6 subnode.

Here are related parts of my kernel log and device tree:


    [    2.713302] device: 'mtd-0': device_add
    [    2.719528] device: 'spi0': device_add
    [    2.724180] device: 'spi0.0': device_add
    [    2.728957] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
    [    2.735338] 7 fixed-partitions partitions found on MTD device spi0.0
    [    2.741978] device:
'f1010600.spi:m25p80@0:partitions:partition@1': device_add
    [    2.749636] Creating 7 MTD partitions on "spi0.0":
    [    2.754564] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
    [    2.759981] device: 'mtd0': device_add
    [    2.764323] device: 'mtd0': device_add
    [    2.768280] device: 'mtd0ro': device_add
    [    2.772624] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
    [    2.778218] device: 'mtd1': device_add
    [    2.782549] device: 'mtd1': device_add
    [    2.786582] device: 'mtd1ro': device_add
    ...
    [    5.426625] mvneta_bm f10c0000.bm: Buffer Manager for network
controller enabled
    [    5.492867] platform f1070000.ethernet: error -EPROBE_DEFER:
wait for supplier mac@6
    [    5.528636] device: 'Fixed MDIO bus.0': device_add
    [    5.533726] device: 'fixed-0': device_add
    [    5.547564] device: 'f1072004.mdio-eth-mii': device_add
    [    5.616368] device: 'f1072004.mdio-eth-mii:00': device_add
    [    5.645127] device: 'f1072004.mdio-eth-mii:1e': device_add
    [    5.651530] devices_kset: Moving f1070000.ethernet to end of list
    [    5.657948] platform f1070000.ethernet: error -EPROBE_DEFER:
wait for supplier mac@6

    spi@10600 {
        m25p80@0 {
            compatible = "mx66l51235l";

            partitions {
                compatible = "fixed-partitions";

                partition@0 {
                    label = "SPI.U_BOOT";
                };
                partition@1 {
                    compatible = "nvmem-cells";
                    label = "SPI.INV_INFO";
                    macaddr: mac@6 {
                        reg = <0x6 0x6>;
                    };
                };
                ...
            };
        };
    };

    enet1: ethernet@70000 {
        nvmem-cells = <&macaddr>;
        nvmem-cell-names = "mac-address";
        phy-mode = "rgmii";
        phy = <&phy0>;
    };


Maybe I should provide some additional debug info?

пн, 30 янв. 2023 г. в 13:48, Miquel Raynal <miquel.raynal@bootlin.com>:
>
> Hi Maxim & Maxim,
>
> saravanak@google.com wrote on Thu, 26 Jan 2023 16:11:27 -0800:
>
> > This patch series improves fw_devlink in the following ways:
> >
> > 1. It no longer cares about a fwnode having a "compatible" property. It
> >    figures this our more dynamically. The only expectation is that
> >    fwnode that are converted to devices actually get probed by a driver
> >    for the dependencies to be enforced correctly.
> >
> > 2. Finer grained dependency tracking. fw_devlink will now create device
> >    links from the consumer to the actual resource's device (if it has one,
> >    Eg: gpio_device) instead of the parent supplier device. This improves
> >    things like async suspend/resume ordering, potentially remove the need
> >    for frameworks to create device links, more parallelized async probing,
> >    and better sync_state() tracking.
> >
> > 3. Handle hardware/software quirks where a child firmware node gets
> >    populated as a device before its parent firmware node AND actually
> >    supplies a non-optional resource to the parent firmware node's
> >    device.
> >
> > 4. Way more robust at cycle handling (see patch for the insane cases).
> >
> > 5. Stops depending on OF_POPULATED to figure out some corner cases.
> >
> > 6. Simplifies the work that needs to be done by the firmware specific
> >    code.
> >
> > Sorry it took a while to roll in the fixes I gave in the v1 series
> > thread[1] into a v2 series.
> >
> > Since I didn't make any additional changes on top of what I already gave
> > in the v1 thread and Dmitry is very eager to get this series going, I'm
> > sending it out without testing locally. I already tested these patches a
> > few months ago as part of the v1 series. So I don't expect any major
> > issues. I'll test them again on my end in the next few days and will
> > report here if I actually find anything wrong.
> >
> > Tony, Naresh, Abel, Sudeep, Geert,
> >
> > I got the following reviewed by's and tested by's a few months back, but
> > it's been 5 months since I sent out v1. So I wasn't sure if it was okay
> > to include them in the v2 commits. Let me know if you are okay with this
> > being included in the commits and/or if you want to test this series
> > again.
> >
> > Reviewed-by: Tony Lindgren <tony@atomide.com>
> > Tested-by: Tony Lindgren <tony@atomide.com>
> > Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> > Tested-by: Abel Vesa <abel.vesa@linaro.org>
> > Tested-by: Sudeep Holla <sudeep.holla@arm.com>
> > Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> >
> > I've Cc-ed you because I had pointed you to v1 of this series + the
> > patches in that thread at one point or another as a fix to some issue
> > you were facing. It'd appreciate it if you can test this series and
> > report any issues, or things it fixed and give Tested-bys.
>
> Maxim & Maxim I would really appreciate if you could validate that the
> original issue you had is solved with this version? I don't have any
> hardware suffering from this issue.
>
> > In addition, if you can also apply a revert of this series[2] and delete
> > driver_deferred_probe_check_state() from your tree and see if you hit
> > any issues and report them, that'd be great too! I'm pretty sure some of
> > you will hit issues with that. I want to fix those next and then
> > revert[2].
> >
> > Thanks,
> > Saravana
> >
> > [1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
> > [2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
> > [3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/
> >
> > v1 -> v2:
> > - Fixed Patch 1 to handle a corner case discussed in [3].
> > - New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
> > - New patch 11 to add fw_devlink support for SCMI devices.
> >
> > Cc: Abel Vesa <abel.vesa@linaro.org>
> > Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> > Cc: Tony Lindgren <tony@atomide.com>
> > Cc: Sudeep Holla <sudeep.holla@arm.com>
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: John Stultz <jstultz@google.com>
> > Cc: Doug Anderson <dianders@chromium.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Cc: Maxim Kiselev <bigunclemax@gmail.com>
> > Cc: Maxim Kochetkov <fido_max@inbox.ru>
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Luca Weiss <luca.weiss@fairphone.com>
> > Cc: Colin Foster <colin.foster@in-advantage.com>
> > Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
> > Cc: Jean-Philippe Brucker <jpb@kernel.org>
> >
> > Saravana Kannan (11):
> >   driver core: fw_devlink: Don't purge child fwnode's consumer links
> >   driver core: fw_devlink: Improve check for fwnode with no
> >     device/driver
> >   soc: renesas: Move away from using OF_POPULATED for fw_devlink
> >   gpiolib: Clear the gpio_device's fwnode initialized flag before adding
> >   driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
> >   driver core: fw_devlink: Allow marking a fwnode link as being part of
> >     a cycle
> >   driver core: fw_devlink: Consolidate device link flag computation
> >   driver core: fw_devlink: Make cycle detection more robust
> >   of: property: Simplify of_link_to_phandle()
> >   irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
> >   firmware: arm_scmi: Set fwnode for the scmi_device
> >
> >  drivers/base/core.c             | 443 +++++++++++++++++++++-----------
> >  drivers/firmware/arm_scmi/bus.c |   2 +
> >  drivers/gpio/gpiolib.c          |   6 +
> >  drivers/irqchip/irq-imx-gpcv2.c |   1 +
> >  drivers/of/property.c           |  84 +-----
> >  drivers/soc/imx/gpcv2.c         |   1 +
> >  drivers/soc/renesas/rcar-sysc.c |   2 +-
> >  include/linux/device.h          |   1 +
> >  include/linux/fwnode.h          |  12 +-
> >  9 files changed, 332 insertions(+), 220 deletions(-)
> >
>
>
> Thanks,
> Miquèl

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-30 12:08     ` Maxim Kiselev
  0 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-01-30 12:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Tony Lindgren,
	Linux Kernel Functional Testing, Naresh Kamboju, Abel Vesa,
	Alexander Stein, Geert Uytterhoeven, John Stultz, Doug Anderson,
	Guenter Roeck, Dmitry Baryshkov, Maxim Kochetkov, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

Hi Saravana & Miquel.

Sorry for the long response. I finally got access to my test device
and tried this patch series.

And unfortunately it didn't solve my issue. I'm still getting a
hanging f1070000.ethernet dependency
from the nvmem-cell mac@6 subnode.

Here are related parts of my kernel log and device tree:


    [    2.713302] device: 'mtd-0': device_add
    [    2.719528] device: 'spi0': device_add
    [    2.724180] device: 'spi0.0': device_add
    [    2.728957] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
    [    2.735338] 7 fixed-partitions partitions found on MTD device spi0.0
    [    2.741978] device:
'f1010600.spi:m25p80@0:partitions:partition@1': device_add
    [    2.749636] Creating 7 MTD partitions on "spi0.0":
    [    2.754564] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
    [    2.759981] device: 'mtd0': device_add
    [    2.764323] device: 'mtd0': device_add
    [    2.768280] device: 'mtd0ro': device_add
    [    2.772624] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
    [    2.778218] device: 'mtd1': device_add
    [    2.782549] device: 'mtd1': device_add
    [    2.786582] device: 'mtd1ro': device_add
    ...
    [    5.426625] mvneta_bm f10c0000.bm: Buffer Manager for network
controller enabled
    [    5.492867] platform f1070000.ethernet: error -EPROBE_DEFER:
wait for supplier mac@6
    [    5.528636] device: 'Fixed MDIO bus.0': device_add
    [    5.533726] device: 'fixed-0': device_add
    [    5.547564] device: 'f1072004.mdio-eth-mii': device_add
    [    5.616368] device: 'f1072004.mdio-eth-mii:00': device_add
    [    5.645127] device: 'f1072004.mdio-eth-mii:1e': device_add
    [    5.651530] devices_kset: Moving f1070000.ethernet to end of list
    [    5.657948] platform f1070000.ethernet: error -EPROBE_DEFER:
wait for supplier mac@6

    spi@10600 {
        m25p80@0 {
            compatible = "mx66l51235l";

            partitions {
                compatible = "fixed-partitions";

                partition@0 {
                    label = "SPI.U_BOOT";
                };
                partition@1 {
                    compatible = "nvmem-cells";
                    label = "SPI.INV_INFO";
                    macaddr: mac@6 {
                        reg = <0x6 0x6>;
                    };
                };
                ...
            };
        };
    };

    enet1: ethernet@70000 {
        nvmem-cells = <&macaddr>;
        nvmem-cell-names = "mac-address";
        phy-mode = "rgmii";
        phy = <&phy0>;
    };


Maybe I should provide some additional debug info?

пн, 30 янв. 2023 г. в 13:48, Miquel Raynal <miquel.raynal@bootlin.com>:
>
> Hi Maxim & Maxim,
>
> saravanak@google.com wrote on Thu, 26 Jan 2023 16:11:27 -0800:
>
> > This patch series improves fw_devlink in the following ways:
> >
> > 1. It no longer cares about a fwnode having a "compatible" property. It
> >    figures this our more dynamically. The only expectation is that
> >    fwnode that are converted to devices actually get probed by a driver
> >    for the dependencies to be enforced correctly.
> >
> > 2. Finer grained dependency tracking. fw_devlink will now create device
> >    links from the consumer to the actual resource's device (if it has one,
> >    Eg: gpio_device) instead of the parent supplier device. This improves
> >    things like async suspend/resume ordering, potentially remove the need
> >    for frameworks to create device links, more parallelized async probing,
> >    and better sync_state() tracking.
> >
> > 3. Handle hardware/software quirks where a child firmware node gets
> >    populated as a device before its parent firmware node AND actually
> >    supplies a non-optional resource to the parent firmware node's
> >    device.
> >
> > 4. Way more robust at cycle handling (see patch for the insane cases).
> >
> > 5. Stops depending on OF_POPULATED to figure out some corner cases.
> >
> > 6. Simplifies the work that needs to be done by the firmware specific
> >    code.
> >
> > Sorry it took a while to roll in the fixes I gave in the v1 series
> > thread[1] into a v2 series.
> >
> > Since I didn't make any additional changes on top of what I already gave
> > in the v1 thread and Dmitry is very eager to get this series going, I'm
> > sending it out without testing locally. I already tested these patches a
> > few months ago as part of the v1 series. So I don't expect any major
> > issues. I'll test them again on my end in the next few days and will
> > report here if I actually find anything wrong.
> >
> > Tony, Naresh, Abel, Sudeep, Geert,
> >
> > I got the following reviewed by's and tested by's a few months back, but
> > it's been 5 months since I sent out v1. So I wasn't sure if it was okay
> > to include them in the v2 commits. Let me know if you are okay with this
> > being included in the commits and/or if you want to test this series
> > again.
> >
> > Reviewed-by: Tony Lindgren <tony@atomide.com>
> > Tested-by: Tony Lindgren <tony@atomide.com>
> > Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> > Tested-by: Abel Vesa <abel.vesa@linaro.org>
> > Tested-by: Sudeep Holla <sudeep.holla@arm.com>
> > Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe,
> >
> > I've Cc-ed you because I had pointed you to v1 of this series + the
> > patches in that thread at one point or another as a fix to some issue
> > you were facing. It'd appreciate it if you can test this series and
> > report any issues, or things it fixed and give Tested-bys.
>
> Maxim & Maxim I would really appreciate if you could validate that the
> original issue you had is solved with this version? I don't have any
> hardware suffering from this issue.
>
> > In addition, if you can also apply a revert of this series[2] and delete
> > driver_deferred_probe_check_state() from your tree and see if you hit
> > any issues and report them, that'd be great too! I'm pretty sure some of
> > you will hit issues with that. I want to fix those next and then
> > revert[2].
> >
> > Thanks,
> > Saravana
> >
> > [1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/
> > [2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/
> > [3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/
> >
> > v1 -> v2:
> > - Fixed Patch 1 to handle a corner case discussed in [3].
> > - New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers.
> > - New patch 11 to add fw_devlink support for SCMI devices.
> >
> > Cc: Abel Vesa <abel.vesa@linaro.org>
> > Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> > Cc: Tony Lindgren <tony@atomide.com>
> > Cc: Sudeep Holla <sudeep.holla@arm.com>
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: John Stultz <jstultz@google.com>
> > Cc: Doug Anderson <dianders@chromium.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > Cc: Maxim Kiselev <bigunclemax@gmail.com>
> > Cc: Maxim Kochetkov <fido_max@inbox.ru>
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Luca Weiss <luca.weiss@fairphone.com>
> > Cc: Colin Foster <colin.foster@in-advantage.com>
> > Cc: Martin Kepplinger <martin.kepplinger@puri.sm>
> > Cc: Jean-Philippe Brucker <jpb@kernel.org>
> >
> > Saravana Kannan (11):
> >   driver core: fw_devlink: Don't purge child fwnode's consumer links
> >   driver core: fw_devlink: Improve check for fwnode with no
> >     device/driver
> >   soc: renesas: Move away from using OF_POPULATED for fw_devlink
> >   gpiolib: Clear the gpio_device's fwnode initialized flag before adding
> >   driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links
> >   driver core: fw_devlink: Allow marking a fwnode link as being part of
> >     a cycle
> >   driver core: fw_devlink: Consolidate device link flag computation
> >   driver core: fw_devlink: Make cycle detection more robust
> >   of: property: Simplify of_link_to_phandle()
> >   irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized
> >   firmware: arm_scmi: Set fwnode for the scmi_device
> >
> >  drivers/base/core.c             | 443 +++++++++++++++++++++-----------
> >  drivers/firmware/arm_scmi/bus.c |   2 +
> >  drivers/gpio/gpiolib.c          |   6 +
> >  drivers/irqchip/irq-imx-gpcv2.c |   1 +
> >  drivers/of/property.c           |  84 +-----
> >  drivers/soc/imx/gpcv2.c         |   1 +
> >  drivers/soc/renesas/rcar-sysc.c |   2 +-
> >  include/linux/device.h          |   1 +
> >  include/linux/fwnode.h          |  12 +-
> >  9 files changed, 332 insertions(+), 220 deletions(-)
> >
>
>
> Thanks,
> Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
  2023-01-28  7:34       ` Saravana Kannan
@ 2023-01-30 12:09         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:09 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:19PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:33 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:

...

> > > -     if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> > > -         !fw_devlink_is_permissive()) {
> > > -             sup_fw = list_first_entry(&dev->fwnode->suppliers,
> > > -                                       struct fwnode_link,
> > > -                                       c_hook)->supplier;
> > > +     sup_fw = fwnode_links_check_suppliers(dev->fwnode);
> >
> > dev_fwnode() ?
> >
> > ...
> >
> > > -     val = !list_empty(&dev->fwnode->suppliers);
> > > +     mutex_lock(&fwnode_link_lock);
> > > +     val = !!fwnode_links_check_suppliers(dev->fwnode);
> >
> > Ditto?
> 
> Similar response as Patch 1 and Patch 4.

Same.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle
@ 2023-01-30 12:09         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:09 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:19PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:33 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:33PM -0800, Saravana Kannan wrote:

...

> > > -     if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&
> > > -         !fw_devlink_is_permissive()) {
> > > -             sup_fw = list_first_entry(&dev->fwnode->suppliers,
> > > -                                       struct fwnode_link,
> > > -                                       c_hook)->supplier;
> > > +     sup_fw = fwnode_links_check_suppliers(dev->fwnode);
> >
> > dev_fwnode() ?
> >
> > ...
> >
> > > -     val = !list_empty(&dev->fwnode->suppliers);
> > > +     mutex_lock(&fwnode_link_lock);
> > > +     val = !!fwnode_links_check_suppliers(dev->fwnode);
> >
> > Ditto?
> 
> Similar response as Patch 1 and Patch 4.

Same.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-28  7:34       ` Saravana Kannan
@ 2023-01-30 12:15         ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:15 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:

...

> Lol, you are the king of nit picks :)

Not always, only when it comes with something else.

...

> > > + * Return true if one or more cycles were found. Otherwise, return false.
> >
> > Return:
> 
> I'm following the rest of the function docs in this file.

Okay, it makes sense. We will need to address them all.

> > (you may run `kernel-doc -v ...` to see all warnings)
> 
> Hmmm I ran it on the patch file and it didn't give me anything useful.
> Running it on the whole file is just a lot of lines to dig through.

The function description missing Return section. Something like this
I can get from the kernel doc without it.

...

> > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > +                              struct fwnode_handle *sup_handle)
> > > +{
> > > +     struct fwnode_link *link;
> > > +     struct device_link *dev_link;
> >
> > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> >
> > You can put it the first line since it's long enough.
> 
> Wait, is that a style guideline to have the longer lines first?

No, but it's easier to read.

> > But why do you need sup_dev assignment?
> 
> Defensive programming I suppose. I can see this function being
> refactored in the future where a goto out; is inserted before sup_dev
> is assigned. And then the put_device(sup_dev) at "out" will end up
> operating on some junk value and causing memory corruption.

We don't need to be defensive here. Moreover, it's harder and easy to make
a mistake with predefined values (it's actually better NOT to define anything
qr at least define as closest to its user as possible, so you want miss the
compiler warnings as I believe you run your compiler with `make W=1 ...`, and
if not, I highly recommend to get this habit).

...

> > > +     sup_dev = get_dev_from_fwnode(sup_handle);
> > > +
> >
> > I would put it closer to the condition:
> >
> > > +     /* Termination condition. */
> > > +     if (sup_dev == con) {
> >
> >         /* Get supplier device and check for termination condition */
> >         sup_dev = get_dev_from_fwnode(sup_handle);
> >         if (sup_dev == con) {
> 
> I put it the way it is because sup_dev is used for more than just
> checking for termination condition.

Yes, but still it's better to see what you are actually checking.

> > > +             ret = true;
> > > +             goto out;
> > > +     }

...

> > > +             if (__fw_devlink_relax_cycles(con,
> > > +                                           dev_link->supplier->fwnode)) {
> >
> > Keep it on one line.
> 
> It'll make it > 80. Is this some recent change about allowing > 80
> cols? I'm leaving it as is for now.

Is it a problem? Do you have any tool that complains about it?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-30 12:15         ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 12:15 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:

...

> Lol, you are the king of nit picks :)

Not always, only when it comes with something else.

...

> > > + * Return true if one or more cycles were found. Otherwise, return false.
> >
> > Return:
> 
> I'm following the rest of the function docs in this file.

Okay, it makes sense. We will need to address them all.

> > (you may run `kernel-doc -v ...` to see all warnings)
> 
> Hmmm I ran it on the patch file and it didn't give me anything useful.
> Running it on the whole file is just a lot of lines to dig through.

The function description missing Return section. Something like this
I can get from the kernel doc without it.

...

> > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > +                              struct fwnode_handle *sup_handle)
> > > +{
> > > +     struct fwnode_link *link;
> > > +     struct device_link *dev_link;
> >
> > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> >
> > You can put it the first line since it's long enough.
> 
> Wait, is that a style guideline to have the longer lines first?

No, but it's easier to read.

> > But why do you need sup_dev assignment?
> 
> Defensive programming I suppose. I can see this function being
> refactored in the future where a goto out; is inserted before sup_dev
> is assigned. And then the put_device(sup_dev) at "out" will end up
> operating on some junk value and causing memory corruption.

We don't need to be defensive here. Moreover, it's harder and easy to make
a mistake with predefined values (it's actually better NOT to define anything
qr at least define as closest to its user as possible, so you want miss the
compiler warnings as I believe you run your compiler with `make W=1 ...`, and
if not, I highly recommend to get this habit).

...

> > > +     sup_dev = get_dev_from_fwnode(sup_handle);
> > > +
> >
> > I would put it closer to the condition:
> >
> > > +     /* Termination condition. */
> > > +     if (sup_dev == con) {
> >
> >         /* Get supplier device and check for termination condition */
> >         sup_dev = get_dev_from_fwnode(sup_handle);
> >         if (sup_dev == con) {
> 
> I put it the way it is because sup_dev is used for more than just
> checking for termination condition.

Yes, but still it's better to see what you are actually checking.

> > > +             ret = true;
> > > +             goto out;
> > > +     }

...

> > > +             if (__fw_devlink_relax_cycles(con,
> > > +                                           dev_link->supplier->fwnode)) {
> >
> > Keep it on one line.
> 
> It'll make it > 80. Is this some recent change about allowing > 80
> cols? I'm leaving it as is for now.

Is it a problem? Do you have any tool that complains about it?

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-30 14:31     ` Sudeep Holla
  -1 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-30 14:31 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> Registering an irqdomain sets the flag for the fwnode. But having the
> flag set when a device is added is interpreted by fw_devlink to mean the
> device has already been initialized and will never probe. This prevents
> fw_devlink from creating device links with the gpio_device as a
> supplier. So, clear the flag before adding the device.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
>  drivers/gpio/gpiolib.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 939c776b9488..b23140c6485f 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -578,6 +578,12 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
>  {
>  	int ret;
>  
> +	/*
> +	 * If fwnode doesn't belong to another device, it's safe to clear its
> +	 * initialized flag.
> +	 */
> +	if (!gdev->dev.fwnode->dev)
> +		fwnode_dev_initialized(gdev->dev.fwnode, false);

This is the one causing the kernel crash during the boot on FVP which
Naresh has reported. Just reverted this and was able to boot, confirming
the issue with this patch.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-30 14:31     ` Sudeep Holla
  0 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-30 14:31 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> Registering an irqdomain sets the flag for the fwnode. But having the
> flag set when a device is added is interpreted by fw_devlink to mean the
> device has already been initialized and will never probe. This prevents
> fw_devlink from creating device links with the gpio_device as a
> supplier. So, clear the flag before adding the device.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
>  drivers/gpio/gpiolib.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 939c776b9488..b23140c6485f 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -578,6 +578,12 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
>  {
>  	int ret;
>  
> +	/*
> +	 * If fwnode doesn't belong to another device, it's safe to clear its
> +	 * initialized flag.
> +	 */
> +	if (!gdev->dev.fwnode->dev)
> +		fwnode_dev_initialized(gdev->dev.fwnode, false);

This is the one causing the kernel crash during the boot on FVP which
Naresh has reported. Just reverted this and was able to boot, confirming
the issue with this patch.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-30 12:15         ` Andy Shevchenko
@ 2023-01-30 14:36           ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-30 14:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Mon, Jan 30, 2023 at 1:16 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> > On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > > +                              struct fwnode_handle *sup_handle)
> > > > +{
> > > > +     struct fwnode_link *link;
> > > > +     struct device_link *dev_link;
> > >
> > > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> > >
> > > You can put it the first line since it's long enough.
> >
> > Wait, is that a style guideline to have the longer lines first?
>
> No, but it's easier to read.

Yes it is, "reverse xmas tree" local variable ordering:
https://elixir.bootlin.com/linux/v6.2-rc6/source/Documentation/process/maintainer-netdev.rst#L272

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-30 14:36           ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-30 14:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Andy,

On Mon, Jan 30, 2023 at 1:16 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> > On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > > +                              struct fwnode_handle *sup_handle)
> > > > +{
> > > > +     struct fwnode_link *link;
> > > > +     struct device_link *dev_link;
> > >
> > > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> > >
> > > You can put it the first line since it's long enough.
> >
> > Wait, is that a style guideline to have the longer lines first?
>
> No, but it's easier to read.

Yes it is, "reverse xmas tree" local variable ordering:
https://elixir.bootlin.com/linux/v6.2-rc6/source/Documentation/process/maintainer-netdev.rst#L272

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
  2023-01-27  0:11   ` Saravana Kannan
@ 2023-01-30 14:39     ` Sakari Ailus
  -1 siblings, 0 replies; 146+ messages in thread
From: Sakari Ailus @ 2023-01-30 14:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Thu, Jan 26, 2023 at 04:11:36PM -0800, Saravana Kannan wrote:
> The driver core now:
> - Has the parent device of a supplier pick up the consumers if the
>   supplier never has a device created for it.
> - Ignores a supplier if the supplier has no parent device and will never
>   be probed by a driver
> 
> And already prevents creating a device link with the consumer as a
> supplier of a parent.
> 
> So, we no longer need to find the "compatible" node of the supplier or
> do any other checks in of_link_to_phandle(). We simply need to make sure
> that the supplier is available in DT.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
>  drivers/of/property.c | 84 +++++++------------------------------------
>  1 file changed, 13 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 134cfc980b70..c651aad6f34b 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
>  	return of_device_get_match_data(dev);
>  }
>  
> -static bool of_is_ancestor_of(struct device_node *test_ancestor,
> -			      struct device_node *child)
> -{
> -	of_node_get(child);
> -	while (child) {
> -		if (child == test_ancestor) {
> -			of_node_put(child);
> -			return true;
> -		}
> -		child = of_get_next_parent(child);
> -	}
> -	return false;
> -}
> -
>  static struct device_node *of_get_compat_node(struct device_node *np)
>  {
>  	of_node_get(np);
> @@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
>  	return node;
>  }
>  
> -/**
> - * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
> - * @con_np: consumer device tree node
> - * @sup_np: supplier device tree node
> - *
> - * Given a phandle to a supplier device tree node (@sup_np), this function
> - * finds the device that owns the supplier device tree node and creates a
> - * device link from @dev consumer device to the supplier device. This function
> - * doesn't create device links for invalid scenarios such as trying to create a
> - * link with a parent device as the consumer of its child device. In such
> - * cases, it returns an error.
> - *
> - * Returns:
> - * - 0 if fwnode link successfully created to supplier
> - * - -EINVAL if the supplier link is invalid and should not be created
> - * - -ENODEV if struct device will never be create for supplier
> - */
> -static int of_link_to_phandle(struct device_node *con_np,
> +static void of_link_to_phandle(struct device_node *con_np,
>  			      struct device_node *sup_np)
>  {
> -	struct device *sup_dev;
> -	struct device_node *tmp_np = sup_np;
> +	struct device_node *tmp_np = of_node_get(sup_np);
>  
> -	/*
> -	 * Find the device node that contains the supplier phandle.  It may be
> -	 * @sup_np or it may be an ancestor of @sup_np.
> -	 */
> -	sup_np = of_get_compat_node(sup_np);
> -	if (!sup_np) {
> -		pr_debug("Not linking %pOFP to %pOFP - No device\n",
> -			 con_np, tmp_np);
> -		return -ENODEV;
> -	}
> +	/* Check that sup_np and its ancestors are available. */
> +	while (tmp_np) {
> +		if (of_fwnode_handle(tmp_np)->dev) {
> +			of_node_put(tmp_np);
> +			break;
> +		}
>  
> -	/*
> -	 * Don't allow linking a device node as a consumer of one of its
> -	 * descendant nodes. By definition, a child node can't be a functional
> -	 * dependency for the parent node.
> -	 */
> -	if (of_is_ancestor_of(con_np, sup_np)) {
> -		pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
> -			 con_np, sup_np);
> -		of_node_put(sup_np);
> -		return -EINVAL;
> -	}
> +		if (!of_device_is_available(tmp_np)) {
> +			of_node_put(tmp_np);
> +			return;
> +		}
>  
> -	/*
> -	 * Don't create links to "early devices" that won't have struct devices
> -	 * created for them.
> -	 */
> -	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
> -	if (!sup_dev &&
> -	    (of_node_check_flag(sup_np, OF_POPULATED) ||
> -	     sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
> -		pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
> -			 con_np, sup_np);
> -		of_node_put(sup_np);
> -		return -ENODEV;
> +		tmp_np = of_get_next_parent(tmp_np);
>  	}
> -	put_device(sup_dev);
>  
>  	fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));

fwnode_link_add() returns int. Why is the return type of this function
changed to void?

> -	of_node_put(sup_np);
> -
> -	return 0;
>  }
>  
>  /**

-- 
Regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
@ 2023-01-30 14:39     ` Sakari Ailus
  0 siblings, 0 replies; 146+ messages in thread
From: Sakari Ailus @ 2023-01-30 14:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Thu, Jan 26, 2023 at 04:11:36PM -0800, Saravana Kannan wrote:
> The driver core now:
> - Has the parent device of a supplier pick up the consumers if the
>   supplier never has a device created for it.
> - Ignores a supplier if the supplier has no parent device and will never
>   be probed by a driver
> 
> And already prevents creating a device link with the consumer as a
> supplier of a parent.
> 
> So, we no longer need to find the "compatible" node of the supplier or
> do any other checks in of_link_to_phandle(). We simply need to make sure
> that the supplier is available in DT.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
>  drivers/of/property.c | 84 +++++++------------------------------------
>  1 file changed, 13 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 134cfc980b70..c651aad6f34b 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
>  	return of_device_get_match_data(dev);
>  }
>  
> -static bool of_is_ancestor_of(struct device_node *test_ancestor,
> -			      struct device_node *child)
> -{
> -	of_node_get(child);
> -	while (child) {
> -		if (child == test_ancestor) {
> -			of_node_put(child);
> -			return true;
> -		}
> -		child = of_get_next_parent(child);
> -	}
> -	return false;
> -}
> -
>  static struct device_node *of_get_compat_node(struct device_node *np)
>  {
>  	of_node_get(np);
> @@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
>  	return node;
>  }
>  
> -/**
> - * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
> - * @con_np: consumer device tree node
> - * @sup_np: supplier device tree node
> - *
> - * Given a phandle to a supplier device tree node (@sup_np), this function
> - * finds the device that owns the supplier device tree node and creates a
> - * device link from @dev consumer device to the supplier device. This function
> - * doesn't create device links for invalid scenarios such as trying to create a
> - * link with a parent device as the consumer of its child device. In such
> - * cases, it returns an error.
> - *
> - * Returns:
> - * - 0 if fwnode link successfully created to supplier
> - * - -EINVAL if the supplier link is invalid and should not be created
> - * - -ENODEV if struct device will never be create for supplier
> - */
> -static int of_link_to_phandle(struct device_node *con_np,
> +static void of_link_to_phandle(struct device_node *con_np,
>  			      struct device_node *sup_np)
>  {
> -	struct device *sup_dev;
> -	struct device_node *tmp_np = sup_np;
> +	struct device_node *tmp_np = of_node_get(sup_np);
>  
> -	/*
> -	 * Find the device node that contains the supplier phandle.  It may be
> -	 * @sup_np or it may be an ancestor of @sup_np.
> -	 */
> -	sup_np = of_get_compat_node(sup_np);
> -	if (!sup_np) {
> -		pr_debug("Not linking %pOFP to %pOFP - No device\n",
> -			 con_np, tmp_np);
> -		return -ENODEV;
> -	}
> +	/* Check that sup_np and its ancestors are available. */
> +	while (tmp_np) {
> +		if (of_fwnode_handle(tmp_np)->dev) {
> +			of_node_put(tmp_np);
> +			break;
> +		}
>  
> -	/*
> -	 * Don't allow linking a device node as a consumer of one of its
> -	 * descendant nodes. By definition, a child node can't be a functional
> -	 * dependency for the parent node.
> -	 */
> -	if (of_is_ancestor_of(con_np, sup_np)) {
> -		pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
> -			 con_np, sup_np);
> -		of_node_put(sup_np);
> -		return -EINVAL;
> -	}
> +		if (!of_device_is_available(tmp_np)) {
> +			of_node_put(tmp_np);
> +			return;
> +		}
>  
> -	/*
> -	 * Don't create links to "early devices" that won't have struct devices
> -	 * created for them.
> -	 */
> -	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
> -	if (!sup_dev &&
> -	    (of_node_check_flag(sup_np, OF_POPULATED) ||
> -	     sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
> -		pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
> -			 con_np, sup_np);
> -		of_node_put(sup_np);
> -		return -ENODEV;
> +		tmp_np = of_get_next_parent(tmp_np);
>  	}
> -	put_device(sup_dev);
>  
>  	fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));

fwnode_link_add() returns int. Why is the return type of this function
changed to void?

> -	of_node_put(sup_np);
> -
> -	return 0;
>  }
>  
>  /**

-- 
Regards,

Sakari Ailus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-30 14:31     ` Sudeep Holla
@ 2023-01-30 15:14       ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 15:14 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > Registering an irqdomain sets the flag for the fwnode. But having the
> > flag set when a device is added is interpreted by fw_devlink to mean the
> > device has already been initialized and will never probe. This prevents
> > fw_devlink from creating device links with the gpio_device as a
> > supplier. So, clear the flag before adding the device.

...

> > +	/*
> > +	 * If fwnode doesn't belong to another device, it's safe to clear its
> > +	 * initialized flag.
> > +	 */
> > +	if (!gdev->dev.fwnode->dev)
> > +		fwnode_dev_initialized(gdev->dev.fwnode, false);
> 
> This is the one causing the kernel crash during the boot on FVP which
> Naresh has reported. Just reverted this and was able to boot, confirming
> the issue with this patch.

I'm wondering if

	if (!dev_fwnode(&gdev->dev)->dev)
		fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);

works.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-30 15:14       ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 15:14 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > Registering an irqdomain sets the flag for the fwnode. But having the
> > flag set when a device is added is interpreted by fw_devlink to mean the
> > device has already been initialized and will never probe. This prevents
> > fw_devlink from creating device links with the gpio_device as a
> > supplier. So, clear the flag before adding the device.

...

> > +	/*
> > +	 * If fwnode doesn't belong to another device, it's safe to clear its
> > +	 * initialized flag.
> > +	 */
> > +	if (!gdev->dev.fwnode->dev)
> > +		fwnode_dev_initialized(gdev->dev.fwnode, false);
> 
> This is the one causing the kernel crash during the boot on FVP which
> Naresh has reported. Just reverted this and was able to boot, confirming
> the issue with this patch.

I'm wondering if

	if (!dev_fwnode(&gdev->dev)->dev)
		fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);

works.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
  2023-01-30 14:36           ` Geert Uytterhoeven
@ 2023-01-30 15:16             ` Andy Shevchenko
  -1 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 15:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 03:36:04PM +0100, Geert Uytterhoeven wrote:
> On Mon, Jan 30, 2023 at 1:16 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> > > On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > > > +                              struct fwnode_handle *sup_handle)
> > > > > +{
> > > > > +     struct fwnode_link *link;
> > > > > +     struct device_link *dev_link;
> > > >
> > > > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> > > >
> > > > You can put it the first line since it's long enough.
> > >
> > > Wait, is that a style guideline to have the longer lines first?
> >
> > No, but it's easier to read.
> 
> Yes it is, "reverse xmas tree" local variable ordering:
> https://elixir.bootlin.com/linux/v6.2-rc6/source/Documentation/process/maintainer-netdev.rst#L272

Good to  know, thanks!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust
@ 2023-01-30 15:16             ` Andy Shevchenko
  0 siblings, 0 replies; 146+ messages in thread
From: Andy Shevchenko @ 2023-01-30 15:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 03:36:04PM +0100, Geert Uytterhoeven wrote:
> On Mon, Jan 30, 2023 at 1:16 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Fri, Jan 27, 2023 at 11:34:28PM -0800, Saravana Kannan wrote:
> > > On Fri, Jan 27, 2023 at 1:43 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Thu, Jan 26, 2023 at 04:11:35PM -0800, Saravana Kannan wrote:
> > > > > +static bool __fw_devlink_relax_cycles(struct device *con,
> > > > > +                              struct fwnode_handle *sup_handle)
> > > > > +{
> > > > > +     struct fwnode_link *link;
> > > > > +     struct device_link *dev_link;
> > > >
> > > > > +     struct device *sup_dev = NULL, *par_dev = NULL;
> > > >
> > > > You can put it the first line since it's long enough.
> > >
> > > Wait, is that a style guideline to have the longer lines first?
> >
> > No, but it's easier to read.
> 
> Yes it is, "reverse xmas tree" local variable ordering:
> https://elixir.bootlin.com/linux/v6.2-rc6/source/Documentation/process/maintainer-netdev.rst#L272

Good to  know, thanks!

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-30  8:42         ` Geert Uytterhoeven
@ 2023-01-30 20:00           ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-30 20:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > tree node will not have a struct device created for it. This information
> > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > device tree node.
> > > >
> > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > effect without using OF specific flags. This allows more generic code to
> > > > be written in driver core.
> > > >
> > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > >
> > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > >         if (!error)
> > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > >
> > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > it should work fine.
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > i.e. will queue in renesas-devel for v6.4.

I hope you meant queue it up for 6.3 and not 6.4?

> >
> > Thanks! Does that mean I should drop this from this series? If two
> > maintainers pick the same patch up, will it cause problems? I'm
> > eventually expecting this series to be picked up by Greg into
> > driver-core-next.
>
> Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> through the renesas-devel and soc trees. This patch has no dependencies
> on anything else in the series (or vice versa), so there is no reason
> to deviate from that, and possibly cause conflicts later.

This series is supposed to fix a bunch of issues and I vaguely think
the series depends on this patch to work correctly on some Renesas
systems. You are my main renesas person, so it's probably some issue
you hit. Is you pick it up outside of this series I need to keep
asking folks to pick up two different patch threads. I don't have a
strong opinion, just a FYI. If you can take this patch soon, I don't
have any concerns.

> BTW, I will convert to of_node_to_fwnode() while applying.

Sounds good.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-30 20:00           ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-30 20:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > tree node will not have a struct device created for it. This information
> > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > device tree node.
> > > >
> > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > effect without using OF specific flags. This allows more generic code to
> > > > be written in driver core.
> > > >
> > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > >
> > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > >         if (!error)
> > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > >
> > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > it should work fine.
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > i.e. will queue in renesas-devel for v6.4.

I hope you meant queue it up for 6.3 and not 6.4?

> >
> > Thanks! Does that mean I should drop this from this series? If two
> > maintainers pick the same patch up, will it cause problems? I'm
> > eventually expecting this series to be picked up by Greg into
> > driver-core-next.
>
> Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> through the renesas-devel and soc trees. This patch has no dependencies
> on anything else in the series (or vice versa), so there is no reason
> to deviate from that, and possibly cause conflicts later.

This series is supposed to fix a bunch of issues and I vaguely think
the series depends on this patch to work correctly on some Renesas
systems. You are my main renesas person, so it's probably some issue
you hit. Is you pick it up outside of this series I need to keep
asking folks to pick up two different patch threads. I don't have a
strong opinion, just a FYI. If you can take this patch soon, I don't
have any concerns.

> BTW, I will convert to of_node_to_fwnode() while applying.

Sounds good.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-30  8:55   ` Naresh Kamboju
@ 2023-01-30 23:03     ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-30 23:03 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: abel.vesa, alexander.stein, andriy.shevchenko, bigunclemax, brgl,
	colin.foster, cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, sudeep.holla, tglx, tony

On Mon, Jan 30, 2023 at 12:56 AM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
>
> Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> sparc and x86_64.
>
> Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> Boot failed on FVP.
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>
> Please refer following link for details of testing.
> FVP boot log failed.
> https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/

Sudeep pointed me to what the issue might be. But it's strange that
you are hitting an issue now. I'm pretty sure I haven't changed this
part since v1. I'd also expect the limited assumptions I made to have
not been affected between v1 and v2.

Anyway, I'll look at this and fix it in v3.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-30 23:03     ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-30 23:03 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: abel.vesa, alexander.stein, andriy.shevchenko, bigunclemax, brgl,
	colin.foster, cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, sudeep.holla, tglx, tony

On Mon, Jan 30, 2023 at 12:56 AM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
>
> Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> sparc and x86_64.
>
> Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> Boot failed on FVP.
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>
> Please refer following link for details of testing.
> FVP boot log failed.
> https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/

Sudeep pointed me to what the issue might be. But it's strange that
you are hitting an issue now. I'm pretty sure I haven't changed this
part since v1. I'd also expect the limited assumptions I made to have
not been affected between v1 and v2.

Anyway, I'll look at this and fix it in v3.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-30 12:08     ` Maxim Kiselev
@ 2023-01-31  1:20       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  1:20 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Miquel Raynal, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Tony Lindgren,
	Linux Kernel Functional Testing, Naresh Kamboju, Abel Vesa,
	Alexander Stein, Geert Uytterhoeven, John Stultz, Doug Anderson,
	Guenter Roeck, Dmitry Baryshkov, Maxim Kochetkov, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 4:09 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> Hi Saravana & Miquel.
>
> Sorry for the long response. I finally got access to my test device
> and tried this patch series.
>
> And unfortunately it didn't solve my issue. I'm still getting a
> hanging f1070000.ethernet dependency
> from the nvmem-cell mac@6 subnode.

Thanks for testing the series.

Btw, don't top post. It's frowned upon. Top post means your reply is
on the top before the email you are replying to. See how my first line
of reply in inline with your email I'm replying to?

>
> Here are related parts of my kernel log and device tree:
>
>
>     [    2.713302] device: 'mtd-0': device_add
>     [    2.719528] device: 'spi0': device_add
>     [    2.724180] device: 'spi0.0': device_add
>     [    2.728957] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
>     [    2.735338] 7 fixed-partitions partitions found on MTD device spi0.0
>     [    2.741978] device:
> 'f1010600.spi:m25p80@0:partitions:partition@1': device_add
>     [    2.749636] Creating 7 MTD partitions on "spi0.0":
>     [    2.754564] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
>     [    2.759981] device: 'mtd0': device_add
>     [    2.764323] device: 'mtd0': device_add
>     [    2.768280] device: 'mtd0ro': device_add
>     [    2.772624] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
>     [    2.778218] device: 'mtd1': device_add
>     [    2.782549] device: 'mtd1': device_add
>     [    2.786582] device: 'mtd1ro': device_add
>     ...
>     [    5.426625] mvneta_bm f10c0000.bm: Buffer Manager for network
> controller enabled
>     [    5.492867] platform f1070000.ethernet: error -EPROBE_DEFER:
> wait for supplier mac@6
>     [    5.528636] device: 'Fixed MDIO bus.0': device_add
>     [    5.533726] device: 'fixed-0': device_add
>     [    5.547564] device: 'f1072004.mdio-eth-mii': device_add
>     [    5.616368] device: 'f1072004.mdio-eth-mii:00': device_add
>     [    5.645127] device: 'f1072004.mdio-eth-mii:1e': device_add
>     [    5.651530] devices_kset: Moving f1070000.ethernet to end of list
>     [    5.657948] platform f1070000.ethernet: error -EPROBE_DEFER:
> wait for supplier mac@6
>
>     spi@10600 {
>         m25p80@0 {
>             compatible = "mx66l51235l";
>
>             partitions {
>                 compatible = "fixed-partitions";
>
>                 partition@0 {
>                     label = "SPI.U_BOOT";
>                 };
>                 partition@1 {
>                     compatible = "nvmem-cells";
>                     label = "SPI.INV_INFO";
>                     macaddr: mac@6 {
>                         reg = <0x6 0x6>;
>                     };
>                 };
>                 ...
>             };
>         };
>     };
>
>     enet1: ethernet@70000 {
>         nvmem-cells = <&macaddr>;
>         nvmem-cell-names = "mac-address";
>         phy-mode = "rgmii";
>         phy = <&phy0>;
>     };
>
>
> Maybe I should provide some additional debug info?

I took a look at it and I think I know the issue. But it'll be good if
you can point me to the dts (not dtsi) file that corresponds to the
board you are seeing this issue on so I can double check my guess by
looking at the exact code/drivers.

The main problem/mistake is the nvmem framework is using a "struct
bus" instead of a "struct class" to keep a list of the nvmem devices.
And we can't change it now because it'd affect the sysfs paths
significantly and might break userspace ABI.

Can you try the patch at the end of this email under these
configurations and tell me which ones fail vs pass? I don't need logs
for any pass/failures.
1. On top of this series
2. Without this series
3. On top of the series but with the call to fwnode_dev_initialized() deleted?
4. Without this series, but with the call to fwnode_dev_initialized() deleted?

-Saravana

Sorry about tabs to spaces conversion. Email client issue.

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 321d7d63e068..23d94c0ecccf 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -752,6 +752,7 @@ static int nvmem_add_cells_from_of(struct
nvmem_device *nvmem)
 struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 {
        struct nvmem_device *nvmem;
+       struct fwnode_handle *fwnode;
        int rval;

        if (!config->dev)
@@ -804,9 +805,18 @@ struct nvmem_device *nvmem_register(const struct
nvmem_config *config)
        nvmem->keepout = config->keepout;
        nvmem->nkeepout = config->nkeepout;
        if (config->of_node)
-               nvmem->dev.of_node = config->of_node;
+               fwnode = of_fwnode_handle(config->of_node);
        else if (!config->no_of_node)
-               nvmem->dev.of_node = config->dev->of_node;
+               fwnode = of_fwnode_handle(config->dev->of_node);
+       device_set_node(&nvmem->dev, fwnode);
+
+       /*
+        * If the fwnode doesn't have another device associated with it, mark
+        * the fwnode as initialized since no driver is going to bind to the
+        * nvmem.
+        */
+       if (fwnode && !fwnode->dev)
+               fwnode_dev_initialized(fwnode, true);

        switch (config->id) {
        case NVMEM_DEVID_NONE:

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-31  1:20       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  1:20 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Miquel Raynal, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sudeep Holla, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, Sakari Ailus, Tony Lindgren,
	Linux Kernel Functional Testing, Naresh Kamboju, Abel Vesa,
	Alexander Stein, Geert Uytterhoeven, John Stultz, Doug Anderson,
	Guenter Roeck, Dmitry Baryshkov, Maxim Kochetkov, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 4:09 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> Hi Saravana & Miquel.
>
> Sorry for the long response. I finally got access to my test device
> and tried this patch series.
>
> And unfortunately it didn't solve my issue. I'm still getting a
> hanging f1070000.ethernet dependency
> from the nvmem-cell mac@6 subnode.

Thanks for testing the series.

Btw, don't top post. It's frowned upon. Top post means your reply is
on the top before the email you are replying to. See how my first line
of reply in inline with your email I'm replying to?

>
> Here are related parts of my kernel log and device tree:
>
>
>     [    2.713302] device: 'mtd-0': device_add
>     [    2.719528] device: 'spi0': device_add
>     [    2.724180] device: 'spi0.0': device_add
>     [    2.728957] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
>     [    2.735338] 7 fixed-partitions partitions found on MTD device spi0.0
>     [    2.741978] device:
> 'f1010600.spi:m25p80@0:partitions:partition@1': device_add
>     [    2.749636] Creating 7 MTD partitions on "spi0.0":
>     [    2.754564] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
>     [    2.759981] device: 'mtd0': device_add
>     [    2.764323] device: 'mtd0': device_add
>     [    2.768280] device: 'mtd0ro': device_add
>     [    2.772624] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
>     [    2.778218] device: 'mtd1': device_add
>     [    2.782549] device: 'mtd1': device_add
>     [    2.786582] device: 'mtd1ro': device_add
>     ...
>     [    5.426625] mvneta_bm f10c0000.bm: Buffer Manager for network
> controller enabled
>     [    5.492867] platform f1070000.ethernet: error -EPROBE_DEFER:
> wait for supplier mac@6
>     [    5.528636] device: 'Fixed MDIO bus.0': device_add
>     [    5.533726] device: 'fixed-0': device_add
>     [    5.547564] device: 'f1072004.mdio-eth-mii': device_add
>     [    5.616368] device: 'f1072004.mdio-eth-mii:00': device_add
>     [    5.645127] device: 'f1072004.mdio-eth-mii:1e': device_add
>     [    5.651530] devices_kset: Moving f1070000.ethernet to end of list
>     [    5.657948] platform f1070000.ethernet: error -EPROBE_DEFER:
> wait for supplier mac@6
>
>     spi@10600 {
>         m25p80@0 {
>             compatible = "mx66l51235l";
>
>             partitions {
>                 compatible = "fixed-partitions";
>
>                 partition@0 {
>                     label = "SPI.U_BOOT";
>                 };
>                 partition@1 {
>                     compatible = "nvmem-cells";
>                     label = "SPI.INV_INFO";
>                     macaddr: mac@6 {
>                         reg = <0x6 0x6>;
>                     };
>                 };
>                 ...
>             };
>         };
>     };
>
>     enet1: ethernet@70000 {
>         nvmem-cells = <&macaddr>;
>         nvmem-cell-names = "mac-address";
>         phy-mode = "rgmii";
>         phy = <&phy0>;
>     };
>
>
> Maybe I should provide some additional debug info?

I took a look at it and I think I know the issue. But it'll be good if
you can point me to the dts (not dtsi) file that corresponds to the
board you are seeing this issue on so I can double check my guess by
looking at the exact code/drivers.

The main problem/mistake is the nvmem framework is using a "struct
bus" instead of a "struct class" to keep a list of the nvmem devices.
And we can't change it now because it'd affect the sysfs paths
significantly and might break userspace ABI.

Can you try the patch at the end of this email under these
configurations and tell me which ones fail vs pass? I don't need logs
for any pass/failures.
1. On top of this series
2. Without this series
3. On top of the series but with the call to fwnode_dev_initialized() deleted?
4. Without this series, but with the call to fwnode_dev_initialized() deleted?

-Saravana

Sorry about tabs to spaces conversion. Email client issue.

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 321d7d63e068..23d94c0ecccf 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -752,6 +752,7 @@ static int nvmem_add_cells_from_of(struct
nvmem_device *nvmem)
 struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 {
        struct nvmem_device *nvmem;
+       struct fwnode_handle *fwnode;
        int rval;

        if (!config->dev)
@@ -804,9 +805,18 @@ struct nvmem_device *nvmem_register(const struct
nvmem_config *config)
        nvmem->keepout = config->keepout;
        nvmem->nkeepout = config->nkeepout;
        if (config->of_node)
-               nvmem->dev.of_node = config->of_node;
+               fwnode = of_fwnode_handle(config->of_node);
        else if (!config->no_of_node)
-               nvmem->dev.of_node = config->dev->of_node;
+               fwnode = of_fwnode_handle(config->dev->of_node);
+       device_set_node(&nvmem->dev, fwnode);
+
+       /*
+        * If the fwnode doesn't have another device associated with it, mark
+        * the fwnode as initialized since no driver is going to bind to the
+        * nvmem.
+        */
+       if (fwnode && !fwnode->dev)
+               fwnode_dev_initialized(fwnode, true);

        switch (config->id) {
        case NVMEM_DEVID_NONE:

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
  2023-01-30 14:39     ` Sakari Ailus
@ 2023-01-31  3:51       ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  3:51 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 10:15 AM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Saravana,
>
> On Thu, Jan 26, 2023 at 04:11:36PM -0800, Saravana Kannan wrote:
> > The driver core now:
> > - Has the parent device of a supplier pick up the consumers if the
> >   supplier never has a device created for it.
> > - Ignores a supplier if the supplier has no parent device and will never
> >   be probed by a driver
> >
> > And already prevents creating a device link with the consumer as a
> > supplier of a parent.
> >
> > So, we no longer need to find the "compatible" node of the supplier or
> > do any other checks in of_link_to_phandle(). We simply need to make sure
> > that the supplier is available in DT.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > ---
> >  drivers/of/property.c | 84 +++++++------------------------------------
> >  1 file changed, 13 insertions(+), 71 deletions(-)
> >
> > diff --git a/drivers/of/property.c b/drivers/of/property.c
> > index 134cfc980b70..c651aad6f34b 100644
> > --- a/drivers/of/property.c
> > +++ b/drivers/of/property.c
> > @@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
> >       return of_device_get_match_data(dev);
> >  }
> >
> > -static bool of_is_ancestor_of(struct device_node *test_ancestor,
> > -                           struct device_node *child)
> > -{
> > -     of_node_get(child);
> > -     while (child) {
> > -             if (child == test_ancestor) {
> > -                     of_node_put(child);
> > -                     return true;
> > -             }
> > -             child = of_get_next_parent(child);
> > -     }
> > -     return false;
> > -}
> > -
> >  static struct device_node *of_get_compat_node(struct device_node *np)
> >  {
> >       of_node_get(np);
> > @@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
> >       return node;
> >  }
> >
> > -/**
> > - * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
> > - * @con_np: consumer device tree node
> > - * @sup_np: supplier device tree node
> > - *
> > - * Given a phandle to a supplier device tree node (@sup_np), this function
> > - * finds the device that owns the supplier device tree node and creates a
> > - * device link from @dev consumer device to the supplier device. This function
> > - * doesn't create device links for invalid scenarios such as trying to create a
> > - * link with a parent device as the consumer of its child device. In such
> > - * cases, it returns an error.
> > - *
> > - * Returns:
> > - * - 0 if fwnode link successfully created to supplier
> > - * - -EINVAL if the supplier link is invalid and should not be created
> > - * - -ENODEV if struct device will never be create for supplier
> > - */
> > -static int of_link_to_phandle(struct device_node *con_np,
> > +static void of_link_to_phandle(struct device_node *con_np,
> >                             struct device_node *sup_np)
> >  {
> > -     struct device *sup_dev;
> > -     struct device_node *tmp_np = sup_np;
> > +     struct device_node *tmp_np = of_node_get(sup_np);
> >
> > -     /*
> > -      * Find the device node that contains the supplier phandle.  It may be
> > -      * @sup_np or it may be an ancestor of @sup_np.
> > -      */
> > -     sup_np = of_get_compat_node(sup_np);
> > -     if (!sup_np) {
> > -             pr_debug("Not linking %pOFP to %pOFP - No device\n",
> > -                      con_np, tmp_np);
> > -             return -ENODEV;
> > -     }
> > +     /* Check that sup_np and its ancestors are available. */
> > +     while (tmp_np) {
> > +             if (of_fwnode_handle(tmp_np)->dev) {
> > +                     of_node_put(tmp_np);
> > +                     break;
> > +             }
> >
> > -     /*
> > -      * Don't allow linking a device node as a consumer of one of its
> > -      * descendant nodes. By definition, a child node can't be a functional
> > -      * dependency for the parent node.
> > -      */
> > -     if (of_is_ancestor_of(con_np, sup_np)) {
> > -             pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
> > -                      con_np, sup_np);
> > -             of_node_put(sup_np);
> > -             return -EINVAL;
> > -     }
> > +             if (!of_device_is_available(tmp_np)) {
> > +                     of_node_put(tmp_np);
> > +                     return;
> > +             }
> >
> > -     /*
> > -      * Don't create links to "early devices" that won't have struct devices
> > -      * created for them.
> > -      */
> > -     sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
> > -     if (!sup_dev &&
> > -         (of_node_check_flag(sup_np, OF_POPULATED) ||
> > -          sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
> > -             pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
> > -                      con_np, sup_np);
> > -             of_node_put(sup_np);
> > -             return -ENODEV;
> > +             tmp_np = of_get_next_parent(tmp_np);
> >       }
> > -     put_device(sup_dev);
> >
> >       fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));
>
> fwnode_link_add() returns int. Why is the return type of this function
> changed to void?

The return value of fwnode_link_add() was ignored even before this
patch. Since all other reasons for of_link_to_phandle() to fail are
gone, I'm switching it to void.

fwnode_link_add() is ignored because it can only fail due to -ENOMEM.
Not much to do in that case. We do our best and move on.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 09/11] of: property: Simplify of_link_to_phandle()
@ 2023-01-31  3:51       ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  3:51 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 10:15 AM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> Hi Saravana,
>
> On Thu, Jan 26, 2023 at 04:11:36PM -0800, Saravana Kannan wrote:
> > The driver core now:
> > - Has the parent device of a supplier pick up the consumers if the
> >   supplier never has a device created for it.
> > - Ignores a supplier if the supplier has no parent device and will never
> >   be probed by a driver
> >
> > And already prevents creating a device link with the consumer as a
> > supplier of a parent.
> >
> > So, we no longer need to find the "compatible" node of the supplier or
> > do any other checks in of_link_to_phandle(). We simply need to make sure
> > that the supplier is available in DT.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > ---
> >  drivers/of/property.c | 84 +++++++------------------------------------
> >  1 file changed, 13 insertions(+), 71 deletions(-)
> >
> > diff --git a/drivers/of/property.c b/drivers/of/property.c
> > index 134cfc980b70..c651aad6f34b 100644
> > --- a/drivers/of/property.c
> > +++ b/drivers/of/property.c
> > @@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
> >       return of_device_get_match_data(dev);
> >  }
> >
> > -static bool of_is_ancestor_of(struct device_node *test_ancestor,
> > -                           struct device_node *child)
> > -{
> > -     of_node_get(child);
> > -     while (child) {
> > -             if (child == test_ancestor) {
> > -                     of_node_put(child);
> > -                     return true;
> > -             }
> > -             child = of_get_next_parent(child);
> > -     }
> > -     return false;
> > -}
> > -
> >  static struct device_node *of_get_compat_node(struct device_node *np)
> >  {
> >       of_node_get(np);
> > @@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat_node_parent(struct device_node *np)
> >       return node;
> >  }
> >
> > -/**
> > - * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
> > - * @con_np: consumer device tree node
> > - * @sup_np: supplier device tree node
> > - *
> > - * Given a phandle to a supplier device tree node (@sup_np), this function
> > - * finds the device that owns the supplier device tree node and creates a
> > - * device link from @dev consumer device to the supplier device. This function
> > - * doesn't create device links for invalid scenarios such as trying to create a
> > - * link with a parent device as the consumer of its child device. In such
> > - * cases, it returns an error.
> > - *
> > - * Returns:
> > - * - 0 if fwnode link successfully created to supplier
> > - * - -EINVAL if the supplier link is invalid and should not be created
> > - * - -ENODEV if struct device will never be create for supplier
> > - */
> > -static int of_link_to_phandle(struct device_node *con_np,
> > +static void of_link_to_phandle(struct device_node *con_np,
> >                             struct device_node *sup_np)
> >  {
> > -     struct device *sup_dev;
> > -     struct device_node *tmp_np = sup_np;
> > +     struct device_node *tmp_np = of_node_get(sup_np);
> >
> > -     /*
> > -      * Find the device node that contains the supplier phandle.  It may be
> > -      * @sup_np or it may be an ancestor of @sup_np.
> > -      */
> > -     sup_np = of_get_compat_node(sup_np);
> > -     if (!sup_np) {
> > -             pr_debug("Not linking %pOFP to %pOFP - No device\n",
> > -                      con_np, tmp_np);
> > -             return -ENODEV;
> > -     }
> > +     /* Check that sup_np and its ancestors are available. */
> > +     while (tmp_np) {
> > +             if (of_fwnode_handle(tmp_np)->dev) {
> > +                     of_node_put(tmp_np);
> > +                     break;
> > +             }
> >
> > -     /*
> > -      * Don't allow linking a device node as a consumer of one of its
> > -      * descendant nodes. By definition, a child node can't be a functional
> > -      * dependency for the parent node.
> > -      */
> > -     if (of_is_ancestor_of(con_np, sup_np)) {
> > -             pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
> > -                      con_np, sup_np);
> > -             of_node_put(sup_np);
> > -             return -EINVAL;
> > -     }
> > +             if (!of_device_is_available(tmp_np)) {
> > +                     of_node_put(tmp_np);
> > +                     return;
> > +             }
> >
> > -     /*
> > -      * Don't create links to "early devices" that won't have struct devices
> > -      * created for them.
> > -      */
> > -     sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
> > -     if (!sup_dev &&
> > -         (of_node_check_flag(sup_np, OF_POPULATED) ||
> > -          sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
> > -             pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
> > -                      con_np, sup_np);
> > -             of_node_put(sup_np);
> > -             return -ENODEV;
> > +             tmp_np = of_get_next_parent(tmp_np);
> >       }
> > -     put_device(sup_dev);
> >
> >       fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));
>
> fwnode_link_add() returns int. Why is the return type of this function
> changed to void?

The return value of fwnode_link_add() was ignored even before this
patch. Since all other reasons for of_link_to_phandle() to fail are
gone, I'm switching it to void.

fwnode_link_add() is ignored because it can only fail due to -ENOMEM.
Not much to do in that case. We do our best and move on.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-30 15:14       ` Andy Shevchenko
@ 2023-01-31  4:01         ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  4:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > device has already been initialized and will never probe. This prevents
> > > fw_devlink from creating device links with the gpio_device as a
> > > supplier. So, clear the flag before adding the device.
>
> ...
>
> > > +   /*
> > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > +    * initialized flag.
> > > +    */
> > > +   if (!gdev->dev.fwnode->dev)
> > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> >
> > This is the one causing the kernel crash during the boot on FVP which
> > Naresh has reported. Just reverted this and was able to boot, confirming
> > the issue with this patch.
>
> I'm wondering if
>
>         if (!dev_fwnode(&gdev->dev)->dev)
>                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
>
> works.

No, that won't help. The problem was that with arm32, we have gpio
devices created without any of_node or fwnode. So I can't assume
fwnode will always be present.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-31  4:01         ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-01-31  4:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > device has already been initialized and will never probe. This prevents
> > > fw_devlink from creating device links with the gpio_device as a
> > > supplier. So, clear the flag before adding the device.
>
> ...
>
> > > +   /*
> > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > +    * initialized flag.
> > > +    */
> > > +   if (!gdev->dev.fwnode->dev)
> > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> >
> > This is the one causing the kernel crash during the boot on FVP which
> > Naresh has reported. Just reverted this and was able to boot, confirming
> > the issue with this patch.
>
> I'm wondering if
>
>         if (!dev_fwnode(&gdev->dev)->dev)
>                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
>
> works.

No, that won't help. The problem was that with arm32, we have gpio
devices created without any of_node or fwnode. So I can't assume
fwnode will always be present.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-30 20:00           ` Saravana Kannan
@ 2023-01-31  8:14             ` Geert Uytterhoeven
  -1 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-31  8:14 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Mon, Jan 30, 2023 at 9:00 PM Saravana Kannan <saravanak@google.com> wrote:
> On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > > <geert@linux-m68k.org> wrote:
> > > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > > tree node will not have a struct device created for it. This information
> > > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > > device tree node.
> > > > >
> > > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > > effect without using OF specific flags. This allows more generic code to
> > > > > be written in driver core.
> > > > >
> > > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > >
> > > > Thanks for your patch!
> > > >
> > > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > > >
> > > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > > >         if (!error)
> > > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > > >
> > > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > > it should work fine.
> > > >
> > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > i.e. will queue in renesas-devel for v6.4.
>
> I hope you meant queue it up for 6.3 and not 6.4?

V6.4.
The deadline for submitting pull requests for the soc tree is rc6.
Sorry, your series was posted too late to make that.

> > > Thanks! Does that mean I should drop this from this series? If two
> > > maintainers pick the same patch up, will it cause problems? I'm
> > > eventually expecting this series to be picked up by Greg into
> > > driver-core-next.
> >
> > Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> > through the renesas-devel and soc trees. This patch has no dependencies
> > on anything else in the series (or vice versa), so there is no reason
> > to deviate from that, and possibly cause conflicts later.
>
> This series is supposed to fix a bunch of issues and I vaguely think
> the series depends on this patch to work correctly on some Renesas
> systems. You are my main renesas person, so it's probably some issue
> you hit. Is you pick it up outside of this series I need to keep
> asking folks to pick up two different patch threads. I don't have a
> strong opinion, just a FYI. If you can take this patch soon, I don't
> have any concerns.

Oh right, you do remove OF_POPULATED handling in
"[PATCH v2 09/11] of: property: Simplify of_link_to_phandle()".
It might be wise to postpone that removal, as after your series,
there are stillseveral users left, some of them might be impacted.

I do plan to test your full series on all my boards, but probably that
won't happen this week.

> > BTW, I will convert to of_node_to_fwnode() while applying.
>
> Sounds good.

If you still want this to land in v6,3 (with the of_node_to_fwnode()
conversion):
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-01-31  8:14             ` Geert Uytterhoeven
  0 siblings, 0 replies; 146+ messages in thread
From: Geert Uytterhoeven @ 2023-01-31  8:14 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

Hi Saravana,

On Mon, Jan 30, 2023 at 9:00 PM Saravana Kannan <saravanak@google.com> wrote:
> On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > > <geert@linux-m68k.org> wrote:
> > > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > > tree node will not have a struct device created for it. This information
> > > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > > device tree node.
> > > > >
> > > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > > effect without using OF specific flags. This allows more generic code to
> > > > > be written in driver core.
> > > > >
> > > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > >
> > > > Thanks for your patch!
> > > >
> > > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > > >
> > > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > > >         if (!error)
> > > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > > >
> > > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > > it should work fine.
> > > >
> > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > i.e. will queue in renesas-devel for v6.4.
>
> I hope you meant queue it up for 6.3 and not 6.4?

V6.4.
The deadline for submitting pull requests for the soc tree is rc6.
Sorry, your series was posted too late to make that.

> > > Thanks! Does that mean I should drop this from this series? If two
> > > maintainers pick the same patch up, will it cause problems? I'm
> > > eventually expecting this series to be picked up by Greg into
> > > driver-core-next.
> >
> > Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> > through the renesas-devel and soc trees. This patch has no dependencies
> > on anything else in the series (or vice versa), so there is no reason
> > to deviate from that, and possibly cause conflicts later.
>
> This series is supposed to fix a bunch of issues and I vaguely think
> the series depends on this patch to work correctly on some Renesas
> systems. You are my main renesas person, so it's probably some issue
> you hit. Is you pick it up outside of this series I need to keep
> asking folks to pick up two different patch threads. I don't have a
> strong opinion, just a FYI. If you can take this patch soon, I don't
> have any concerns.

Oh right, you do remove OF_POPULATED handling in
"[PATCH v2 09/11] of: property: Simplify of_link_to_phandle()".
It might be wise to postpone that removal, as after your series,
there are stillseveral users left, some of them might be impacted.

I do plan to test your full series on all my boards, but probably that
won't happen this week.

> > BTW, I will convert to of_node_to_fwnode() while applying.
>
> Sounds good.

If you still want this to land in v6,3 (with the of_node_to_fwnode()
conversion):
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-31  4:01         ` Saravana Kannan
@ 2023-01-31 10:13           ` Sudeep Holla
  -1 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-31 10:13 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Andy Shevchenko, Sudeep Holla, Greg Kroah-Hartman,
	Rafael J. Wysocki, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 08:01:17PM -0800, Saravana Kannan wrote:
> On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > > device has already been initialized and will never probe. This prevents
> > > > fw_devlink from creating device links with the gpio_device as a
> > > > supplier. So, clear the flag before adding the device.
> >
> > ...
> >
> > > > +   /*
> > > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > > +    * initialized flag.
> > > > +    */
> > > > +   if (!gdev->dev.fwnode->dev)
> > > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> > >
> > > This is the one causing the kernel crash during the boot on FVP which
> > > Naresh has reported. Just reverted this and was able to boot, confirming
> > > the issue with this patch.
> >
> > I'm wondering if
> >
> >         if (!dev_fwnode(&gdev->dev)->dev)
> >                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
> >
> > works.
> 
> No, that won't help. The problem was that with arm32, we have gpio
> devices created without any of_node or fwnode. So I can't assume
> fwnode will always be present.
>

Correct, and this one is not even arm32. But it is just reusing a driver
that needs to be supported even on arm32.

Not sure on how to proceed. As a simple way to check, I added a NULL check
for fwnode building on top of Andy's suggestion[1]. That works.

Also the driver in question on arm64 FVP model is drivers/mfd/vexpress-sysreg.c
mfd_add_device() in drivers/mfd/mfd-core.c allows addition of devices without
of_node/fwnode. I am sure returning error like[2] will break many platforms
but I just wanted to confirm the root cause and [2] fixes the boot without
NULL check for fwnode in gpiochip_setup_dev().

Hope this helps.

--
Regards,
Sudeep

[1]

-->8
diff --git i/drivers/gpio/gpiolib.c w/drivers/gpio/gpiolib.c
index b23140c6485f..e162f13aa2c9 100644
--- i/drivers/gpio/gpiolib.c
+++ w/drivers/gpio/gpiolib.c
@@ -577,13 +577,15 @@ static void gpiodevice_release(struct device *dev)
 static int gpiochip_setup_dev(struct gpio_device *gdev)
 {
        int ret;
+       struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);

        /*
         * If fwnode doesn't belong to another device, it's safe to clear its
         * initialized flag.
         */
-       if (!gdev->dev.fwnode->dev)
-               fwnode_dev_initialized(gdev->dev.fwnode, false);
+       if (fwnode && !fwnode->dev)
+               fwnode_dev_initialized(fwnode, false);
+
        ret = gcdev_register(gdev, gpio_devt);
        if (ret)
                return ret;

[2]

-->8

diff --git i/drivers/mfd/mfd-core.c w/drivers/mfd/mfd-core.c
index 16d1861e9682..3b2c4b0e9a2a 100644
--- i/drivers/mfd/mfd-core.c
+++ w/drivers/mfd/mfd-core.c
@@ -231,9 +231,11 @@ static int mfd_add_device(struct device *parent, int id,
                        }
                }

-               if (!pdev->dev.of_node)
+               if (!pdev->dev.of_node) {
                        pr_warn("%s: Failed to locate of_node [id: %d]\n",
                                cell->name, platform_id);
+                       goto fail_alias;
+               }
        }

        mfd_acpi_add_device(cell, pdev);


^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-01-31 10:13           ` Sudeep Holla
  0 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-31 10:13 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Andy Shevchenko, Sudeep Holla, Greg Kroah-Hartman,
	Rafael J. Wysocki, Cristian Marussi, Linus Walleij,
	Bartosz Golaszewski, Thomas Gleixner, Marc Zyngier, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Frank Rowand, Geert Uytterhoeven,
	Magnus Damm, Len Brown, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, Geert Uytterhoeven,
	John Stultz, Doug Anderson, Guenter Roeck, Dmitry Baryshkov,
	Maxim Kiselev, Maxim Kochetkov, Miquel Raynal, Luca Weiss,
	Colin Foster, Martin Kepplinger, Jean-Philippe Brucker,
	kernel-team, linux-kernel, linux-arm-kernel, linux-gpio,
	devicetree, linux-renesas-soc, linux-acpi

On Mon, Jan 30, 2023 at 08:01:17PM -0800, Saravana Kannan wrote:
> On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > > device has already been initialized and will never probe. This prevents
> > > > fw_devlink from creating device links with the gpio_device as a
> > > > supplier. So, clear the flag before adding the device.
> >
> > ...
> >
> > > > +   /*
> > > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > > +    * initialized flag.
> > > > +    */
> > > > +   if (!gdev->dev.fwnode->dev)
> > > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> > >
> > > This is the one causing the kernel crash during the boot on FVP which
> > > Naresh has reported. Just reverted this and was able to boot, confirming
> > > the issue with this patch.
> >
> > I'm wondering if
> >
> >         if (!dev_fwnode(&gdev->dev)->dev)
> >                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
> >
> > works.
> 
> No, that won't help. The problem was that with arm32, we have gpio
> devices created without any of_node or fwnode. So I can't assume
> fwnode will always be present.
>

Correct, and this one is not even arm32. But it is just reusing a driver
that needs to be supported even on arm32.

Not sure on how to proceed. As a simple way to check, I added a NULL check
for fwnode building on top of Andy's suggestion[1]. That works.

Also the driver in question on arm64 FVP model is drivers/mfd/vexpress-sysreg.c
mfd_add_device() in drivers/mfd/mfd-core.c allows addition of devices without
of_node/fwnode. I am sure returning error like[2] will break many platforms
but I just wanted to confirm the root cause and [2] fixes the boot without
NULL check for fwnode in gpiochip_setup_dev().

Hope this helps.

--
Regards,
Sudeep

[1]

-->8
diff --git i/drivers/gpio/gpiolib.c w/drivers/gpio/gpiolib.c
index b23140c6485f..e162f13aa2c9 100644
--- i/drivers/gpio/gpiolib.c
+++ w/drivers/gpio/gpiolib.c
@@ -577,13 +577,15 @@ static void gpiodevice_release(struct device *dev)
 static int gpiochip_setup_dev(struct gpio_device *gdev)
 {
        int ret;
+       struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);

        /*
         * If fwnode doesn't belong to another device, it's safe to clear its
         * initialized flag.
         */
-       if (!gdev->dev.fwnode->dev)
-               fwnode_dev_initialized(gdev->dev.fwnode, false);
+       if (fwnode && !fwnode->dev)
+               fwnode_dev_initialized(fwnode, false);
+
        ret = gcdev_register(gdev, gpio_devt);
        if (ret)
                return ret;

[2]

-->8

diff --git i/drivers/mfd/mfd-core.c w/drivers/mfd/mfd-core.c
index 16d1861e9682..3b2c4b0e9a2a 100644
--- i/drivers/mfd/mfd-core.c
+++ w/drivers/mfd/mfd-core.c
@@ -231,9 +231,11 @@ static int mfd_add_device(struct device *parent, int id,
                        }
                }

-               if (!pdev->dev.of_node)
+               if (!pdev->dev.of_node) {
                        pr_warn("%s: Failed to locate of_node [id: %d]\n",
                                cell->name, platform_id);
+                       goto fail_alias;
+               }
        }

        mfd_acpi_add_device(cell, pdev);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-30 23:03     ` Saravana Kannan
@ 2023-01-31 10:18       ` Sudeep Holla
  -1 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-31 10:18 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Naresh Kamboju, abel.vesa, Sudeep Holla, alexander.stein,
	andriy.shevchenko, bigunclemax, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

Hi Saravana,

On Mon, Jan 30, 2023 at 03:03:01PM -0800, Saravana Kannan wrote:
> On Mon, Jan 30, 2023 at 12:56 AM Naresh Kamboju
> <naresh.kamboju@linaro.org> wrote:
> >
> > Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> > sparc and x86_64.
> >
> > Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> > Boot failed on FVP.
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >
> > Please refer following link for details of testing.
> > FVP boot log failed.
> > https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/
>
> Sudeep pointed me to what the issue might be. But it's strange that
> you are hitting an issue now. I'm pretty sure I haven't changed this
> part since v1. I'd also expect the limited assumptions I made to have
> not been affected between v1 and v2.
>

Sorry I hadn't seen or tested v1.

FYI The fwnode non-NULL check as in your nvmem diff/suggestion and the diff I
replied on the gpiolib patch thread fixes the issues.

> Anyway, I'll look at this and fix it in v3.
>

If you add that fwnode check, feel free to add my tested by.

--
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-01-31 10:18       ` Sudeep Holla
  0 siblings, 0 replies; 146+ messages in thread
From: Sudeep Holla @ 2023-01-31 10:18 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Naresh Kamboju, abel.vesa, Sudeep Holla, alexander.stein,
	andriy.shevchenko, bigunclemax, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, robh+dt, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

Hi Saravana,

On Mon, Jan 30, 2023 at 03:03:01PM -0800, Saravana Kannan wrote:
> On Mon, Jan 30, 2023 at 12:56 AM Naresh Kamboju
> <naresh.kamboju@linaro.org> wrote:
> >
> > Build test pass on arm, arm64, i386, mips, parisc, powerpc, riscv, s390, sh,
> > sparc and x86_64.
> >
> > Boot and LTP smoke pass on qemu-arm64, qemu-armv7, qemu-i386 and qemu-x86_64.
> > Boot failed on FVP.
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >
> > Please refer following link for details of testing.
> > FVP boot log failed.
> > https://qa-reports.linaro.org/~anders.roxell/linux-mainline-patches/build/lore_kernel_org_linux-devicetree_20230127001141_407071-1-saravanak_google_com/testrun/14389034/suite/boot/test/gcc-12-lkftconfig-64k_page_size/details/
>
> Sudeep pointed me to what the issue might be. But it's strange that
> you are hitting an issue now. I'm pretty sure I haven't changed this
> part since v1. I'd also expect the limited assumptions I made to have
> not been affected between v1 and v2.
>

Sorry I hadn't seen or tested v1.

FYI The fwnode non-NULL check as in your nvmem diff/suggestion and the diff I
replied on the gpiolib patch thread fixes the issues.

> Anyway, I'll look at this and fix it in v3.
>

If you add that fwnode check, feel free to add my tested by.

--
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-01-31 10:18       ` Sudeep Holla
@ 2023-02-02 17:36         ` Maxim Kiselev
  -1 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-02-02 17:36 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Saravana Kannan, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

Hi Saravana,

> Can you try the patch at the end of this email under these
> configurations and tell me which ones fail vs pass? I don't need logs

I did these tests and here is the results:

1. On top of this series - Not works
2. Without this series    - Works
3. On top of the series with the fwnode_dev_initialized() deleted - Not works
4. Without this series, with the fwnode_dev_initialized() deleted  - Works

So your nvmem/core.c patch helps only when it is applied without the series.
But despite the fact that this helps to avoid getting stuck at probing
my ethernet device, there is still regression.

When the ethernet module is loaded it takes a lot of time to drop dependency
from the nvmem-cell with mac address.

Please look at the kernel logs below.

The first log corresponds to kernel with your nvmem/core.c patch:

    [    0.036462] ethernet@70000 Linked as a fwnode consumer to
clock-gating-control@1821c
    [    0.036572] ethernet@70000 Linked as a fwnode consumer to partition@1
    [    0.045596] device: 'f1070000.ethernet': device_add
    [    0.045854] ethernet@70000 Dropping the fwnode link to
clock-gating-control@1821c
    [    0.114990] device:
'platform:f1010600.spi:m25p80@0:partitions:partition@1--platform:f1070000.ethernet':
device_add
    [    0.115266] devices_kset: Moving f1070000.ethernet to end of list
    [    0.115308] platform f1070000.ethernet: Linked as a consumer to
f1010600.spi:m25p80@0:partitions:partition@1
    [    0.115345] ethernet@70000 Dropping the fwnode link to partition@1
    [    1.968232] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.088696] devices_kset: Moving f1070000.ethernet to end of list
    [    2.088988] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.152411] devices_kset: Moving f1070000.ethernet to end of list
    [    2.152735] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.153870] devices_kset: Moving f1070000.ethernet to end of list
    [    2.154152] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.644950] devices_kset: Moving f1070000.ethernet to end of list
    [    2.645282] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.169218] devices_kset: Moving f1070000.ethernet to end of list
    [    3.169506] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.170444] devices_kset: Moving f1070000.ethernet to end of list
    [    3.170721] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.419068] devices_kset: Moving f1070000.ethernet to end of list
    [    3.419359] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.521275] devices_kset: Moving f1070000.ethernet to end of list
    [    3.521564] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.639196] devices_kset: Moving f1070000.ethernet to end of list
    [    3.639532] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [   13.960144] platform f1070000.ethernet: Relaxing link with
f1010600.spi:m25p80@0:partitions:partition@1
    [   13.960260] devices_kset: Moving f1070000.ethernet to end of list
    [   13.971735] device: 'eth0': device_add
    [   13.974140] mvneta f1070000.ethernet eth0: Using device tree
mac address de:fa:ce:db:ab:e1
    [   13.974275] mvneta f1070000.ethernet: Dropping the link to
f1010600.spi:m25p80@0:partitions:partition@1
    [   13.974318] device:
'platform:f1010600.spi:m25p80@0:partitions:partition@1--platform:f1070000.ethernet':
device_unregister

It took around 13 seconds to obtain a mac from nvmem-cell and bring up
f1070000.ethernet


And here is the second log which corresponds to kernel without your
nvmem/core.c patch but also with reverted change 'bcdf0315':

    [    0.036285] ethernet@70000 Linked as a fwnode consumer to
clock-gating-control@1821c
    [    0.036395] ethernet@70000 Linked as a fwnode consumer to partition@1
    [    0.045416] device: 'f1070000.ethernet': device_add
    [    0.045674] ethernet@70000 Dropping the fwnode link to
clock-gating-control@1821c
    [    0.116136] ethernet@70000 Dropping the fwnode link to partition@1
    [    1.977060] device: 'eth0': device_add
    [    1.979145] mvneta f1070000.ethernet eth0: Using device tree
mac address de:fa:ce:db:ab:e1

It took around 1.5 second to obtain a mac from nvmem-cell

P.S. Your nvmem patch definitely helps to avoid a device probe stuck
but look like it is not best way to solve a problem which we discussed
in the MTD thread.

P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
applied on top of this series. Maybe I missed something.

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-02 17:36         ` Maxim Kiselev
  0 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-02-02 17:36 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Saravana Kannan, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

Hi Saravana,

> Can you try the patch at the end of this email under these
> configurations and tell me which ones fail vs pass? I don't need logs

I did these tests and here is the results:

1. On top of this series - Not works
2. Without this series    - Works
3. On top of the series with the fwnode_dev_initialized() deleted - Not works
4. Without this series, with the fwnode_dev_initialized() deleted  - Works

So your nvmem/core.c patch helps only when it is applied without the series.
But despite the fact that this helps to avoid getting stuck at probing
my ethernet device, there is still regression.

When the ethernet module is loaded it takes a lot of time to drop dependency
from the nvmem-cell with mac address.

Please look at the kernel logs below.

The first log corresponds to kernel with your nvmem/core.c patch:

    [    0.036462] ethernet@70000 Linked as a fwnode consumer to
clock-gating-control@1821c
    [    0.036572] ethernet@70000 Linked as a fwnode consumer to partition@1
    [    0.045596] device: 'f1070000.ethernet': device_add
    [    0.045854] ethernet@70000 Dropping the fwnode link to
clock-gating-control@1821c
    [    0.114990] device:
'platform:f1010600.spi:m25p80@0:partitions:partition@1--platform:f1070000.ethernet':
device_add
    [    0.115266] devices_kset: Moving f1070000.ethernet to end of list
    [    0.115308] platform f1070000.ethernet: Linked as a consumer to
f1010600.spi:m25p80@0:partitions:partition@1
    [    0.115345] ethernet@70000 Dropping the fwnode link to partition@1
    [    1.968232] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.088696] devices_kset: Moving f1070000.ethernet to end of list
    [    2.088988] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.152411] devices_kset: Moving f1070000.ethernet to end of list
    [    2.152735] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.153870] devices_kset: Moving f1070000.ethernet to end of list
    [    2.154152] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    2.644950] devices_kset: Moving f1070000.ethernet to end of list
    [    2.645282] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.169218] devices_kset: Moving f1070000.ethernet to end of list
    [    3.169506] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.170444] devices_kset: Moving f1070000.ethernet to end of list
    [    3.170721] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.419068] devices_kset: Moving f1070000.ethernet to end of list
    [    3.419359] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.521275] devices_kset: Moving f1070000.ethernet to end of list
    [    3.521564] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [    3.639196] devices_kset: Moving f1070000.ethernet to end of list
    [    3.639532] platform f1070000.ethernet: error -EPROBE_DEFER:
supplier f1010600.spi:m25p80@0:partitions:partition@1 not ready
    [   13.960144] platform f1070000.ethernet: Relaxing link with
f1010600.spi:m25p80@0:partitions:partition@1
    [   13.960260] devices_kset: Moving f1070000.ethernet to end of list
    [   13.971735] device: 'eth0': device_add
    [   13.974140] mvneta f1070000.ethernet eth0: Using device tree
mac address de:fa:ce:db:ab:e1
    [   13.974275] mvneta f1070000.ethernet: Dropping the link to
f1010600.spi:m25p80@0:partitions:partition@1
    [   13.974318] device:
'platform:f1010600.spi:m25p80@0:partitions:partition@1--platform:f1070000.ethernet':
device_unregister

It took around 13 seconds to obtain a mac from nvmem-cell and bring up
f1070000.ethernet


And here is the second log which corresponds to kernel without your
nvmem/core.c patch but also with reverted change 'bcdf0315':

    [    0.036285] ethernet@70000 Linked as a fwnode consumer to
clock-gating-control@1821c
    [    0.036395] ethernet@70000 Linked as a fwnode consumer to partition@1
    [    0.045416] device: 'f1070000.ethernet': device_add
    [    0.045674] ethernet@70000 Dropping the fwnode link to
clock-gating-control@1821c
    [    0.116136] ethernet@70000 Dropping the fwnode link to partition@1
    [    1.977060] device: 'eth0': device_add
    [    1.979145] mvneta f1070000.ethernet eth0: Using device tree
mac address de:fa:ce:db:ab:e1

It took around 1.5 second to obtain a mac from nvmem-cell

P.S. Your nvmem patch definitely helps to avoid a device probe stuck
but look like it is not best way to solve a problem which we discussed
in the MTD thread.

P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
applied on top of this series. Maybe I missed something.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-02 17:36         ` Maxim Kiselev
@ 2023-02-03  6:07           ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-03  6:07 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> Hi Saravana,
>
> > Can you try the patch at the end of this email under these
> > configurations and tell me which ones fail vs pass? I don't need logs
>
> I did these tests and here is the results:

Did you hand edit the In-Reply-To: in the header? Because in the
thread you are reply to the wrong email, but the context in your email
seems to be from the right email.

For example, see how your reply isn't under the email you are replying
to in this thread overview:
https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r

> 1. On top of this series - Not works
> 2. Without this series    - Works
> 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
>
> So your nvmem/core.c patch helps only when it is applied without the series.
> But despite the fact that this helps to avoid getting stuck at probing
> my ethernet device, there is still regression.
>
> When the ethernet module is loaded it takes a lot of time to drop dependency
> from the nvmem-cell with mac address.
>
> Please look at the kernel logs below.

The kernel logs below really aren't that useful for me in their
current state. See more below.

---8<---- <snip> --->8----

> P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> but look like it is not best way to solve a problem which we discussed
> in the MTD thread.
>
> P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> applied on top of this series. Maybe I missed something.

Yeah, I'm not too sure if the test was done correctly. You also didn't
answer my question about the dts from my earlier email.
https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t

So, can you please retest config 1 with all pr_debug and dev_dbg in
drivers/core/base.c changed to the _info variants? And then share the
kernel log from the beginning of boot? Maybe attach it to the email so
it doesn't get word wrapped by your email client. And please point me
to the .dts that corresponds to your board. Without that, I can't
debug much.

Thanks,
Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-03  6:07           ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-03  6:07 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> Hi Saravana,
>
> > Can you try the patch at the end of this email under these
> > configurations and tell me which ones fail vs pass? I don't need logs
>
> I did these tests and here is the results:

Did you hand edit the In-Reply-To: in the header? Because in the
thread you are reply to the wrong email, but the context in your email
seems to be from the right email.

For example, see how your reply isn't under the email you are replying
to in this thread overview:
https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r

> 1. On top of this series - Not works
> 2. Without this series    - Works
> 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
>
> So your nvmem/core.c patch helps only when it is applied without the series.
> But despite the fact that this helps to avoid getting stuck at probing
> my ethernet device, there is still regression.
>
> When the ethernet module is loaded it takes a lot of time to drop dependency
> from the nvmem-cell with mac address.
>
> Please look at the kernel logs below.

The kernel logs below really aren't that useful for me in their
current state. See more below.

---8<---- <snip> --->8----

> P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> but look like it is not best way to solve a problem which we discussed
> in the MTD thread.
>
> P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> applied on top of this series. Maybe I missed something.

Yeah, I'm not too sure if the test was done correctly. You also didn't
answer my question about the dts from my earlier email.
https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t

So, can you please retest config 1 with all pr_debug and dev_dbg in
drivers/core/base.c changed to the _info variants? And then share the
kernel log from the beginning of boot? Maybe attach it to the email so
it doesn't get word wrapped by your email client. And please point me
to the .dts that corresponds to your board. Without that, I can't
debug much.

Thanks,
Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-03  6:07           ` Saravana Kannan
@ 2023-02-03  9:39             ` Maxim Kiselev
  -1 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-02-03  9:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

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

пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
>
> On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > Hi Saravana,
> >
> > > Can you try the patch at the end of this email under these
> > > configurations and tell me which ones fail vs pass? I don't need logs
> >
> > I did these tests and here is the results:
>
> Did you hand edit the In-Reply-To: in the header? Because in the
> thread you are reply to the wrong email, but the context in your email
> seems to be from the right email.
>
> For example, see how your reply isn't under the email you are replying
> to in this thread overview:
> https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
>
> > 1. On top of this series - Not works
> > 2. Without this series    - Works
> > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> >
> > So your nvmem/core.c patch helps only when it is applied without the series.
> > But despite the fact that this helps to avoid getting stuck at probing
> > my ethernet device, there is still regression.
> >
> > When the ethernet module is loaded it takes a lot of time to drop dependency
> > from the nvmem-cell with mac address.
> >
> > Please look at the kernel logs below.
>
> The kernel logs below really aren't that useful for me in their
> current state. See more below.
>
> ---8<---- <snip> --->8----
>
> > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > but look like it is not best way to solve a problem which we discussed
> > in the MTD thread.
> >
> > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > applied on top of this series. Maybe I missed something.
>
> Yeah, I'm not too sure if the test was done correctly. You also didn't
> answer my question about the dts from my earlier email.
> https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
>
> So, can you please retest config 1 with all pr_debug and dev_dbg in
> drivers/core/base.c changed to the _info variants? And then share the
> kernel log from the beginning of boot? Maybe attach it to the email so
> it doesn't get word wrapped by your email client. And please point me
> to the .dts that corresponds to your board. Without that, I can't
> debug much.
>
> Thanks,
> Saravana

> Did you hand edit the In-Reply-To: in the header? Because in the
> thread you are reply to the wrong email, but the context in your email
> seems to be from the right email.

Sorry for that, it seems like I accidently deleted it.

> So, can you please retest config 1 with all pr_debug and dev_dbg in
> drivers/core/base.c changed to the _info variants? And then share the
> kernel log from the beginning of boot? Maybe attach it to the email so
> it doesn't get word wrapped by your email client. And please point me
> to the .dts that corresponds to your board. Without that, I can't
> debug much.

Ok, I retested config 1 with all _debug logs changed to the _info. I
added the kernel log and the dts file to the attachment of this email.

[-- Attachment #2: test_kern.log --]
[-- Type: text/x-log, Size: 22393 bytes --]

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.1.0.2 (user@pc) (arm-pulsar-linux-gnueabi-gcc.br_real (Buildroot pulsar-os-2.11-108-g17a8ad05a4-dirty) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #2 Fri Feb  3 11:58:19 MSK 2023
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model:
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/ubiblock0_0 ubi.mtd=5 ubi.block=0,0 ubi.block=0,2 ubi.block=0,3
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 124416K/131072K available (3392K kernel code, 507K rwdata, 1068K rodata, 144K init, 188K bss, 6656K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] found marvell,kirkwood-gating-clock
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000003] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000074] Switching to timer-based delay loop, resolution 5ns
[    0.000268] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000318] pid_max: default: 4096 minimum: 301
[    0.000859] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000913] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001979] CPU: Testing write buffer coherency: ok
[    0.004344] Setting up static identity map for 0x8200 - 0x823c
[    0.005992] devtmpfs: initialized
[    0.010680] device: 'platform': device_add
[    0.010946] device: 'cpu': device_add
[    0.011154] device: 'container': device_add
[    0.012357] device: 'workqueue': device_add
[    0.012470] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.012526] futex hash table entries: 16 (order: -5, 192 bytes, linear)
[    0.012597] pinctrl core: initialized pinctrl subsystem
[    0.012877] device: 'reg-dummy': device_add
[    0.013135] device: 'regulator.0': device_add
[    0.015869] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.016730] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.019403] device: 'kirkwood-cpufreq': device_add
[    0.019570] device: 'kirkwood_cpuidle': device_add
[    0.019841] device: 'mbus@f1000000': device_add
[    0.020244] bm-bppi Linked as a fwnode consumer to clock-gating-control@1821c
[    0.020347] platform mbus@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.020548] device: 'f5000000.bm-bppi': device_add
[    0.020771] platform f5000000.bm-bppi: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.020827] bm-bppi Dropping the fwnode link to clock-gating-control@1821c
[    0.021424] device: 'ocp@f1000000': device_add
[    0.022042] spi@10600 Linked as a fwnode consumer to pmx-spi0
[    0.022129] spi@10600 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.022193] spi@10600 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.022815] gpio@18100 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.022927] gpio@18100 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023094] gpio@18124 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023145] gpio@18124 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023256] serial@12000 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023309] serial@12000 Linked as a fwnode consumer to pmx-uart0
[    0.023359] serial@12000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023567] bridge-interrupt-ctrl@20110 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023673] clock-gating-control@1821c Linked as a fwnode consumer to core-clocks@18230
[    0.023832] timer@20300 Linked as a fwnode consumer to bridge-interrupt-ctrl@20110
[    0.023918] timer@20300 Linked as a fwnode consumer to core-clocks@18230
[    0.023993] watchdog-timer@20300 Linked as a fwnode consumer to bridge-interrupt-ctrl@20110
[    0.024066] watchdog-timer@20300 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024179] ethernet@70000 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.024227] ethernet@70000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024328] ethernet@70000 Linked as a fwnode consumer to mac@6
[    0.024481] mdio-eth@72004 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.024528] mdio-eth@72004 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024647] bm@c0000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024801] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.024859] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.024948] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.024998] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025051] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025098] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025154] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025204] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025264] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025316] platform ocp@f1000000: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.025370] platform ocp@f1000000: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.025416] platform ocp@f1000000: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.025468] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025516] platform ocp@f1000000: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.025574] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025622] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025675] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025723] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025780] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025965] device: 'f1018000.pin-controller': device_add
[    0.026385] device: 'f1010600.spi': device_add
[    0.026644] platform f1010600.spi: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.026701] spi@10600 Dropping the fwnode link to clock-gating-control@1821c
[    0.026740] platform f1010600.spi: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.026787] spi@10600 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.026992] device: 'f1018100.gpio': device_add
[    0.027255] platform f1018100.gpio: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.027310] gpio@18100 Dropping the fwnode link to clock-gating-control@1821c
[    0.027350] platform f1018100.gpio: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.027395] gpio@18100 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.027574] device: 'f1018124.gpio': device_add
[    0.027807] platform f1018124.gpio: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.027862] gpio@18124 Dropping the fwnode link to clock-gating-control@1821c
[    0.027900] platform f1018124.gpio: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.027945] gpio@18124 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.028119] device: 'f1012000.serial': device_add
[    0.028343] platform f1012000.serial: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.028397] serial@12000 Dropping the fwnode link to clock-gating-control@1821c
[    0.028442] platform f1012000.serial: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.028489] serial@12000 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.028686] device: 'f1020000.mbus-controller': device_add
[    0.029048] device: 'f1020000.system-controller': device_add
[    0.029427] device: 'f101821c.clock-gating-control': device_add
[    0.029666] platform f101821c.clock-gating-control: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.029722] clock-gating-control@1821c Dropping the fwnode link to core-clocks@18230
[    0.029896] device: 'f1020300.timer': device_add
[    0.030170] platform f1020300.timer: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.030226] timer@20300 Dropping the fwnode link to core-clocks@18230
[    0.030268] platform f1020300.timer: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.030315] timer@20300 Dropping the fwnode link to bridge-interrupt-ctrl@20110
[    0.030509] device: 'f1020300.watchdog-timer': device_add
[    0.030740] platform f1020300.watchdog-timer: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.030796] watchdog-timer@20300 Dropping the fwnode link to clock-gating-control@1821c
[    0.030839] platform f1020300.watchdog-timer: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.030886] watchdog-timer@20300 Dropping the fwnode link to bridge-interrupt-ctrl@20110
[    0.031052] device: 'f1070000.ethernet': device_add
[    0.031290] platform f1070000.ethernet: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.031348] ethernet@70000 Dropping the fwnode link to clock-gating-control@1821c
[    0.031386] platform f1070000.ethernet: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.031432] ethernet@70000 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.031619] device: 'f1072004.mdio-eth': device_add
[    0.031847] platform f1072004.mdio-eth: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.031905] mdio-eth@72004 Dropping the fwnode link to clock-gating-control@1821c
[    0.031944] platform f1072004.mdio-eth: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.031990] mdio-eth@72004 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.032168] device: 'f10c0000.bm': device_add
[    0.032409] platform f10c0000.bm: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.032465] bm@c0000 Dropping the fwnode link to clock-gating-control@1821c
[    0.033203] device: 'cpu0': device_add
[    0.038794] device: 'writeback': device_add
[    0.040255] pps_core: LinuxPPS API ver. 1 registered
[    0.040279] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.040369] PTP clock support registered
[    0.040796] device: 'lo': device_add
[    0.043779] clocksource: Switched to clocksource orion_clocksource
[    0.044355] device: 'mem': device_add
[    0.044643] device: 'null': device_add
[    0.044899] device: 'zero': device_add
[    0.045175] device: 'full': device_add
[    0.045450] device: 'random': device_add
[    0.045703] device: 'urandom': device_add
[    0.045957] device: 'kmsg': device_add
[    0.046247] device: 'tty': device_add
[    0.046559] device: 'console': device_add
[    0.047126] NET: Registered PF_INET protocol family
[    0.047684] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.049576] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.049680] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.049739] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.049804] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.049873] TCP: Hash tables configured (established 1024 bind 1024)
[    0.050042] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.050167] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.050558] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.051184] device: 'clocksource': device_add
[    0.051259] device: 'clocksource0': device_add
[    0.051738] device: 'clockevents': device_add
[    0.051827] device: 'clockevent0': device_add
[    0.052711] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.064176] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.064764] io scheduler mq-deadline registered
[    0.064793] io scheduler kyber registered
[    0.065672] bridge-interrupt-ctrl@20110 Linked as a fwnode consumer to ocp@f1000000
[    0.065711] bridge-interrupt-ctrl@20110 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.067357] kirkwood-pinctrl f1018000.pin-controller: registered pinctrl driver
[    0.067403] spi@10600 Linked as a fwnode consumer to pin-controller@18000
[    0.067432] spi@10600 Dropping the fwnode link to pmx-spi0
[    0.067467] serial@12000 Linked as a fwnode consumer to pin-controller@18000
[    0.067492] serial@12000 Dropping the fwnode link to pmx-uart0
[    0.067559] device: 'platform:f1018000.pin-controller--platform:f1012000.serial': device_add
[    0.067807] devices_kset: Moving f1012000.serial to end of list
[    0.067838] platform f1012000.serial: Linked as a consumer to f1018000.pin-controller
[    0.067865] serial@12000 Dropping the fwnode link to pin-controller@18000
[    0.067926] device: 'platform:f1018000.pin-controller--platform:f1010600.spi': device_add
[    0.068143] devices_kset: Moving f1010600.spi to end of list
[    0.068172] platform f1010600.spi: Linked as a consumer to f1018000.pin-controller
[    0.068198] spi@10600 Dropping the fwnode link to pin-controller@18000
[    0.069474] mvebu-gpio f1018100.gpio: high_offset 0
[    0.069751] device: 'gpiochip0': device_add
[    0.070133] device: 'gpiochip0': device_add
[    0.070939] mvebu-gpio f1018124.gpio: high_offset 4
[    0.071184] device: 'gpiochip1': device_add
[    0.071543] device: 'gpiochip32': device_add
[    0.072642] device: 'ptmx': device_add
[    0.072922] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.072995] device: 'serial8250': device_add
[    0.073188] device: 'ttyS0': device_add
[    0.074598] device: 'ttyS0': device_unregister
[    0.074998] printk: console [ttyS0] disabled
[    0.075269] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 23, base_baud = 12500000) is a 16550A
[    0.076037] printk: console [ttyS0] enabled
[    0.076094] device: 'ttyS0': device_add
[    0.077147] device: 'mtd-0': device_add
[    0.079455] device: 'spi0': device_add
[    0.080225] device: 'spi0.0': device_add
[    0.081066] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
[    0.082538] 7 fixed-partitions partitions found on MTD device spi0.0
[    0.082729] device: 'f1010600.spi:m25p80@0:partitions:partition@1': device_add
[    0.083120] Creating 7 MTD partitions on "spi0.0":
[    0.083165] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
[    0.083228] device: 'mtd0': device_add
[    0.083744] device: 'mtd0': device_add
[    0.083988] device: 'mtd0ro': device_add
[    0.084323] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
[    0.084395] device: 'mtd1': device_add
[    0.084880] device: 'mtd1': device_add
[    0.085172] device: 'mtd1ro': device_add
[    0.085504] 0x0000000c0000-0x000000100000 : "SPI.U_BOOT_ENV"
[    0.085577] device: 'mtd2': device_add
[    0.086064] device: 'mtd2': device_add
[    0.086244] device: 'mtd2ro': device_add
[    0.086578] 0x000000100000-0x000000400000 : "SPI.KERNEL0"
[    0.086650] device: 'mtd3': device_add
[    0.087154] device: 'mtd3': device_add
[    0.087333] device: 'mtd3ro': device_add
[    0.087690] 0x000000400000-0x000000700000 : "SPI.KERNEL1"
[    0.087762] device: 'mtd4': device_add
[    0.088246] device: 'mtd4': device_add
[    0.088429] device: 'mtd4ro': device_add
[    0.088748] 0x000000700000-0x000002f00000 : "SPI.UBI"
[    0.088821] device: 'mtd5': device_add
[    0.089328] device: 'mtd5': device_add
[    0.089511] device: 'mtd5ro': device_add
[    0.089833] 0x000002f00000-0x000004000000 : "SPI.RECOVERY"
[    0.089904] device: 'mtd6': device_add
[    0.090397] device: 'mtd6': device_add
[    0.090603] device: 'mtd6ro': device_add
[    0.092809] device: 'watchdog': device_add
[    0.093116] device: 'watchdog0': device_add
[    0.093505] orion_wdt: Initial timeout 21 sec, nowayout
[    0.101001] device: 'ubi_ctrl': device_add
[    0.101353] ubi0: default fastmap pool size: 30
[    0.101397] ubi0: default fastmap WL pool size: 15
[    0.101427] ubi0: attaching mtd5
[    0.152726] ubi0: scanning is finished
[    0.177839] device: 'ubi0': device_add
[    0.178249] device: 'ubi0_0': device_add
[    0.178643] device: 'ubi0_1': device_add
[    0.178996] device: 'ubi0_2': device_add
[    0.179344] device: 'ubi0_3': device_add
[    0.179719] device: 'ubi0_4': device_add
[    0.180267] ubi0: attached mtd5 (name "SPI.UBI", size 40 MiB)
[    0.180320] ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
[    0.180362] ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
[    0.180396] ubi0: VID header offset: 64 (aligned 64), data offset: 128
[    0.180430] ubi0: good PEBs: 640, bad PEBs: 0, corrupted PEBs: 0
[    0.180462] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
[    0.180497] ubi0: max/mean erase counter: 63/37, WL threshold: 4096, image sequence number: 2009032911
[    0.180539] ubi0: available PEBs: 101, total reserved PEBs: 539, PEBs reserved for bad PEB handling: 0
[    0.180609] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.181788] device: 'ubiblock0_0': device_add
[    0.182697] device: '254:0': device_add
[    0.182937] block ubiblock0_0: created from ubi0:0(rootfs0)
[    0.182996] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.183984] device: 'ubiblock0_2': device_add
[    0.184341] ubi0: background thread "ubi_bgt0d" started, PID 31
[    0.184945] device: '254:1': device_add
[    0.185190] block ubiblock0_2: created from ubi0:2(bank0)
[    0.185246] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.186189] device: 'ubiblock0_3': device_add
[    0.187117] device: '254:2': device_add
[    0.187356] block ubiblock0_3: created from ubi0:3(bank1)
[    0.196106] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    0.203869] devtmpfs: mounted
[    0.204846] Freeing unused kernel image (initmem) memory: 144K
[    0.204887] Kernel memory protection not selected by kernel config.
[    0.204952] Run /sbin/init as init process
[    0.204973]   with arguments:
[    0.204987]     /sbin/init
[    0.205002]   with environment:
[    0.205016]     HOME=/
[    0.205030]     TERM=linux
[    0.205045]     fastboot=n
[    0.205060]     VersionBoot=3.3
[    0.205076]     VersionOS=2.11.108
[    0.205091]     BootBank=1
[    0.205106]     VersionOS_r=2.11.108
[    0.205122]     BankState_r=1
[    0.205137]     ip=192.168.0.1:192.168.0.100::255.255.255.0:::
[    1.812865] mvneta_bm f10c0000.bm: Buffer Manager for network controller enabled
[    1.866851] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[    1.887001] device: 'Fixed MDIO bus.0': device_add
[    1.887212] device: 'fixed-0': device_add
[    1.897053] device: 'f1072004.mdio-eth-mii': device_add
[    1.960305] device: 'f1072004.mdio-eth-mii:00': device_add
[    1.963213] devices_kset: Moving f1070000.ethernet to end of list
[    1.963486] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[    2.620488] NET: Registered PF_INET6 protocol family
[    2.623382] Segment Routing with IPv6
[    2.623606] In-situ OAM (IOAM) with IPv6
[    3.133929] sctp: Hash tables configured (bind 1024/1024)
[    4.618112] device: 'ubifs_0_4': device_add
[    4.620416] UBIFS (ubi0:4): Mounting in unauthenticated mode
[    4.649339] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 83
[    4.767446] UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "service"
[    4.767502] UBIFS (ubi0:4): LEB size: 65408 bytes (63 KiB), min./max. I/O unit sizes: 8 bytes/256 bytes
[    4.767550] UBIFS (ubi0:4): FS size: 4643968 bytes (4 MiB, 71 LEBs), max 81 LEBs, journal size 523265 bytes (0 MiB, 6 LEBs)
[    4.767603] UBIFS (ubi0:4): reserved for root: 219345 bytes (214 KiB)
[    4.767637] UBIFS (ubi0:4): media format: w5/r0 (latest is w5/r0), UUID 4562C74F-EBB7-4D2D-AE6B-41615575F12C, small LPT model
[   13.931242] devices_kset: Moving f1070000.ethernet to end of list
[   13.931516] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[   13.931890] platform f1070000.ethernet: deferred probe pending

[-- Attachment #3: test.dts --]
[-- Type: audio/vnd.dts, Size: 7897 bytes --]

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-03  9:39             ` Maxim Kiselev
  0 siblings, 0 replies; 146+ messages in thread
From: Maxim Kiselev @ 2023-02-03  9:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

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

пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
>
> On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > Hi Saravana,
> >
> > > Can you try the patch at the end of this email under these
> > > configurations and tell me which ones fail vs pass? I don't need logs
> >
> > I did these tests and here is the results:
>
> Did you hand edit the In-Reply-To: in the header? Because in the
> thread you are reply to the wrong email, but the context in your email
> seems to be from the right email.
>
> For example, see how your reply isn't under the email you are replying
> to in this thread overview:
> https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
>
> > 1. On top of this series - Not works
> > 2. Without this series    - Works
> > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> >
> > So your nvmem/core.c patch helps only when it is applied without the series.
> > But despite the fact that this helps to avoid getting stuck at probing
> > my ethernet device, there is still regression.
> >
> > When the ethernet module is loaded it takes a lot of time to drop dependency
> > from the nvmem-cell with mac address.
> >
> > Please look at the kernel logs below.
>
> The kernel logs below really aren't that useful for me in their
> current state. See more below.
>
> ---8<---- <snip> --->8----
>
> > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > but look like it is not best way to solve a problem which we discussed
> > in the MTD thread.
> >
> > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > applied on top of this series. Maybe I missed something.
>
> Yeah, I'm not too sure if the test was done correctly. You also didn't
> answer my question about the dts from my earlier email.
> https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
>
> So, can you please retest config 1 with all pr_debug and dev_dbg in
> drivers/core/base.c changed to the _info variants? And then share the
> kernel log from the beginning of boot? Maybe attach it to the email so
> it doesn't get word wrapped by your email client. And please point me
> to the .dts that corresponds to your board. Without that, I can't
> debug much.
>
> Thanks,
> Saravana

> Did you hand edit the In-Reply-To: in the header? Because in the
> thread you are reply to the wrong email, but the context in your email
> seems to be from the right email.

Sorry for that, it seems like I accidently deleted it.

> So, can you please retest config 1 with all pr_debug and dev_dbg in
> drivers/core/base.c changed to the _info variants? And then share the
> kernel log from the beginning of boot? Maybe attach it to the email so
> it doesn't get word wrapped by your email client. And please point me
> to the .dts that corresponds to your board. Without that, I can't
> debug much.

Ok, I retested config 1 with all _debug logs changed to the _info. I
added the kernel log and the dts file to the attachment of this email.

[-- Attachment #2: test_kern.log --]
[-- Type: text/x-log, Size: 22393 bytes --]

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.1.0.2 (user@pc) (arm-pulsar-linux-gnueabi-gcc.br_real (Buildroot pulsar-os-2.11-108-g17a8ad05a4-dirty) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #2 Fri Feb  3 11:58:19 MSK 2023
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model:
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/ubiblock0_0 ubi.mtd=5 ubi.block=0,0 ubi.block=0,2 ubi.block=0,3
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 124416K/131072K available (3392K kernel code, 507K rwdata, 1068K rodata, 144K init, 188K bss, 6656K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] found marvell,kirkwood-gating-clock
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000003] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000074] Switching to timer-based delay loop, resolution 5ns
[    0.000268] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000318] pid_max: default: 4096 minimum: 301
[    0.000859] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000913] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001979] CPU: Testing write buffer coherency: ok
[    0.004344] Setting up static identity map for 0x8200 - 0x823c
[    0.005992] devtmpfs: initialized
[    0.010680] device: 'platform': device_add
[    0.010946] device: 'cpu': device_add
[    0.011154] device: 'container': device_add
[    0.012357] device: 'workqueue': device_add
[    0.012470] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.012526] futex hash table entries: 16 (order: -5, 192 bytes, linear)
[    0.012597] pinctrl core: initialized pinctrl subsystem
[    0.012877] device: 'reg-dummy': device_add
[    0.013135] device: 'regulator.0': device_add
[    0.015869] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.016730] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.019403] device: 'kirkwood-cpufreq': device_add
[    0.019570] device: 'kirkwood_cpuidle': device_add
[    0.019841] device: 'mbus@f1000000': device_add
[    0.020244] bm-bppi Linked as a fwnode consumer to clock-gating-control@1821c
[    0.020347] platform mbus@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.020548] device: 'f5000000.bm-bppi': device_add
[    0.020771] platform f5000000.bm-bppi: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.020827] bm-bppi Dropping the fwnode link to clock-gating-control@1821c
[    0.021424] device: 'ocp@f1000000': device_add
[    0.022042] spi@10600 Linked as a fwnode consumer to pmx-spi0
[    0.022129] spi@10600 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.022193] spi@10600 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.022815] gpio@18100 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.022927] gpio@18100 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023094] gpio@18124 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023145] gpio@18124 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023256] serial@12000 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023309] serial@12000 Linked as a fwnode consumer to pmx-uart0
[    0.023359] serial@12000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.023567] bridge-interrupt-ctrl@20110 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.023673] clock-gating-control@1821c Linked as a fwnode consumer to core-clocks@18230
[    0.023832] timer@20300 Linked as a fwnode consumer to bridge-interrupt-ctrl@20110
[    0.023918] timer@20300 Linked as a fwnode consumer to core-clocks@18230
[    0.023993] watchdog-timer@20300 Linked as a fwnode consumer to bridge-interrupt-ctrl@20110
[    0.024066] watchdog-timer@20300 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024179] ethernet@70000 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.024227] ethernet@70000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024328] ethernet@70000 Linked as a fwnode consumer to mac@6
[    0.024481] mdio-eth@72004 Linked as a fwnode consumer to main-interrupt-ctrl@20200
[    0.024528] mdio-eth@72004 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024647] bm@c0000 Linked as a fwnode consumer to clock-gating-control@1821c
[    0.024801] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.024859] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.024948] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.024998] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025051] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025098] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025154] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025204] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025264] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025316] platform ocp@f1000000: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.025370] platform ocp@f1000000: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.025416] platform ocp@f1000000: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.025468] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025516] platform ocp@f1000000: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.025574] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025622] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025675] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025723] platform ocp@f1000000: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.025780] platform ocp@f1000000: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.025965] device: 'f1018000.pin-controller': device_add
[    0.026385] device: 'f1010600.spi': device_add
[    0.026644] platform f1010600.spi: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.026701] spi@10600 Dropping the fwnode link to clock-gating-control@1821c
[    0.026740] platform f1010600.spi: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.026787] spi@10600 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.026992] device: 'f1018100.gpio': device_add
[    0.027255] platform f1018100.gpio: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.027310] gpio@18100 Dropping the fwnode link to clock-gating-control@1821c
[    0.027350] platform f1018100.gpio: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.027395] gpio@18100 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.027574] device: 'f1018124.gpio': device_add
[    0.027807] platform f1018124.gpio: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.027862] gpio@18124 Dropping the fwnode link to clock-gating-control@1821c
[    0.027900] platform f1018124.gpio: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.027945] gpio@18124 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.028119] device: 'f1012000.serial': device_add
[    0.028343] platform f1012000.serial: Not linking /ocp@f1000000/clock-gating-control@1821c - might never become dev
[    0.028397] serial@12000 Dropping the fwnode link to clock-gating-control@1821c
[    0.028442] platform f1012000.serial: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.028489] serial@12000 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.028686] device: 'f1020000.mbus-controller': device_add
[    0.029048] device: 'f1020000.system-controller': device_add
[    0.029427] device: 'f101821c.clock-gating-control': device_add
[    0.029666] platform f101821c.clock-gating-control: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.029722] clock-gating-control@1821c Dropping the fwnode link to core-clocks@18230
[    0.029896] device: 'f1020300.timer': device_add
[    0.030170] platform f1020300.timer: Not linking /ocp@f1000000/core-clocks@18230 - might never become dev
[    0.030226] timer@20300 Dropping the fwnode link to core-clocks@18230
[    0.030268] platform f1020300.timer: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.030315] timer@20300 Dropping the fwnode link to bridge-interrupt-ctrl@20110
[    0.030509] device: 'f1020300.watchdog-timer': device_add
[    0.030740] platform f1020300.watchdog-timer: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.030796] watchdog-timer@20300 Dropping the fwnode link to clock-gating-control@1821c
[    0.030839] platform f1020300.watchdog-timer: Not linking /ocp@f1000000/bridge-interrupt-ctrl@20110 - might never become dev
[    0.030886] watchdog-timer@20300 Dropping the fwnode link to bridge-interrupt-ctrl@20110
[    0.031052] device: 'f1070000.ethernet': device_add
[    0.031290] platform f1070000.ethernet: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.031348] ethernet@70000 Dropping the fwnode link to clock-gating-control@1821c
[    0.031386] platform f1070000.ethernet: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.031432] ethernet@70000 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.031619] device: 'f1072004.mdio-eth': device_add
[    0.031847] platform f1072004.mdio-eth: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.031905] mdio-eth@72004 Dropping the fwnode link to clock-gating-control@1821c
[    0.031944] platform f1072004.mdio-eth: Not linking /ocp@f1000000/main-interrupt-ctrl@20200 - might never become dev
[    0.031990] mdio-eth@72004 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.032168] device: 'f10c0000.bm': device_add
[    0.032409] platform f10c0000.bm: Not linking /ocp@f1000000/clock-gating-control@1821c - dev might never probe
[    0.032465] bm@c0000 Dropping the fwnode link to clock-gating-control@1821c
[    0.033203] device: 'cpu0': device_add
[    0.038794] device: 'writeback': device_add
[    0.040255] pps_core: LinuxPPS API ver. 1 registered
[    0.040279] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.040369] PTP clock support registered
[    0.040796] device: 'lo': device_add
[    0.043779] clocksource: Switched to clocksource orion_clocksource
[    0.044355] device: 'mem': device_add
[    0.044643] device: 'null': device_add
[    0.044899] device: 'zero': device_add
[    0.045175] device: 'full': device_add
[    0.045450] device: 'random': device_add
[    0.045703] device: 'urandom': device_add
[    0.045957] device: 'kmsg': device_add
[    0.046247] device: 'tty': device_add
[    0.046559] device: 'console': device_add
[    0.047126] NET: Registered PF_INET protocol family
[    0.047684] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.049576] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.049680] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.049739] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.049804] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.049873] TCP: Hash tables configured (established 1024 bind 1024)
[    0.050042] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.050167] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.050558] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.051184] device: 'clocksource': device_add
[    0.051259] device: 'clocksource0': device_add
[    0.051738] device: 'clockevents': device_add
[    0.051827] device: 'clockevent0': device_add
[    0.052711] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.064176] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.064764] io scheduler mq-deadline registered
[    0.064793] io scheduler kyber registered
[    0.065672] bridge-interrupt-ctrl@20110 Linked as a fwnode consumer to ocp@f1000000
[    0.065711] bridge-interrupt-ctrl@20110 Dropping the fwnode link to main-interrupt-ctrl@20200
[    0.067357] kirkwood-pinctrl f1018000.pin-controller: registered pinctrl driver
[    0.067403] spi@10600 Linked as a fwnode consumer to pin-controller@18000
[    0.067432] spi@10600 Dropping the fwnode link to pmx-spi0
[    0.067467] serial@12000 Linked as a fwnode consumer to pin-controller@18000
[    0.067492] serial@12000 Dropping the fwnode link to pmx-uart0
[    0.067559] device: 'platform:f1018000.pin-controller--platform:f1012000.serial': device_add
[    0.067807] devices_kset: Moving f1012000.serial to end of list
[    0.067838] platform f1012000.serial: Linked as a consumer to f1018000.pin-controller
[    0.067865] serial@12000 Dropping the fwnode link to pin-controller@18000
[    0.067926] device: 'platform:f1018000.pin-controller--platform:f1010600.spi': device_add
[    0.068143] devices_kset: Moving f1010600.spi to end of list
[    0.068172] platform f1010600.spi: Linked as a consumer to f1018000.pin-controller
[    0.068198] spi@10600 Dropping the fwnode link to pin-controller@18000
[    0.069474] mvebu-gpio f1018100.gpio: high_offset 0
[    0.069751] device: 'gpiochip0': device_add
[    0.070133] device: 'gpiochip0': device_add
[    0.070939] mvebu-gpio f1018124.gpio: high_offset 4
[    0.071184] device: 'gpiochip1': device_add
[    0.071543] device: 'gpiochip32': device_add
[    0.072642] device: 'ptmx': device_add
[    0.072922] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.072995] device: 'serial8250': device_add
[    0.073188] device: 'ttyS0': device_add
[    0.074598] device: 'ttyS0': device_unregister
[    0.074998] printk: console [ttyS0] disabled
[    0.075269] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 23, base_baud = 12500000) is a 16550A
[    0.076037] printk: console [ttyS0] enabled
[    0.076094] device: 'ttyS0': device_add
[    0.077147] device: 'mtd-0': device_add
[    0.079455] device: 'spi0': device_add
[    0.080225] device: 'spi0.0': device_add
[    0.081066] spi-nor spi0.0: mx66l51235f (65536 Kbytes)
[    0.082538] 7 fixed-partitions partitions found on MTD device spi0.0
[    0.082729] device: 'f1010600.spi:m25p80@0:partitions:partition@1': device_add
[    0.083120] Creating 7 MTD partitions on "spi0.0":
[    0.083165] 0x000000000000-0x000000080000 : "SPI.U_BOOT"
[    0.083228] device: 'mtd0': device_add
[    0.083744] device: 'mtd0': device_add
[    0.083988] device: 'mtd0ro': device_add
[    0.084323] 0x0000000a0000-0x0000000c0000 : "SPI.INV_INFO"
[    0.084395] device: 'mtd1': device_add
[    0.084880] device: 'mtd1': device_add
[    0.085172] device: 'mtd1ro': device_add
[    0.085504] 0x0000000c0000-0x000000100000 : "SPI.U_BOOT_ENV"
[    0.085577] device: 'mtd2': device_add
[    0.086064] device: 'mtd2': device_add
[    0.086244] device: 'mtd2ro': device_add
[    0.086578] 0x000000100000-0x000000400000 : "SPI.KERNEL0"
[    0.086650] device: 'mtd3': device_add
[    0.087154] device: 'mtd3': device_add
[    0.087333] device: 'mtd3ro': device_add
[    0.087690] 0x000000400000-0x000000700000 : "SPI.KERNEL1"
[    0.087762] device: 'mtd4': device_add
[    0.088246] device: 'mtd4': device_add
[    0.088429] device: 'mtd4ro': device_add
[    0.088748] 0x000000700000-0x000002f00000 : "SPI.UBI"
[    0.088821] device: 'mtd5': device_add
[    0.089328] device: 'mtd5': device_add
[    0.089511] device: 'mtd5ro': device_add
[    0.089833] 0x000002f00000-0x000004000000 : "SPI.RECOVERY"
[    0.089904] device: 'mtd6': device_add
[    0.090397] device: 'mtd6': device_add
[    0.090603] device: 'mtd6ro': device_add
[    0.092809] device: 'watchdog': device_add
[    0.093116] device: 'watchdog0': device_add
[    0.093505] orion_wdt: Initial timeout 21 sec, nowayout
[    0.101001] device: 'ubi_ctrl': device_add
[    0.101353] ubi0: default fastmap pool size: 30
[    0.101397] ubi0: default fastmap WL pool size: 15
[    0.101427] ubi0: attaching mtd5
[    0.152726] ubi0: scanning is finished
[    0.177839] device: 'ubi0': device_add
[    0.178249] device: 'ubi0_0': device_add
[    0.178643] device: 'ubi0_1': device_add
[    0.178996] device: 'ubi0_2': device_add
[    0.179344] device: 'ubi0_3': device_add
[    0.179719] device: 'ubi0_4': device_add
[    0.180267] ubi0: attached mtd5 (name "SPI.UBI", size 40 MiB)
[    0.180320] ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
[    0.180362] ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
[    0.180396] ubi0: VID header offset: 64 (aligned 64), data offset: 128
[    0.180430] ubi0: good PEBs: 640, bad PEBs: 0, corrupted PEBs: 0
[    0.180462] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
[    0.180497] ubi0: max/mean erase counter: 63/37, WL threshold: 4096, image sequence number: 2009032911
[    0.180539] ubi0: available PEBs: 101, total reserved PEBs: 539, PEBs reserved for bad PEB handling: 0
[    0.180609] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.181788] device: 'ubiblock0_0': device_add
[    0.182697] device: '254:0': device_add
[    0.182937] block ubiblock0_0: created from ubi0:0(rootfs0)
[    0.182996] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.183984] device: 'ubiblock0_2': device_add
[    0.184341] ubi0: background thread "ubi_bgt0d" started, PID 31
[    0.184945] device: '254:1': device_add
[    0.185190] block ubiblock0_2: created from ubi0:2(bank0)
[    0.185246] UBI: block: volume size is not a multiple of 512, last 384 bytes are ignored!
[    0.186189] device: 'ubiblock0_3': device_add
[    0.187117] device: '254:2': device_add
[    0.187356] block ubiblock0_3: created from ubi0:3(bank1)
[    0.196106] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    0.203869] devtmpfs: mounted
[    0.204846] Freeing unused kernel image (initmem) memory: 144K
[    0.204887] Kernel memory protection not selected by kernel config.
[    0.204952] Run /sbin/init as init process
[    0.204973]   with arguments:
[    0.204987]     /sbin/init
[    0.205002]   with environment:
[    0.205016]     HOME=/
[    0.205030]     TERM=linux
[    0.205045]     fastboot=n
[    0.205060]     VersionBoot=3.3
[    0.205076]     VersionOS=2.11.108
[    0.205091]     BootBank=1
[    0.205106]     VersionOS_r=2.11.108
[    0.205122]     BankState_r=1
[    0.205137]     ip=192.168.0.1:192.168.0.100::255.255.255.0:::
[    1.812865] mvneta_bm f10c0000.bm: Buffer Manager for network controller enabled
[    1.866851] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[    1.887001] device: 'Fixed MDIO bus.0': device_add
[    1.887212] device: 'fixed-0': device_add
[    1.897053] device: 'f1072004.mdio-eth-mii': device_add
[    1.960305] device: 'f1072004.mdio-eth-mii:00': device_add
[    1.963213] devices_kset: Moving f1070000.ethernet to end of list
[    1.963486] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[    2.620488] NET: Registered PF_INET6 protocol family
[    2.623382] Segment Routing with IPv6
[    2.623606] In-situ OAM (IOAM) with IPv6
[    3.133929] sctp: Hash tables configured (bind 1024/1024)
[    4.618112] device: 'ubifs_0_4': device_add
[    4.620416] UBIFS (ubi0:4): Mounting in unauthenticated mode
[    4.649339] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 83
[    4.767446] UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "service"
[    4.767502] UBIFS (ubi0:4): LEB size: 65408 bytes (63 KiB), min./max. I/O unit sizes: 8 bytes/256 bytes
[    4.767550] UBIFS (ubi0:4): FS size: 4643968 bytes (4 MiB, 71 LEBs), max 81 LEBs, journal size 523265 bytes (0 MiB, 6 LEBs)
[    4.767603] UBIFS (ubi0:4): reserved for root: 219345 bytes (214 KiB)
[    4.767637] UBIFS (ubi0:4): media format: w5/r0 (latest is w5/r0), UUID 4562C74F-EBB7-4D2D-AE6B-41615575F12C, small LPT model
[   13.931242] devices_kset: Moving f1070000.ethernet to end of list
[   13.931516] platform f1070000.ethernet: error -EPROBE_DEFER: wait for supplier mac@6
[   13.931890] platform f1070000.ethernet: deferred probe pending

[-- Attachment #3: test.dts --]
[-- Type: audio/vnd.dts, Size: 7897 bytes --]

[-- Attachment #4: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
  2023-01-31  8:14             ` Geert Uytterhoeven
@ 2023-02-04 22:30               ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-04 22:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Tue, Jan 31, 2023 at 12:14 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Mon, Jan 30, 2023 at 9:00 PM Saravana Kannan <saravanak@google.com> wrote:
> > On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > > > <geert@linux-m68k.org> wrote:
> > > > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > > > tree node will not have a struct device created for it. This information
> > > > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > > > device tree node.
> > > > > >
> > > > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > > > effect without using OF specific flags. This allows more generic code to
> > > > > > be written in driver core.
> > > > > >
> > > > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > > >
> > > > > Thanks for your patch!
> > > > >
> > > > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > > > >
> > > > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > > > >         if (!error)
> > > > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > > > >
> > > > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > > > it should work fine.
> > > > >
> > > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > i.e. will queue in renesas-devel for v6.4.
> >
> > I hope you meant queue it up for 6.3 and not 6.4?
>
> V6.4.
> The deadline for submitting pull requests for the soc tree is rc6.
> Sorry, your series was posted too late to make that.
>
> > > > Thanks! Does that mean I should drop this from this series? If two
> > > > maintainers pick the same patch up, will it cause problems? I'm
> > > > eventually expecting this series to be picked up by Greg into
> > > > driver-core-next.
> > >
> > > Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> > > through the renesas-devel and soc trees. This patch has no dependencies
> > > on anything else in the series (or vice versa), so there is no reason
> > > to deviate from that, and possibly cause conflicts later.
> >
> > This series is supposed to fix a bunch of issues and I vaguely think
> > the series depends on this patch to work correctly on some Renesas
> > systems. You are my main renesas person, so it's probably some issue
> > you hit. Is you pick it up outside of this series I need to keep
> > asking folks to pick up two different patch threads. I don't have a
> > strong opinion, just a FYI. If you can take this patch soon, I don't
> > have any concerns.
>
> Oh right, you do remove OF_POPULATED handling in
> "[PATCH v2 09/11] of: property: Simplify of_link_to_phandle()".
> It might be wise to postpone that removal, as after your series,
> there are stillseveral users left, some of them might be impacted.
>
> I do plan to test your full series on all my boards, but probably that
> won't happen this week.
>
> > > BTW, I will convert to of_node_to_fwnode() while applying.
> >
> > Sounds good.
>
> If you still want this to land in v6,3 (with the of_node_to_fwnode()
> conversion):
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
>

Yeah, let me try to land this in 6.3 with the series.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink
@ 2023-02-04 22:30               ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-04 22:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Sudeep Holla,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
	Sakari Ailus, Tony Lindgren, Linux Kernel Functional Testing,
	Naresh Kamboju, Abel Vesa, Alexander Stein, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Tue, Jan 31, 2023 at 12:14 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> Hi Saravana,
>
> On Mon, Jan 30, 2023 at 9:00 PM Saravana Kannan <saravanak@google.com> wrote:
> > On Mon, Jan 30, 2023 at 12:43 AM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Sat, Jan 28, 2023 at 8:19 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > On Fri, Jan 27, 2023 at 12:11 AM Geert Uytterhoeven
> > > > <geert@linux-m68k.org> wrote:
> > > > > On Fri, Jan 27, 2023 at 1:11 AM Saravana Kannan <saravanak@google.com> wrote:
> > > > > > The OF_POPULATED flag was set to let fw_devlink know that the device
> > > > > > tree node will not have a struct device created for it. This information
> > > > > > is used by fw_devlink to avoid deferring the probe of consumers of this
> > > > > > device tree node.
> > > > > >
> > > > > > Let's use fwnode_dev_initialized() instead because it achieves the same
> > > > > > effect without using OF specific flags. This allows more generic code to
> > > > > > be written in driver core.
> > > > > >
> > > > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > > >
> > > > > Thanks for your patch!
> > > > >
> > > > > > --- a/drivers/soc/renesas/rcar-sysc.c
> > > > > > +++ b/drivers/soc/renesas/rcar-sysc.c
> > > > > > @@ -437,7 +437,7 @@ static int __init rcar_sysc_pd_init(void)
> > > > > >
> > > > > >         error = of_genpd_add_provider_onecell(np, &domains->onecell_data);
> > > > > >         if (!error)
> > > > > > -               of_node_set_flag(np, OF_POPULATED);
> > > > > > +               fwnode_dev_initialized(&np->fwnode, true);
> > > > >
> > > > > As drivers/soc/renesas/rmobile-sysc.c is already using this method,
> > > > > it should work fine.
> > > > >
> > > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > i.e. will queue in renesas-devel for v6.4.
> >
> > I hope you meant queue it up for 6.3 and not 6.4?
>
> V6.4.
> The deadline for submitting pull requests for the soc tree is rc6.
> Sorry, your series was posted too late to make that.
>
> > > > Thanks! Does that mean I should drop this from this series? If two
> > > > maintainers pick the same patch up, will it cause problems? I'm
> > > > eventually expecting this series to be picked up by Greg into
> > > > driver-core-next.
> > >
> > > Indeed. Patches for drivers/soc/renesas/ are supposed to go upstream
> > > through the renesas-devel and soc trees. This patch has no dependencies
> > > on anything else in the series (or vice versa), so there is no reason
> > > to deviate from that, and possibly cause conflicts later.
> >
> > This series is supposed to fix a bunch of issues and I vaguely think
> > the series depends on this patch to work correctly on some Renesas
> > systems. You are my main renesas person, so it's probably some issue
> > you hit. Is you pick it up outside of this series I need to keep
> > asking folks to pick up two different patch threads. I don't have a
> > strong opinion, just a FYI. If you can take this patch soon, I don't
> > have any concerns.
>
> Oh right, you do remove OF_POPULATED handling in
> "[PATCH v2 09/11] of: property: Simplify of_link_to_phandle()".
> It might be wise to postpone that removal, as after your series,
> there are stillseveral users left, some of them might be impacted.
>
> I do plan to test your full series on all my boards, but probably that
> won't happen this week.
>
> > > BTW, I will convert to of_node_to_fwnode() while applying.
> >
> > Sounds good.
>
> If you still want this to land in v6,3 (with the of_node_to_fwnode()
> conversion):
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
>

Yeah, let me try to land this in 6.3 with the series.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
  2023-01-31 10:13           ` Sudeep Holla
@ 2023-02-04 22:32             ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-04 22:32 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Andy Shevchenko, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Tue, Jan 31, 2023 at 2:13 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Mon, Jan 30, 2023 at 08:01:17PM -0800, Saravana Kannan wrote:
> > On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > > > device has already been initialized and will never probe. This prevents
> > > > > fw_devlink from creating device links with the gpio_device as a
> > > > > supplier. So, clear the flag before adding the device.
> > >
> > > ...
> > >
> > > > > +   /*
> > > > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > > > +    * initialized flag.
> > > > > +    */
> > > > > +   if (!gdev->dev.fwnode->dev)
> > > > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> > > >
> > > > This is the one causing the kernel crash during the boot on FVP which
> > > > Naresh has reported. Just reverted this and was able to boot, confirming
> > > > the issue with this patch.
> > >
> > > I'm wondering if
> > >
> > >         if (!dev_fwnode(&gdev->dev)->dev)
> > >                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
> > >
> > > works.
> >
> > No, that won't help. The problem was that with arm32, we have gpio
> > devices created without any of_node or fwnode. So I can't assume
> > fwnode will always be present.
> >
>
> Correct, and this one is not even arm32. But it is just reusing a driver
> that needs to be supported even on arm32.
>
> Not sure on how to proceed. As a simple way to check, I added a NULL check
> for fwnode building on top of Andy's suggestion[1]. That works.
>
> Also the driver in question on arm64 FVP model is drivers/mfd/vexpress-sysreg.c
> mfd_add_device() in drivers/mfd/mfd-core.c allows addition of devices without
> of_node/fwnode. I am sure returning error like[2] will break many platforms
> but I just wanted to confirm the root cause and [2] fixes the boot without
> NULL check for fwnode in gpiochip_setup_dev().
>
> Hope this helps.

Thanks for debugging it for me Sudeep. Incorporated into my v3.

-Saravana

>
> --
> Regards,
> Sudeep
>
> [1]
>
> -->8
> diff --git i/drivers/gpio/gpiolib.c w/drivers/gpio/gpiolib.c
> index b23140c6485f..e162f13aa2c9 100644
> --- i/drivers/gpio/gpiolib.c
> +++ w/drivers/gpio/gpiolib.c
> @@ -577,13 +577,15 @@ static void gpiodevice_release(struct device *dev)
>  static int gpiochip_setup_dev(struct gpio_device *gdev)
>  {
>         int ret;
> +       struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
>
>         /*
>          * If fwnode doesn't belong to another device, it's safe to clear its
>          * initialized flag.
>          */
> -       if (!gdev->dev.fwnode->dev)
> -               fwnode_dev_initialized(gdev->dev.fwnode, false);
> +       if (fwnode && !fwnode->dev)
> +               fwnode_dev_initialized(fwnode, false);
> +
>         ret = gcdev_register(gdev, gpio_devt);
>         if (ret)
>                 return ret;
>
> [2]
>
> -->8
>
> diff --git i/drivers/mfd/mfd-core.c w/drivers/mfd/mfd-core.c
> index 16d1861e9682..3b2c4b0e9a2a 100644
> --- i/drivers/mfd/mfd-core.c
> +++ w/drivers/mfd/mfd-core.c
> @@ -231,9 +231,11 @@ static int mfd_add_device(struct device *parent, int id,
>                         }
>                 }
>
> -               if (!pdev->dev.of_node)
> +               if (!pdev->dev.of_node) {
>                         pr_warn("%s: Failed to locate of_node [id: %d]\n",
>                                 cell->name, platform_id);
> +                       goto fail_alias;
> +               }
>         }
>
>         mfd_acpi_add_device(cell, pdev);
>

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding
@ 2023-02-04 22:32             ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-04 22:32 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Andy Shevchenko, Greg Kroah-Hartman, Rafael J. Wysocki,
	Cristian Marussi, Linus Walleij, Bartosz Golaszewski,
	Thomas Gleixner, Marc Zyngier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Rob Herring, Frank Rowand, Geert Uytterhoeven, Magnus Damm,
	Len Brown, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Tony Lindgren, Linux Kernel Functional Testing, Naresh Kamboju,
	Abel Vesa, Alexander Stein, Geert Uytterhoeven, John Stultz,
	Doug Anderson, Guenter Roeck, Dmitry Baryshkov, Maxim Kiselev,
	Maxim Kochetkov, Miquel Raynal, Luca Weiss, Colin Foster,
	Martin Kepplinger, Jean-Philippe Brucker, kernel-team,
	linux-kernel, linux-arm-kernel, linux-gpio, devicetree,
	linux-renesas-soc, linux-acpi

On Tue, Jan 31, 2023 at 2:13 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Mon, Jan 30, 2023 at 08:01:17PM -0800, Saravana Kannan wrote:
> > On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote:
> > > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote:
> > > > > Registering an irqdomain sets the flag for the fwnode. But having the
> > > > > flag set when a device is added is interpreted by fw_devlink to mean the
> > > > > device has already been initialized and will never probe. This prevents
> > > > > fw_devlink from creating device links with the gpio_device as a
> > > > > supplier. So, clear the flag before adding the device.
> > >
> > > ...
> > >
> > > > > +   /*
> > > > > +    * If fwnode doesn't belong to another device, it's safe to clear its
> > > > > +    * initialized flag.
> > > > > +    */
> > > > > +   if (!gdev->dev.fwnode->dev)
> > > > > +           fwnode_dev_initialized(gdev->dev.fwnode, false);
> > > >
> > > > This is the one causing the kernel crash during the boot on FVP which
> > > > Naresh has reported. Just reverted this and was able to boot, confirming
> > > > the issue with this patch.
> > >
> > > I'm wondering if
> > >
> > >         if (!dev_fwnode(&gdev->dev)->dev)
> > >                 fwnode_dev_initialized(&dev_fwnode(gdev->dev), false);
> > >
> > > works.
> >
> > No, that won't help. The problem was that with arm32, we have gpio
> > devices created without any of_node or fwnode. So I can't assume
> > fwnode will always be present.
> >
>
> Correct, and this one is not even arm32. But it is just reusing a driver
> that needs to be supported even on arm32.
>
> Not sure on how to proceed. As a simple way to check, I added a NULL check
> for fwnode building on top of Andy's suggestion[1]. That works.
>
> Also the driver in question on arm64 FVP model is drivers/mfd/vexpress-sysreg.c
> mfd_add_device() in drivers/mfd/mfd-core.c allows addition of devices without
> of_node/fwnode. I am sure returning error like[2] will break many platforms
> but I just wanted to confirm the root cause and [2] fixes the boot without
> NULL check for fwnode in gpiochip_setup_dev().
>
> Hope this helps.

Thanks for debugging it for me Sudeep. Incorporated into my v3.

-Saravana

>
> --
> Regards,
> Sudeep
>
> [1]
>
> -->8
> diff --git i/drivers/gpio/gpiolib.c w/drivers/gpio/gpiolib.c
> index b23140c6485f..e162f13aa2c9 100644
> --- i/drivers/gpio/gpiolib.c
> +++ w/drivers/gpio/gpiolib.c
> @@ -577,13 +577,15 @@ static void gpiodevice_release(struct device *dev)
>  static int gpiochip_setup_dev(struct gpio_device *gdev)
>  {
>         int ret;
> +       struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
>
>         /*
>          * If fwnode doesn't belong to another device, it's safe to clear its
>          * initialized flag.
>          */
> -       if (!gdev->dev.fwnode->dev)
> -               fwnode_dev_initialized(gdev->dev.fwnode, false);
> +       if (fwnode && !fwnode->dev)
> +               fwnode_dev_initialized(fwnode, false);
> +
>         ret = gcdev_register(gdev, gpio_devt);
>         if (ret)
>                 return ret;
>
> [2]
>
> -->8
>
> diff --git i/drivers/mfd/mfd-core.c w/drivers/mfd/mfd-core.c
> index 16d1861e9682..3b2c4b0e9a2a 100644
> --- i/drivers/mfd/mfd-core.c
> +++ w/drivers/mfd/mfd-core.c
> @@ -231,9 +231,11 @@ static int mfd_add_device(struct device *parent, int id,
>                         }
>                 }
>
> -               if (!pdev->dev.of_node)
> +               if (!pdev->dev.of_node) {
>                         pr_warn("%s: Failed to locate of_node [id: %d]\n",
>                                 cell->name, platform_id);
> +                       goto fail_alias;
> +               }
>         }
>
>         mfd_acpi_add_device(cell, pdev);
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-03  9:39             ` Maxim Kiselev
@ 2023-02-06  1:32               ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06  1:32 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> >
> > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > Hi Saravana,
> > >
> > > > Can you try the patch at the end of this email under these
> > > > configurations and tell me which ones fail vs pass? I don't need logs
> > >
> > > I did these tests and here is the results:
> >
> > Did you hand edit the In-Reply-To: in the header? Because in the
> > thread you are reply to the wrong email, but the context in your email
> > seems to be from the right email.
> >
> > For example, see how your reply isn't under the email you are replying
> > to in this thread overview:
> > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> >
> > > 1. On top of this series - Not works
> > > 2. Without this series    - Works
> > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > >
> > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > But despite the fact that this helps to avoid getting stuck at probing
> > > my ethernet device, there is still regression.
> > >
> > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > from the nvmem-cell with mac address.
> > >
> > > Please look at the kernel logs below.
> >
> > The kernel logs below really aren't that useful for me in their
> > current state. See more below.
> >
> > ---8<---- <snip> --->8----
> >
> > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > but look like it is not best way to solve a problem which we discussed
> > > in the MTD thread.
> > >
> > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > applied on top of this series. Maybe I missed something.
> >
> > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > answer my question about the dts from my earlier email.
> > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> >
> > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > drivers/core/base.c changed to the _info variants? And then share the
> > kernel log from the beginning of boot? Maybe attach it to the email so
> > it doesn't get word wrapped by your email client. And please point me
> > to the .dts that corresponds to your board. Without that, I can't
> > debug much.
> >
> > Thanks,
> > Saravana
>
> > Did you hand edit the In-Reply-To: in the header? Because in the
> > thread you are reply to the wrong email, but the context in your email
> > seems to be from the right email.
>
> Sorry for that, it seems like I accidently deleted it.
>
> > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > drivers/core/base.c changed to the _info variants? And then share the
> > kernel log from the beginning of boot? Maybe attach it to the email so
> > it doesn't get word wrapped by your email client. And please point me
> > to the .dts that corresponds to your board. Without that, I can't
> > debug much.
>
> Ok, I retested config 1 with all _debug logs changed to the _info. I
> added the kernel log and the dts file to the attachment of this email.

Ah, so your device is not supported/present upstream? Even though it's
not upstream, I'll help fix this because it should fix what I believe
are unreported issues in upstream.

Ok I know why configs 1 - 4 behaved the way they did and why my test
patch didn't help.

After staring at mtd/nvmem code for a few hours I think mtd/nvmem
interaction is kind of a mess. mtd core creates "partition" platform
devices (including for nvmem-cells) that are probed by drivers in
drivers/nvmem. However, there's no driver for "nvmem-cells" partition
platform device. However, the nvmem core creates nvmem_device when
nvmem_register() is called by MTD or these partition platform devices
created by MTD. But these nvmem_devices are added to a nvmem_bus but
the bus has no means to even register a driver (it should really be a
nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
to the DT node of the MTD device or sometimes the partition platform
devices or maybe no DT node at all.

So it's a mess of multiple devices pointing to the same DT node with
no clear way to identify which ones will point to a DT node and which
ones will probe and which ones won't. In the future, we shouldn't
allow adding new compatible strings for partitions for which we don't
plan on adding nvmem drivers.

Can you give the patch at the end of the email a shot? It should fix
the issue with this series and without this series. It just avoids
this whole mess by not creating useless platform device for
nvmem-cells compatible DT nodes.

Thanks,
Saravana

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d442fa94c872..88a213f4d651 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
 {
        struct mtd_part_parser *parser;
        struct device_node *np;
+       struct device_node *child;
        struct property *prop;
        struct device *dev;
        const char *compat;
@@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
        else
                np = of_get_child_by_name(np, "partitions");

+       for_each_child_of_node(np, child)
+               if (of_device_is_compatible(child, "nvmem-cells"))
+                       of_node_set_flag(child, OF_POPULATED);
+
        of_property_for_each_string(np, "compatible", prop, compat) {
                parser = mtd_part_get_compatible_parser(compat);
                if (!parser)

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06  1:32               ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06  1:32 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
>
> пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> >
> > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > Hi Saravana,
> > >
> > > > Can you try the patch at the end of this email under these
> > > > configurations and tell me which ones fail vs pass? I don't need logs
> > >
> > > I did these tests and here is the results:
> >
> > Did you hand edit the In-Reply-To: in the header? Because in the
> > thread you are reply to the wrong email, but the context in your email
> > seems to be from the right email.
> >
> > For example, see how your reply isn't under the email you are replying
> > to in this thread overview:
> > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> >
> > > 1. On top of this series - Not works
> > > 2. Without this series    - Works
> > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > >
> > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > But despite the fact that this helps to avoid getting stuck at probing
> > > my ethernet device, there is still regression.
> > >
> > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > from the nvmem-cell with mac address.
> > >
> > > Please look at the kernel logs below.
> >
> > The kernel logs below really aren't that useful for me in their
> > current state. See more below.
> >
> > ---8<---- <snip> --->8----
> >
> > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > but look like it is not best way to solve a problem which we discussed
> > > in the MTD thread.
> > >
> > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > applied on top of this series. Maybe I missed something.
> >
> > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > answer my question about the dts from my earlier email.
> > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> >
> > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > drivers/core/base.c changed to the _info variants? And then share the
> > kernel log from the beginning of boot? Maybe attach it to the email so
> > it doesn't get word wrapped by your email client. And please point me
> > to the .dts that corresponds to your board. Without that, I can't
> > debug much.
> >
> > Thanks,
> > Saravana
>
> > Did you hand edit the In-Reply-To: in the header? Because in the
> > thread you are reply to the wrong email, but the context in your email
> > seems to be from the right email.
>
> Sorry for that, it seems like I accidently deleted it.
>
> > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > drivers/core/base.c changed to the _info variants? And then share the
> > kernel log from the beginning of boot? Maybe attach it to the email so
> > it doesn't get word wrapped by your email client. And please point me
> > to the .dts that corresponds to your board. Without that, I can't
> > debug much.
>
> Ok, I retested config 1 with all _debug logs changed to the _info. I
> added the kernel log and the dts file to the attachment of this email.

Ah, so your device is not supported/present upstream? Even though it's
not upstream, I'll help fix this because it should fix what I believe
are unreported issues in upstream.

Ok I know why configs 1 - 4 behaved the way they did and why my test
patch didn't help.

After staring at mtd/nvmem code for a few hours I think mtd/nvmem
interaction is kind of a mess. mtd core creates "partition" platform
devices (including for nvmem-cells) that are probed by drivers in
drivers/nvmem. However, there's no driver for "nvmem-cells" partition
platform device. However, the nvmem core creates nvmem_device when
nvmem_register() is called by MTD or these partition platform devices
created by MTD. But these nvmem_devices are added to a nvmem_bus but
the bus has no means to even register a driver (it should really be a
nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
to the DT node of the MTD device or sometimes the partition platform
devices or maybe no DT node at all.

So it's a mess of multiple devices pointing to the same DT node with
no clear way to identify which ones will point to a DT node and which
ones will probe and which ones won't. In the future, we shouldn't
allow adding new compatible strings for partitions for which we don't
plan on adding nvmem drivers.

Can you give the patch at the end of the email a shot? It should fix
the issue with this series and without this series. It just avoids
this whole mess by not creating useless platform device for
nvmem-cells compatible DT nodes.

Thanks,
Saravana

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d442fa94c872..88a213f4d651 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
 {
        struct mtd_part_parser *parser;
        struct device_node *np;
+       struct device_node *child;
        struct property *prop;
        struct device *dev;
        const char *compat;
@@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
        else
                np = of_get_child_by_name(np, "partitions");

+       for_each_child_of_node(np, child)
+               if (of_device_is_compatible(child, "nvmem-cells"))
+                       of_node_set_flag(child, OF_POPULATED);
+
        of_property_for_each_string(np, "compatible", prop, compat) {
                parser = mtd_part_get_compatible_parser(compat);
                if (!parser)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06  1:32               ` Saravana Kannan
@ 2023-02-06  2:17                 ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06  2:17 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Sun, Feb 5, 2023 at 5:32 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > >
> > > > Hi Saravana,
> > > >
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > >
> > > > I did these tests and here is the results:
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana
> >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> >
> > Sorry for that, it seems like I accidently deleted it.
> >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.
>
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
>
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
>
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess. mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.
>
> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.
>
> Can you give the patch at the end of the email a shot? It should fix
> the issue with this series and without this series. It just avoids
> this whole mess by not creating useless platform device for
> nvmem-cells compatible DT nodes.

Actually, without this series, the patch below will need an additional
line of code inside the if block:
fwnode_dev_initialized(of_fwnode_handle(child), true);

-Saravana

>
> Thanks,
> Saravana
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index d442fa94c872..88a213f4d651 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
>  {
>         struct mtd_part_parser *parser;
>         struct device_node *np;
> +       struct device_node *child;
>         struct property *prop;
>         struct device *dev;
>         const char *compat;
> @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
>         else
>                 np = of_get_child_by_name(np, "partitions");
>
> +       for_each_child_of_node(np, child)
> +               if (of_device_is_compatible(child, "nvmem-cells"))
> +                       of_node_set_flag(child, OF_POPULATED);
> +
>         of_property_for_each_string(np, "compatible", prop, compat) {
>                 parser = mtd_part_get_compatible_parser(compat);
>                 if (!parser)

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06  2:17                 ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06  2:17 UTC (permalink / raw)
  To: Maxim Kiselev
  Cc: Sudeep Holla, Naresh Kamboju, abel.vesa, alexander.stein,
	andriy.shevchenko, brgl, colin.foster, cristian.marussi,
	devicetree, dianders, djrscally, dmitry.baryshkov, festevam,
	fido_max, frowand.list, geert+renesas, geert, gregkh,
	heikki.krogerus, jpb, jstultz, kernel-team, kernel, lenb,
	linus.walleij, linux-acpi, linux-arm-kernel, linux-gpio,
	linux-imx, linux-kernel, linux-renesas-soc, linux, lkft,
	luca.weiss, magnus.damm, martin.kepplinger, maz, miquel.raynal,
	rafael, robh+dt, s.hauer, sakari.ailus, shawnguo, tglx, tony

On Sun, Feb 5, 2023 at 5:32 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > >
> > > > Hi Saravana,
> > > >
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > >
> > > > I did these tests and here is the results:
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana
> >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> >
> > Sorry for that, it seems like I accidently deleted it.
> >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.
>
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
>
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
>
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess. mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.
>
> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.
>
> Can you give the patch at the end of the email a shot? It should fix
> the issue with this series and without this series. It just avoids
> this whole mess by not creating useless platform device for
> nvmem-cells compatible DT nodes.

Actually, without this series, the patch below will need an additional
line of code inside the if block:
fwnode_dev_initialized(of_fwnode_handle(child), true);

-Saravana

>
> Thanks,
> Saravana
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index d442fa94c872..88a213f4d651 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
>  {
>         struct mtd_part_parser *parser;
>         struct device_node *np;
> +       struct device_node *child;
>         struct property *prop;
>         struct device *dev;
>         const char *compat;
> @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
>         else
>                 np = of_get_child_by_name(np, "partitions");
>
> +       for_each_child_of_node(np, child)
> +               if (of_device_is_compatible(child, "nvmem-cells"))
> +                       of_node_set_flag(child, OF_POPULATED);
> +
>         of_property_for_each_string(np, "compatible", prop, compat) {
>                 parser = mtd_part_get_compatible_parser(compat);
>                 if (!parser)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06  1:32               ` Saravana Kannan
@ 2023-02-06  9:39                 ` Miquel Raynal
  -1 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-02-06  9:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

Hi Saravana,

+ Srinivas, nvmem maintainer

saravanak@google.com wrote on Sun, 5 Feb 2023 17:32:57 -0800:

> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:  
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:  
> > > >
> > > > Hi Saravana,
> > > >  
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs  
> > > >
> > > > I did these tests and here is the results:  
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >  
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.  
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >  
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.  
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana  
> >  
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.  
> >
> > Sorry for that, it seems like I accidently deleted it.
> >  
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.  
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.  
> 
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
> 
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
> 
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess.

nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
cannot really re-wire without breaking users, so nvmem on top of mtd
of course inherit from the fragile designs in place.

> mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus).

Srinivas, do you think we could change this?

> And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.

I guess this comes from the fact that this is not strongly defined in
mtd and depends on the situation (not mentioning 20 years of history
there as well). "mtd" is a bit inconsistent on what it means. Older
designs mixed: controllers, ECC engines when relevant and memories;
while these three components are completely separated. Hence
sometimes the mtd device ends up being the top level controller,
sometimes it's just one partition...

But I'm surprised not all of them point to a DT node. Could you show us
an example? Because that might likely be unexpected (or perhaps I am
missing something).

> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.
>
> Can you give the patch at the end of the email a shot? It should fix
> the issue with this series and without this series. It just avoids
> this whole mess by not creating useless platform device for
> nvmem-cells compatible DT nodes.

Thanks a lot for your help.

> 
> Thanks,
> Saravana
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index d442fa94c872..88a213f4d651 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
>  {
>         struct mtd_part_parser *parser;
>         struct device_node *np;
> +       struct device_node *child;
>         struct property *prop;
>         struct device *dev;
>         const char *compat;
> @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
>         else
>                 np = of_get_child_by_name(np, "partitions");
> 
> +       for_each_child_of_node(np, child)
> +               if (of_device_is_compatible(child, "nvmem-cells"))
> +                       of_node_set_flag(child, OF_POPULATED);

What about a comment explaining why we need that in the final patch
(with a comment)? Otherwise it's a little bit obscure.

> +
>         of_property_for_each_string(np, "compatible", prop, compat) {
>                 parser = mtd_part_get_compatible_parser(compat);
>                 if (!parser)


Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06  9:39                 ` Miquel Raynal
  0 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-02-06  9:39 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

Hi Saravana,

+ Srinivas, nvmem maintainer

saravanak@google.com wrote on Sun, 5 Feb 2023 17:32:57 -0800:

> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:  
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:  
> > > >
> > > > Hi Saravana,
> > > >  
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs  
> > > >
> > > > I did these tests and here is the results:  
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >  
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.  
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >  
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.  
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana  
> >  
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.  
> >
> > Sorry for that, it seems like I accidently deleted it.
> >  
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.  
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.  
> 
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
> 
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
> 
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess.

nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
cannot really re-wire without breaking users, so nvmem on top of mtd
of course inherit from the fragile designs in place.

> mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus).

Srinivas, do you think we could change this?

> And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.

I guess this comes from the fact that this is not strongly defined in
mtd and depends on the situation (not mentioning 20 years of history
there as well). "mtd" is a bit inconsistent on what it means. Older
designs mixed: controllers, ECC engines when relevant and memories;
while these three components are completely separated. Hence
sometimes the mtd device ends up being the top level controller,
sometimes it's just one partition...

But I'm surprised not all of them point to a DT node. Could you show us
an example? Because that might likely be unexpected (or perhaps I am
missing something).

> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.
>
> Can you give the patch at the end of the email a shot? It should fix
> the issue with this series and without this series. It just avoids
> this whole mess by not creating useless platform device for
> nvmem-cells compatible DT nodes.

Thanks a lot for your help.

> 
> Thanks,
> Saravana
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index d442fa94c872..88a213f4d651 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
>  {
>         struct mtd_part_parser *parser;
>         struct device_node *np;
> +       struct device_node *child;
>         struct property *prop;
>         struct device *dev;
>         const char *compat;
> @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
>         else
>                 np = of_get_child_by_name(np, "partitions");
> 
> +       for_each_child_of_node(np, child)
> +               if (of_device_is_compatible(child, "nvmem-cells"))
> +                       of_node_set_flag(child, OF_POPULATED);

What about a comment explaining why we need that in the final patch
(with a comment)? Otherwise it's a little bit obscure.

> +
>         of_property_for_each_string(np, "compatible", prop, compat) {
>                 parser = mtd_part_get_compatible_parser(compat);
>                 if (!parser)


Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06  1:32               ` Saravana Kannan
@ 2023-02-06 15:18                 ` Rob Herring
  -1 siblings, 0 replies; 146+ messages in thread
From: Rob Herring @ 2023-02-06 15:18 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

On Sun, Feb 5, 2023 at 7:33 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > >
> > > > Hi Saravana,
> > > >
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > >
> > > > I did these tests and here is the results:
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana
> >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> >
> > Sorry for that, it seems like I accidently deleted it.
> >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.
>
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
>
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
>
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess. mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.
>
> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.

That won't work. Having a compatible string cannot mean there must be a driver.

Rob

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06 15:18                 ` Rob Herring
  0 siblings, 0 replies; 146+ messages in thread
From: Rob Herring @ 2023-02-06 15:18 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

On Sun, Feb 5, 2023 at 7:33 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> >
> > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > >
> > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > >
> > > > Hi Saravana,
> > > >
> > > > > Can you try the patch at the end of this email under these
> > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > >
> > > > I did these tests and here is the results:
> > >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> > >
> > > For example, see how your reply isn't under the email you are replying
> > > to in this thread overview:
> > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > >
> > > > 1. On top of this series - Not works
> > > > 2. Without this series    - Works
> > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > >
> > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > my ethernet device, there is still regression.
> > > >
> > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > from the nvmem-cell with mac address.
> > > >
> > > > Please look at the kernel logs below.
> > >
> > > The kernel logs below really aren't that useful for me in their
> > > current state. See more below.
> > >
> > > ---8<---- <snip> --->8----
> > >
> > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > but look like it is not best way to solve a problem which we discussed
> > > > in the MTD thread.
> > > >
> > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > applied on top of this series. Maybe I missed something.
> > >
> > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > answer my question about the dts from my earlier email.
> > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> > >
> > > Thanks,
> > > Saravana
> >
> > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > thread you are reply to the wrong email, but the context in your email
> > > seems to be from the right email.
> >
> > Sorry for that, it seems like I accidently deleted it.
> >
> > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > drivers/core/base.c changed to the _info variants? And then share the
> > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > it doesn't get word wrapped by your email client. And please point me
> > > to the .dts that corresponds to your board. Without that, I can't
> > > debug much.
> >
> > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > added the kernel log and the dts file to the attachment of this email.
>
> Ah, so your device is not supported/present upstream? Even though it's
> not upstream, I'll help fix this because it should fix what I believe
> are unreported issues in upstream.
>
> Ok I know why configs 1 - 4 behaved the way they did and why my test
> patch didn't help.
>
> After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> interaction is kind of a mess. mtd core creates "partition" platform
> devices (including for nvmem-cells) that are probed by drivers in
> drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> platform device. However, the nvmem core creates nvmem_device when
> nvmem_register() is called by MTD or these partition platform devices
> created by MTD. But these nvmem_devices are added to a nvmem_bus but
> the bus has no means to even register a driver (it should really be a
> nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> to the DT node of the MTD device or sometimes the partition platform
> devices or maybe no DT node at all.
>
> So it's a mess of multiple devices pointing to the same DT node with
> no clear way to identify which ones will point to a DT node and which
> ones will probe and which ones won't. In the future, we shouldn't
> allow adding new compatible strings for partitions for which we don't
> plan on adding nvmem drivers.

That won't work. Having a compatible string cannot mean there must be a driver.

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06 15:18                 ` Rob Herring
@ 2023-02-06 19:59                   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06 19:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

On Mon, Feb 6, 2023 at 7:19 AM Rob Herring <robh+dt@kernel.org> wrote:
>
> On Sun, Feb 5, 2023 at 7:33 PM Saravana Kannan <saravanak@google.com> wrote:
> >
> > On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > > >
> > > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > > >
> > > > > Hi Saravana,
> > > > >
> > > > > > Can you try the patch at the end of this email under these
> > > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > > >
> > > > > I did these tests and here is the results:
> > > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > > >
> > > > For example, see how your reply isn't under the email you are replying
> > > > to in this thread overview:
> > > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > > >
> > > > > 1. On top of this series - Not works
> > > > > 2. Without this series    - Works
> > > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > > >
> > > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > > my ethernet device, there is still regression.
> > > > >
> > > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > > from the nvmem-cell with mac address.
> > > > >
> > > > > Please look at the kernel logs below.
> > > >
> > > > The kernel logs below really aren't that useful for me in their
> > > > current state. See more below.
> > > >
> > > > ---8<---- <snip> --->8----
> > > >
> > > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > > but look like it is not best way to solve a problem which we discussed
> > > > > in the MTD thread.
> > > > >
> > > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > > applied on top of this series. Maybe I missed something.
> > > >
> > > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > > answer my question about the dts from my earlier email.
> > > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > > >
> > > > Thanks,
> > > > Saravana
> > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > >
> > > Sorry for that, it seems like I accidently deleted it.
> > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > >
> > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > added the kernel log and the dts file to the attachment of this email.
> >
> > Ah, so your device is not supported/present upstream? Even though it's
> > not upstream, I'll help fix this because it should fix what I believe
> > are unreported issues in upstream.
> >
> > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > patch didn't help.
> >
> > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > interaction is kind of a mess. mtd core creates "partition" platform
> > devices (including for nvmem-cells) that are probed by drivers in
> > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > platform device. However, the nvmem core creates nvmem_device when
> > nvmem_register() is called by MTD or these partition platform devices
> > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > the bus has no means to even register a driver (it should really be a
> > nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> > to the DT node of the MTD device or sometimes the partition platform
> > devices or maybe no DT node at all.
> >
> > So it's a mess of multiple devices pointing to the same DT node with
> > no clear way to identify which ones will point to a DT node and which
> > ones will probe and which ones won't. In the future, we shouldn't
> > allow adding new compatible strings for partitions for which we don't
> > plan on adding nvmem drivers.
>
> That won't work. Having a compatible string cannot mean there must be a driver.

Right, I know what you mean Rob and I know where you are coming from
(DT isn't just about Linux or even driver core). But what I'm saying
is that this seems to already be the case for MTD partitions after
commit:
bcdf0315a61a mtd: call of_platform_populate() for MTD partitions

So, if we are adding compatible properties only for some of them, then
I'm saying we should make sure people write drivers for them going
forward.

I don't know enough about MTD partitions to know why only some of them
have compatible properties.

-Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06 19:59                   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06 19:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, miquel.raynal, rafael, s.hauer,
	sakari.ailus, shawnguo, tglx, tony

On Mon, Feb 6, 2023 at 7:19 AM Rob Herring <robh+dt@kernel.org> wrote:
>
> On Sun, Feb 5, 2023 at 7:33 PM Saravana Kannan <saravanak@google.com> wrote:
> >
> > On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > > >
> > > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > > >
> > > > > Hi Saravana,
> > > > >
> > > > > > Can you try the patch at the end of this email under these
> > > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > > >
> > > > > I did these tests and here is the results:
> > > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > > >
> > > > For example, see how your reply isn't under the email you are replying
> > > > to in this thread overview:
> > > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > > >
> > > > > 1. On top of this series - Not works
> > > > > 2. Without this series    - Works
> > > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > > >
> > > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > > my ethernet device, there is still regression.
> > > > >
> > > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > > from the nvmem-cell with mac address.
> > > > >
> > > > > Please look at the kernel logs below.
> > > >
> > > > The kernel logs below really aren't that useful for me in their
> > > > current state. See more below.
> > > >
> > > > ---8<---- <snip> --->8----
> > > >
> > > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > > but look like it is not best way to solve a problem which we discussed
> > > > > in the MTD thread.
> > > > >
> > > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > > applied on top of this series. Maybe I missed something.
> > > >
> > > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > > answer my question about the dts from my earlier email.
> > > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > > >
> > > > Thanks,
> > > > Saravana
> > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > >
> > > Sorry for that, it seems like I accidently deleted it.
> > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > >
> > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > added the kernel log and the dts file to the attachment of this email.
> >
> > Ah, so your device is not supported/present upstream? Even though it's
> > not upstream, I'll help fix this because it should fix what I believe
> > are unreported issues in upstream.
> >
> > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > patch didn't help.
> >
> > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > interaction is kind of a mess. mtd core creates "partition" platform
> > devices (including for nvmem-cells) that are probed by drivers in
> > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > platform device. However, the nvmem core creates nvmem_device when
> > nvmem_register() is called by MTD or these partition platform devices
> > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > the bus has no means to even register a driver (it should really be a
> > nvmem_class and not nvmem_bus). And the nvmem_device sometimes points
> > to the DT node of the MTD device or sometimes the partition platform
> > devices or maybe no DT node at all.
> >
> > So it's a mess of multiple devices pointing to the same DT node with
> > no clear way to identify which ones will point to a DT node and which
> > ones will probe and which ones won't. In the future, we shouldn't
> > allow adding new compatible strings for partitions for which we don't
> > plan on adding nvmem drivers.
>
> That won't work. Having a compatible string cannot mean there must be a driver.

Right, I know what you mean Rob and I know where you are coming from
(DT isn't just about Linux or even driver core). But what I'm saying
is that this seems to already be the case for MTD partitions after
commit:
bcdf0315a61a mtd: call of_platform_populate() for MTD partitions

So, if we are adding compatible properties only for some of them, then
I'm saying we should make sure people write drivers for them going
forward.

I don't know enough about MTD partitions to know why only some of them
have compatible properties.

-Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06  9:39                 ` Miquel Raynal
@ 2023-02-06 20:08                   ` Saravana Kannan
  -1 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06 20:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

On Mon, Feb 6, 2023 at 1:39 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Saravana,
>
> + Srinivas, nvmem maintainer
>
> saravanak@google.com wrote on Sun, 5 Feb 2023 17:32:57 -0800:
>
> > On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > > >
> > > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > > >
> > > > > Hi Saravana,
> > > > >
> > > > > > Can you try the patch at the end of this email under these
> > > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > > >
> > > > > I did these tests and here is the results:
> > > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > > >
> > > > For example, see how your reply isn't under the email you are replying
> > > > to in this thread overview:
> > > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > > >
> > > > > 1. On top of this series - Not works
> > > > > 2. Without this series    - Works
> > > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > > >
> > > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > > my ethernet device, there is still regression.
> > > > >
> > > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > > from the nvmem-cell with mac address.
> > > > >
> > > > > Please look at the kernel logs below.
> > > >
> > > > The kernel logs below really aren't that useful for me in their
> > > > current state. See more below.
> > > >
> > > > ---8<---- <snip> --->8----
> > > >
> > > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > > but look like it is not best way to solve a problem which we discussed
> > > > > in the MTD thread.
> > > > >
> > > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > > applied on top of this series. Maybe I missed something.
> > > >
> > > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > > answer my question about the dts from my earlier email.
> > > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > > >
> > > > Thanks,
> > > > Saravana
> > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > >
> > > Sorry for that, it seems like I accidently deleted it.
> > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > >
> > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > added the kernel log and the dts file to the attachment of this email.
> >
> > Ah, so your device is not supported/present upstream? Even though it's
> > not upstream, I'll help fix this because it should fix what I believe
> > are unreported issues in upstream.
> >
> > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > patch didn't help.
> >
> > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > interaction is kind of a mess.
>
> nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
> cannot really re-wire without breaking users, so nvmem on top of mtd
> of course inherit from the fragile designs in place.

Thanks for the context. Yeah, I figured. That's why I explicitly
limited my comment to "interaction". Although, I'd love to see the MTD
parsers all be converted to proper drivers that probe. MTD is
essentially repeating the driver matching logic. I think it can be
cleaned up to move to proper drivers and still not break backward
compatibility. Not saying it'll be trivial, but it should be possible.
Ironically MTD uses mtd_class but has real drivers that work on the
device (compared to nvmem_bus below).

> > mtd core creates "partition" platform
> > devices (including for nvmem-cells) that are probed by drivers in
> > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > platform device. However, the nvmem core creates nvmem_device when
> > nvmem_register() is called by MTD or these partition platform devices
> > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > the bus has no means to even register a driver (it should really be a
> > nvmem_class and not nvmem_bus).
>
> Srinivas, do you think we could change this?

Yeah, this part gets a bit tricky. It depends on whether the sysfs
files for nvmem devices is considered an ABI. Changing from bus to
class would change the sysfs path for nvmem devices from:
/sys/class/nvmem to /sys/bus/nvmem

> > And the nvmem_device sometimes points
> > to the DT node of the MTD device or sometimes the partition platform
> > devices or maybe no DT node at all.
>
> I guess this comes from the fact that this is not strongly defined in
> mtd and depends on the situation (not mentioning 20 years of history
> there as well). "mtd" is a bit inconsistent on what it means. Older
> designs mixed: controllers, ECC engines when relevant and memories;
> while these three components are completely separated. Hence
> sometimes the mtd device ends up being the top level controller,
> sometimes it's just one partition...
>
> But I'm surprised not all of them point to a DT node. Could you show us
> an example? Because that might likely be unexpected (or perhaps I am
> missing something).

Well, the logic that sets the DT node for nvmem_device is like so:

        if (config->of_node)
                nvmem->dev.of_node = config->of_node;
        else if (!config->no_of_node)
                nvmem->dev.of_node = config->dev->of_node;

So there's definitely a path (where both if's could be false) where
the DT node will not get set. I don't know if that path is possible
with the existing users of nvmem_register(), but it's definitely
possible.

> > So it's a mess of multiple devices pointing to the same DT node with
> > no clear way to identify which ones will point to a DT node and which
> > ones will probe and which ones won't. In the future, we shouldn't
> > allow adding new compatible strings for partitions for which we don't
> > plan on adding nvmem drivers.
> >
> > Can you give the patch at the end of the email a shot? It should fix
> > the issue with this series and without this series. It just avoids
> > this whole mess by not creating useless platform device for
> > nvmem-cells compatible DT nodes.
>
> Thanks a lot for your help.

No problem. I want fw_devlink to work for everyone.

> >
> > Thanks,
> > Saravana
> >
> > diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> > index d442fa94c872..88a213f4d651 100644
> > --- a/drivers/mtd/mtdpart.c
> > +++ b/drivers/mtd/mtdpart.c
> > @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
> >  {
> >         struct mtd_part_parser *parser;
> >         struct device_node *np;
> > +       struct device_node *child;
> >         struct property *prop;
> >         struct device *dev;
> >         const char *compat;
> > @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
> >         else
> >                 np = of_get_child_by_name(np, "partitions");
> >
> > +       for_each_child_of_node(np, child)
> > +               if (of_device_is_compatible(child, "nvmem-cells"))
> > +                       of_node_set_flag(child, OF_POPULATED);
>
> What about a comment explaining why we need that in the final patch
> (with a comment)? Otherwise it's a little bit obscure.

This wasn't meant to be reviewed :) Just a quick patch to make sure
I'm going down the right path. Once Maxim confirms I was going to roll
this into a proper patch.

But point noted. Will add a comment.

Thanks,
Saravana

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-06 20:08                   ` Saravana Kannan
  0 siblings, 0 replies; 146+ messages in thread
From: Saravana Kannan @ 2023-02-06 20:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

On Mon, Feb 6, 2023 at 1:39 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Saravana,
>
> + Srinivas, nvmem maintainer
>
> saravanak@google.com wrote on Sun, 5 Feb 2023 17:32:57 -0800:
>
> > On Fri, Feb 3, 2023 at 1:39 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > >
> > > пт, 3 февр. 2023 г. в 09:07, Saravana Kannan <saravanak@google.com>:
> > > >
> > > > On Thu, Feb 2, 2023 at 9:36 AM Maxim Kiselev <bigunclemax@gmail.com> wrote:
> > > > >
> > > > > Hi Saravana,
> > > > >
> > > > > > Can you try the patch at the end of this email under these
> > > > > > configurations and tell me which ones fail vs pass? I don't need logs
> > > > >
> > > > > I did these tests and here is the results:
> > > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > > >
> > > > For example, see how your reply isn't under the email you are replying
> > > > to in this thread overview:
> > > > https://lore.kernel.org/lkml/20230127001141.407071-1-saravanak@google.com/#r
> > > >
> > > > > 1. On top of this series - Not works
> > > > > 2. Without this series    - Works
> > > > > 3. On top of the series with the fwnode_dev_initialized() deleted - Not works
> > > > > 4. Without this series, with the fwnode_dev_initialized() deleted  - Works
> > > > >
> > > > > So your nvmem/core.c patch helps only when it is applied without the series.
> > > > > But despite the fact that this helps to avoid getting stuck at probing
> > > > > my ethernet device, there is still regression.
> > > > >
> > > > > When the ethernet module is loaded it takes a lot of time to drop dependency
> > > > > from the nvmem-cell with mac address.
> > > > >
> > > > > Please look at the kernel logs below.
> > > >
> > > > The kernel logs below really aren't that useful for me in their
> > > > current state. See more below.
> > > >
> > > > ---8<---- <snip> --->8----
> > > >
> > > > > P.S. Your nvmem patch definitely helps to avoid a device probe stuck
> > > > > but look like it is not best way to solve a problem which we discussed
> > > > > in the MTD thread.
> > > > >
> > > > > P.P.S. Also I don't know why your nvmem-cell patch doesn't help when it was
> > > > > applied on top of this series. Maybe I missed something.
> > > >
> > > > Yeah, I'm not too sure if the test was done correctly. You also didn't
> > > > answer my question about the dts from my earlier email.
> > > > https://lore.kernel.org/lkml/CAGETcx8FpmbaRm2CCwqt3BRBpgbogwP5gNB+iA5OEtuxWVTNLA@mail.gmail.com/#t
> > > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > > >
> > > > Thanks,
> > > > Saravana
> > >
> > > > Did you hand edit the In-Reply-To: in the header? Because in the
> > > > thread you are reply to the wrong email, but the context in your email
> > > > seems to be from the right email.
> > >
> > > Sorry for that, it seems like I accidently deleted it.
> > >
> > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > it doesn't get word wrapped by your email client. And please point me
> > > > to the .dts that corresponds to your board. Without that, I can't
> > > > debug much.
> > >
> > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > added the kernel log and the dts file to the attachment of this email.
> >
> > Ah, so your device is not supported/present upstream? Even though it's
> > not upstream, I'll help fix this because it should fix what I believe
> > are unreported issues in upstream.
> >
> > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > patch didn't help.
> >
> > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > interaction is kind of a mess.
>
> nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
> cannot really re-wire without breaking users, so nvmem on top of mtd
> of course inherit from the fragile designs in place.

Thanks for the context. Yeah, I figured. That's why I explicitly
limited my comment to "interaction". Although, I'd love to see the MTD
parsers all be converted to proper drivers that probe. MTD is
essentially repeating the driver matching logic. I think it can be
cleaned up to move to proper drivers and still not break backward
compatibility. Not saying it'll be trivial, but it should be possible.
Ironically MTD uses mtd_class but has real drivers that work on the
device (compared to nvmem_bus below).

> > mtd core creates "partition" platform
> > devices (including for nvmem-cells) that are probed by drivers in
> > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > platform device. However, the nvmem core creates nvmem_device when
> > nvmem_register() is called by MTD or these partition platform devices
> > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > the bus has no means to even register a driver (it should really be a
> > nvmem_class and not nvmem_bus).
>
> Srinivas, do you think we could change this?

Yeah, this part gets a bit tricky. It depends on whether the sysfs
files for nvmem devices is considered an ABI. Changing from bus to
class would change the sysfs path for nvmem devices from:
/sys/class/nvmem to /sys/bus/nvmem

> > And the nvmem_device sometimes points
> > to the DT node of the MTD device or sometimes the partition platform
> > devices or maybe no DT node at all.
>
> I guess this comes from the fact that this is not strongly defined in
> mtd and depends on the situation (not mentioning 20 years of history
> there as well). "mtd" is a bit inconsistent on what it means. Older
> designs mixed: controllers, ECC engines when relevant and memories;
> while these three components are completely separated. Hence
> sometimes the mtd device ends up being the top level controller,
> sometimes it's just one partition...
>
> But I'm surprised not all of them point to a DT node. Could you show us
> an example? Because that might likely be unexpected (or perhaps I am
> missing something).

Well, the logic that sets the DT node for nvmem_device is like so:

        if (config->of_node)
                nvmem->dev.of_node = config->of_node;
        else if (!config->no_of_node)
                nvmem->dev.of_node = config->dev->of_node;

So there's definitely a path (where both if's could be false) where
the DT node will not get set. I don't know if that path is possible
with the existing users of nvmem_register(), but it's definitely
possible.

> > So it's a mess of multiple devices pointing to the same DT node with
> > no clear way to identify which ones will point to a DT node and which
> > ones will probe and which ones won't. In the future, we shouldn't
> > allow adding new compatible strings for partitions for which we don't
> > plan on adding nvmem drivers.
> >
> > Can you give the patch at the end of the email a shot? It should fix
> > the issue with this series and without this series. It just avoids
> > this whole mess by not creating useless platform device for
> > nvmem-cells compatible DT nodes.
>
> Thanks a lot for your help.

No problem. I want fw_devlink to work for everyone.

> >
> > Thanks,
> > Saravana
> >
> > diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> > index d442fa94c872..88a213f4d651 100644
> > --- a/drivers/mtd/mtdpart.c
> > +++ b/drivers/mtd/mtdpart.c
> > @@ -577,6 +577,7 @@ static int mtd_part_of_parse(struct mtd_info *master,
> >  {
> >         struct mtd_part_parser *parser;
> >         struct device_node *np;
> > +       struct device_node *child;
> >         struct property *prop;
> >         struct device *dev;
> >         const char *compat;
> > @@ -594,6 +595,10 @@ static int mtd_part_of_parse(struct mtd_info *master,
> >         else
> >                 np = of_get_child_by_name(np, "partitions");
> >
> > +       for_each_child_of_node(np, child)
> > +               if (of_device_is_compatible(child, "nvmem-cells"))
> > +                       of_node_set_flag(child, OF_POPULATED);
>
> What about a comment explaining why we need that in the final patch
> (with a comment)? Otherwise it's a little bit obscure.

This wasn't meant to be reviewed :) Just a quick patch to make sure
I'm going down the right path. Once Maxim confirms I was going to roll
this into a proper patch.

But point noted. Will add a comment.

Thanks,
Saravana

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
  2023-02-06 20:08                   ` Saravana Kannan
@ 2023-02-24 14:46                     ` Miquel Raynal
  -1 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-02-24 14:46 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

Hi Saravana,

> > > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > > it doesn't get word wrapped by your email client. And please point me
> > > > > to the .dts that corresponds to your board. Without that, I can't
> > > > > debug much.  
> > > >
> > > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > > added the kernel log and the dts file to the attachment of this email.  
> > >
> > > Ah, so your device is not supported/present upstream? Even though it's
> > > not upstream, I'll help fix this because it should fix what I believe
> > > are unreported issues in upstream.
> > >
> > > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > > patch didn't help.
> > >
> > > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > > interaction is kind of a mess.  
> >
> > nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
> > cannot really re-wire without breaking users, so nvmem on top of mtd
> > of course inherit from the fragile designs in place.  
> 
> Thanks for the context. Yeah, I figured. That's why I explicitly
> limited my comment to "interaction". Although, I'd love to see the MTD
> parsers all be converted to proper drivers that probe. MTD is
> essentially repeating the driver matching logic. I think it can be
> cleaned up to move to proper drivers and still not break backward
> compatibility. Not saying it'll be trivial, but it should be possible.
> Ironically MTD uses mtd_class but has real drivers that work on the
> device (compared to nvmem_bus below).
> 
> > > mtd core creates "partition" platform
> > > devices (including for nvmem-cells) that are probed by drivers in
> > > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > > platform device. However, the nvmem core creates nvmem_device when
> > > nvmem_register() is called by MTD or these partition platform devices
> > > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > > the bus has no means to even register a driver (it should really be a
> > > nvmem_class and not nvmem_bus).  
> >
> > Srinivas, do you think we could change this?  
> 
> Yeah, this part gets a bit tricky. It depends on whether the sysfs
> files for nvmem devices is considered an ABI. Changing from bus to
> class would change the sysfs path for nvmem devices from:
> /sys/class/nvmem to /sys/bus/nvmem

Ok, so this is a no :)

> > > And the nvmem_device sometimes points
> > > to the DT node of the MTD device or sometimes the partition platform
> > > devices or maybe no DT node at all.  
> >
> > I guess this comes from the fact that this is not strongly defined in
> > mtd and depends on the situation (not mentioning 20 years of history
> > there as well). "mtd" is a bit inconsistent on what it means. Older
> > designs mixed: controllers, ECC engines when relevant and memories;
> > while these three components are completely separated. Hence
> > sometimes the mtd device ends up being the top level controller,
> > sometimes it's just one partition...
> >
> > But I'm surprised not all of them point to a DT node. Could you show us
> > an example? Because that might likely be unexpected (or perhaps I am
> > missing something).  
> 
> Well, the logic that sets the DT node for nvmem_device is like so:
> 
>         if (config->of_node)
>                 nvmem->dev.of_node = config->of_node;
>         else if (!config->no_of_node)
>                 nvmem->dev.of_node = config->dev->of_node;
> 
> So there's definitely a path (where both if's could be false) where
> the DT node will not get set. I don't know if that path is possible
> with the existing users of nvmem_register(), but it's definitely
> possible.

It's an actual path. I just checked more in details, this is the change
from 2018 which uses the no_of_node flag:
c4dfa25ab307 ("mtd: add support for reading MTD devices via the nvmem API")

It basically allows any mtd device to be accessible (read-only) through
nvmem. So mtd partitions or such which are not described in the DT may
just be accessed through nvmem (that is my current understanding).

There was later a patch in 2021 which prevented this flag to be
automatically set, so that if partitions (well, mtd devices in general)
were described in the DT, they would provide a valid of_node in order
to be used as cell providers (again, my understanding):
658c4448bbbf ("mtd: core: add nvmem-cells compatible to parse mtd as nvmem cells")

But I guess the major problem comes from the nvmem-cell compatible. I
am wondering if it would make sense to kind of transpose the meaning of
this compatible into a property. But, well, backward compatibility
would still be a problem I guess...

> > > So it's a mess of multiple devices pointing to the same DT node with
> > > no clear way to identify which ones will point to a DT node and which
> > > ones will probe and which ones won't. In the future, we shouldn't
> > > allow adding new compatible strings for partitions for which we don't
> > > plan on adding nvmem drivers.
> > >
> > > Can you give the patch at the end of the email a shot? It should fix
> > > the issue with this series and without this series. It just avoids
> > > this whole mess by not creating useless platform device for
> > > nvmem-cells compatible DT nodes.  
> >
> > Thanks a lot for your help.  
> 
> No problem. I want fw_devlink to work for everyone.
> 

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 146+ messages in thread

* Re: [PATCH v2 00/11] fw_devlink improvements
@ 2023-02-24 14:46                     ` Miquel Raynal
  0 siblings, 0 replies; 146+ messages in thread
From: Miquel Raynal @ 2023-02-24 14:46 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Maxim Kiselev, Sudeep Holla, Naresh Kamboju, abel.vesa,
	alexander.stein, andriy.shevchenko, brgl, colin.foster,
	cristian.marussi, devicetree, dianders, djrscally,
	dmitry.baryshkov, festevam, fido_max, frowand.list,
	geert+renesas, geert, gregkh, heikki.krogerus, jpb, jstultz,
	kernel-team, kernel, lenb, linus.walleij, linux-acpi,
	linux-arm-kernel, linux-gpio, linux-imx, linux-kernel,
	linux-renesas-soc, linux, lkft, luca.weiss, magnus.damm,
	martin.kepplinger, maz, rafael, robh+dt, s.hauer, sakari.ailus,
	shawnguo, tglx, tony, Srinivas Kandagatla

Hi Saravana,

> > > > > So, can you please retest config 1 with all pr_debug and dev_dbg in
> > > > > drivers/core/base.c changed to the _info variants? And then share the
> > > > > kernel log from the beginning of boot? Maybe attach it to the email so
> > > > > it doesn't get word wrapped by your email client. And please point me
> > > > > to the .dts that corresponds to your board. Without that, I can't
> > > > > debug much.  
> > > >
> > > > Ok, I retested config 1 with all _debug logs changed to the _info. I
> > > > added the kernel log and the dts file to the attachment of this email.  
> > >
> > > Ah, so your device is not supported/present upstream? Even though it's
> > > not upstream, I'll help fix this because it should fix what I believe
> > > are unreported issues in upstream.
> > >
> > > Ok I know why configs 1 - 4 behaved the way they did and why my test
> > > patch didn't help.
> > >
> > > After staring at mtd/nvmem code for a few hours I think mtd/nvmem
> > > interaction is kind of a mess.  
> >
> > nvmem is a recent subsystem but mtd carries a lot of legacy stuff we
> > cannot really re-wire without breaking users, so nvmem on top of mtd
> > of course inherit from the fragile designs in place.  
> 
> Thanks for the context. Yeah, I figured. That's why I explicitly
> limited my comment to "interaction". Although, I'd love to see the MTD
> parsers all be converted to proper drivers that probe. MTD is
> essentially repeating the driver matching logic. I think it can be
> cleaned up to move to proper drivers and still not break backward
> compatibility. Not saying it'll be trivial, but it should be possible.
> Ironically MTD uses mtd_class but has real drivers that work on the
> device (compared to nvmem_bus below).
> 
> > > mtd core creates "partition" platform
> > > devices (including for nvmem-cells) that are probed by drivers in
> > > drivers/nvmem. However, there's no driver for "nvmem-cells" partition
> > > platform device. However, the nvmem core creates nvmem_device when
> > > nvmem_register() is called by MTD or these partition platform devices
> > > created by MTD. But these nvmem_devices are added to a nvmem_bus but
> > > the bus has no means to even register a driver (it should really be a
> > > nvmem_class and not nvmem_bus).  
> >
> > Srinivas, do you think we could change this?  
> 
> Yeah, this part gets a bit tricky. It depends on whether the sysfs
> files for nvmem devices is considered an ABI. Changing from bus to
> class would change the sysfs path for nvmem devices from:
> /sys/class/nvmem to /sys/bus/nvmem

Ok, so this is a no :)

> > > And the nvmem_device sometimes points
> > > to the DT node of the MTD device or sometimes the partition platform
> > > devices or maybe no DT node at all.  
> >
> > I guess this comes from the fact that this is not strongly defined in
> > mtd and depends on the situation (not mentioning 20 years of history
> > there as well). "mtd" is a bit inconsistent on what it means. Older
> > designs mixed: controllers, ECC engines when relevant and memories;
> > while these three components are completely separated. Hence
> > sometimes the mtd device ends up being the top level controller,
> > sometimes it's just one partition...
> >
> > But I'm surprised not all of them point to a DT node. Could you show us
> > an example? Because that might likely be unexpected (or perhaps I am
> > missing something).  
> 
> Well, the logic that sets the DT node for nvmem_device is like so:
> 
>         if (config->of_node)
>                 nvmem->dev.of_node = config->of_node;
>         else if (!config->no_of_node)
>                 nvmem->dev.of_node = config->dev->of_node;
> 
> So there's definitely a path (where both if's could be false) where
> the DT node will not get set. I don't know if that path is possible
> with the existing users of nvmem_register(), but it's definitely
> possible.

It's an actual path. I just checked more in details, this is the change
from 2018 which uses the no_of_node flag:
c4dfa25ab307 ("mtd: add support for reading MTD devices via the nvmem API")

It basically allows any mtd device to be accessible (read-only) through
nvmem. So mtd partitions or such which are not described in the DT may
just be accessed through nvmem (that is my current understanding).

There was later a patch in 2021 which prevented this flag to be
automatically set, so that if partitions (well, mtd devices in general)
were described in the DT, they would provide a valid of_node in order
to be used as cell providers (again, my understanding):
658c4448bbbf ("mtd: core: add nvmem-cells compatible to parse mtd as nvmem cells")

But I guess the major problem comes from the nvmem-cell compatible. I
am wondering if it would make sense to kind of transpose the meaning of
this compatible into a property. But, well, backward compatibility
would still be a problem I guess...

> > > So it's a mess of multiple devices pointing to the same DT node with
> > > no clear way to identify which ones will point to a DT node and which
> > > ones will probe and which ones won't. In the future, we shouldn't
> > > allow adding new compatible strings for partitions for which we don't
> > > plan on adding nvmem drivers.
> > >
> > > Can you give the patch at the end of the email a shot? It should fix
> > > the issue with this series and without this series. It just avoids
> > > this whole mess by not creating useless platform device for
> > > nvmem-cells compatible DT nodes.  
> >
> > Thanks a lot for your help.  
> 
> No problem. I want fw_devlink to work for everyone.
> 

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 146+ messages in thread

end of thread, other threads:[~2023-02-24 14:48 UTC | newest]

Thread overview: 146+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27  0:11 [PATCH v2 00/11] fw_devlink improvements Saravana Kannan
2023-01-27  0:11 ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 01/11] driver core: fw_devlink: Don't purge child fwnode's consumer links Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:21   ` Andy Shevchenko
2023-01-27  9:21     ` Andy Shevchenko
2023-01-28  7:33     ` Saravana Kannan
2023-01-28  7:33       ` Saravana Kannan
2023-01-30 12:04       ` Andy Shevchenko
2023-01-30 12:04         ` Andy Shevchenko
2023-01-27  0:11 ` [PATCH v2 02/11] driver core: fw_devlink: Improve check for fwnode with no device/driver Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 03/11] soc: renesas: Move away from using OF_POPULATED for fw_devlink Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  8:11   ` Geert Uytterhoeven
2023-01-27  8:11     ` Geert Uytterhoeven
2023-01-28  7:18     ` Saravana Kannan
2023-01-28  7:18       ` Saravana Kannan
2023-01-30  8:42       ` Geert Uytterhoeven
2023-01-30  8:42         ` Geert Uytterhoeven
2023-01-30 20:00         ` Saravana Kannan
2023-01-30 20:00           ` Saravana Kannan
2023-01-31  8:14           ` Geert Uytterhoeven
2023-01-31  8:14             ` Geert Uytterhoeven
2023-02-04 22:30             ` Saravana Kannan
2023-02-04 22:30               ` Saravana Kannan
2023-01-27  9:25   ` Andy Shevchenko
2023-01-27  9:25     ` Andy Shevchenko
2023-01-27  9:30     ` Geert Uytterhoeven
2023-01-27  9:30       ` Geert Uytterhoeven
2023-01-27  9:44       ` Andy Shevchenko
2023-01-27  9:44         ` Andy Shevchenko
2023-01-27  0:11 ` [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:27   ` Andy Shevchenko
2023-01-27  9:27     ` Andy Shevchenko
2023-01-28  7:33     ` Saravana Kannan
2023-01-28  7:33       ` Saravana Kannan
2023-01-30 12:05       ` Andy Shevchenko
2023-01-30 12:05         ` Andy Shevchenko
2023-01-30 14:31   ` Sudeep Holla
2023-01-30 14:31     ` Sudeep Holla
2023-01-30 15:14     ` Andy Shevchenko
2023-01-30 15:14       ` Andy Shevchenko
2023-01-31  4:01       ` Saravana Kannan
2023-01-31  4:01         ` Saravana Kannan
2023-01-31 10:13         ` Sudeep Holla
2023-01-31 10:13           ` Sudeep Holla
2023-02-04 22:32           ` Saravana Kannan
2023-02-04 22:32             ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 05/11] driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:29   ` Andy Shevchenko
2023-01-27  9:29     ` Andy Shevchenko
2023-01-27  9:30     ` Andy Shevchenko
2023-01-27  9:30       ` Andy Shevchenko
2023-01-27  9:55     ` Geert Uytterhoeven
2023-01-27  9:55       ` Geert Uytterhoeven
2023-01-28  7:34     ` Saravana Kannan
2023-01-28  7:34       ` Saravana Kannan
2023-01-30 12:08       ` Andy Shevchenko
2023-01-30 12:08         ` Andy Shevchenko
2023-01-27  0:11 ` [PATCH v2 06/11] driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:33   ` Andy Shevchenko
2023-01-27  9:33     ` Andy Shevchenko
2023-01-28  7:34     ` Saravana Kannan
2023-01-28  7:34       ` Saravana Kannan
2023-01-30 12:09       ` Andy Shevchenko
2023-01-30 12:09         ` Andy Shevchenko
2023-01-27  0:11 ` [PATCH v2 07/11] driver core: fw_devlink: Consolidate device link flag computation Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 08/11] driver core: fw_devlink: Make cycle detection more robust Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:43   ` Andy Shevchenko
2023-01-27  9:43     ` Andy Shevchenko
2023-01-27  9:52     ` Geert Uytterhoeven
2023-01-27  9:52       ` Geert Uytterhoeven
2023-01-27 10:10       ` Andy Shevchenko
2023-01-27 10:10         ` Andy Shevchenko
2023-01-27 10:29         ` Geert Uytterhoeven
2023-01-27 10:29           ` Geert Uytterhoeven
2023-01-28  7:34     ` Saravana Kannan
2023-01-28  7:34       ` Saravana Kannan
2023-01-30 12:15       ` Andy Shevchenko
2023-01-30 12:15         ` Andy Shevchenko
2023-01-30 14:36         ` Geert Uytterhoeven
2023-01-30 14:36           ` Geert Uytterhoeven
2023-01-30 15:16           ` Andy Shevchenko
2023-01-30 15:16             ` Andy Shevchenko
2023-01-27  0:11 ` [PATCH v2 09/11] of: property: Simplify of_link_to_phandle() Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-30 14:39   ` Sakari Ailus
2023-01-30 14:39     ` Sakari Ailus
2023-01-31  3:51     ` Saravana Kannan
2023-01-31  3:51       ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 10/11] irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:51   ` Andy Shevchenko
2023-01-27  9:51     ` Andy Shevchenko
2023-01-28  7:34     ` Saravana Kannan
2023-01-28  7:34       ` Saravana Kannan
2023-01-27  0:11 ` [PATCH v2 11/11] firmware: arm_scmi: Set fwnode for the scmi_device Saravana Kannan
2023-01-27  0:11   ` Saravana Kannan
2023-01-27  9:52   ` Andy Shevchenko
2023-01-27  9:52     ` Andy Shevchenko
2023-01-27 10:48   ` Sudeep Holla
2023-01-27 10:48     ` Sudeep Holla
2023-01-27 20:30 ` [PATCH v2 00/11] fw_devlink improvements Colin Foster
2023-01-27 20:30   ` Colin Foster
2023-01-27 21:35   ` Saravana Kannan
2023-01-27 21:35     ` Saravana Kannan
2023-01-30  8:55 ` Naresh Kamboju
2023-01-30  8:55   ` Naresh Kamboju
2023-01-30 10:49   ` Marc Zyngier
2023-01-30 10:49     ` Marc Zyngier
2023-01-30 23:03   ` Saravana Kannan
2023-01-30 23:03     ` Saravana Kannan
2023-01-31 10:18     ` Sudeep Holla
2023-01-31 10:18       ` Sudeep Holla
2023-02-02 17:36       ` Maxim Kiselev
2023-02-02 17:36         ` Maxim Kiselev
2023-02-03  6:07         ` Saravana Kannan
2023-02-03  6:07           ` Saravana Kannan
2023-02-03  9:39           ` Maxim Kiselev
2023-02-03  9:39             ` Maxim Kiselev
2023-02-06  1:32             ` Saravana Kannan
2023-02-06  1:32               ` Saravana Kannan
2023-02-06  2:17               ` Saravana Kannan
2023-02-06  2:17                 ` Saravana Kannan
2023-02-06  9:39               ` Miquel Raynal
2023-02-06  9:39                 ` Miquel Raynal
2023-02-06 20:08                 ` Saravana Kannan
2023-02-06 20:08                   ` Saravana Kannan
2023-02-24 14:46                   ` Miquel Raynal
2023-02-24 14:46                     ` Miquel Raynal
2023-02-06 15:18               ` Rob Herring
2023-02-06 15:18                 ` Rob Herring
2023-02-06 19:59                 ` Saravana Kannan
2023-02-06 19:59                   ` Saravana Kannan
2023-01-30 10:48 ` Miquel Raynal
2023-01-30 10:48   ` Miquel Raynal
2023-01-30 12:08   ` Maxim Kiselev
2023-01-30 12:08     ` Maxim Kiselev
2023-01-31  1:20     ` Saravana Kannan
2023-01-31  1:20       ` Saravana Kannan

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.