From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Michael Pratt <mcpratt@pm.me>
Cc: devicetree@vger.kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
saravanak@google.com, abel.vesa@linaro.org,
alexander.stein@ew.tq-group.com,
andriy.shevchenko@linux.intel.com, bigunclemax@gmail.com,
brgl@bgdev.pl, colin.foster@in-advantage.com,
djrscally@gmail.com, dmitry.baryshkov@linaro.org,
festevam@gmail.com, fido_max@inbox.ru, frowand.list@gmail.com,
geert@linux-m68k.org, heikki.krogerus@linux.intel.com,
kernel@pengutronix.de, linus.walleij@linaro.org,
linux@roeck-us.net, luca.weiss@fairphone.com,
magnus.damm@gmail.com, martin.kepplinger@puri.sm,
rafal@milecki.pl, ansuelsmth@gmail.com, richard@nod.at,
sakari.ailus@linux.intel.com, sudeep.holla@arm.com,
tglx@linutronix.de, tony@atomide.com, vigneshr@ti.com,
dianders@chromium.org, jpb@kernel.org, rafael@kernel.org
Subject: Re: [PATCH v1 2/4] driver core: fw_devlink: Link to supplier ancestor if no device
Date: Mon, 5 Feb 2024 16:00:11 +0100 [thread overview]
Message-ID: <20240205160011.42d1cf80@xps-13> (raw)
In-Reply-To: <20240123014517.5787-3-mcpratt@pm.me>
Hi Michael,
First, I want to say, this is a great job as fw_devlinks in mtd and
nvmem are really not easy to handle. I am willing to help, despite my
very light understanding of what the core actually does with these
flags.
mcpratt@pm.me wrote on Tue, 23 Jan 2024 01:46:40 +0000:
> Driver core currently supports linking to the next parent fwnode,
> but is not yet handling cases where that parent
> is also a firmware child node not representing a real device,
> which can lead to an indefinite deferred probe in some cases.
> In this case, the fwnode that should actually be linked to
> is multiple ancestors up which presents a challenge where
> it is unknown how many ancestors up the node that
> represents the real probing device is. This makes the usage of
> fwnode_get_next_parent_dev() insufficient because the real device's
> fwnode may or may not be an ancestor of the next parent fwnode as well.
>
> Introduce flag FWNODE_FLAG_PARENT_IS_DEV
> in order to mark child firmware nodes of a device
> as having a parent device that can probe.
>
> Allow fwnode link creation to the original supplier fwnode's ancestors
> when the original supplier fwnode and any fwnodes in between are flagged
> as FWNODE_FLAG_NOT_DEVICE and/or FWNODE_FLAG_PARENT_IS_DEV
> with a new function __fwnode_link_add_parents() which then creates
> the fwnode link to a real device that provides the supplier's function.
>
> This depends on other functions to label a supplier fwnode
> as not a real device, which must be done before the fwnode links
> are created, and if after that, relevant links to the supplier
> would have to be deleted and have links recreated, otherwise,
> the fwnode link would be dropped before the device link is attempted
> or a fwnode link would not be able to become a device link at all,
> because they were created before these fwnode flags can have any effect.
>
> It also depends on the supplier device to actually probe first
> in order to have the fwnode flags in place to know for certain
> which fwnodes are non-probing child nodes
> of the fwnode for the supplier device.
>
> The use case of function __fw_devlink_pickup_dangling_consumers()
> is designed so that the parameters are always a supplier fwnode
> and one of it's parent fwnodes, so it is safer to assume and more specific
> that the flag PARENT_IS_DEV should be added there, rather than
> declaring the original supplier fwnode as NOT_DEVICE at that point.
> Because this function is called when the real supplier device probes
> and recursively calls itself for all child nodes of the device's fwnode,
> set the new flag here in order to let it propagate down
> to all descendant nodes, thereby providing the info needed later
> in order to link to the proper fwnode representing the supplier device.
>
> If a fwnode is flagged as FWNODE_FLAG_NOT_DEVICE
> by the time a device link is to be made with it,
> but not flagged as FWNODE_FLAG_PARENT_IS_DEV,
> the link is dropped, otherwise the device link
> is still made with the original supplier fwnode.
> Theoretically, we can also handle linking to an ancestor
> of the supplier fwnode when forming device links, but there
> are still cases where the necessary fwnode flags are still missing
> because the real supplier device did not probe yet.
I am not sure I follow this. In the following case, I would expect any
dependency towards node-c to be made against node-a. But the above
paragraph seems to tell otherwise: that the the link would be dropped
(and thus, not enforced) because recursively searching for a parent
that would be a device could be endless? It feels wrong, so I probably
mis
node-a {
# IS DEV
node-b {
# PARENT IS DEV
node-c {
# PARENT IS DEV
};
};
};
Besides that, the commit feels like a good idea.
Thanks,
Miquèl
next prev parent reply other threads:[~2024-02-05 15:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 1:45 [PATCH v1 0/4] fw_devlink: generically handle bad links to child fwnodes Michael Pratt
2024-01-23 1:46 ` [PATCH v1 1/4] driver core: fw_devlink: Use driver to determine probe ability Michael Pratt
2024-02-14 3:18 ` Saravana Kannan
2024-01-23 1:46 ` [PATCH v1 2/4] driver core: fw_devlink: Link to supplier ancestor if no device Michael Pratt
2024-02-05 15:00 ` Miquel Raynal [this message]
2024-02-25 20:16 ` Michael Pratt
2024-02-05 19:25 ` Saravana Kannan
2024-02-14 3:18 ` Saravana Kannan
2024-02-25 20:37 ` Michael Pratt
2024-01-23 1:47 ` [PATCH v1 3/4] driver core: fw_devlink: Add function device_links_fixup_suppliers() Michael Pratt
2024-01-23 1:47 ` [PATCH v1 4/4] mtd: mtdpart: Allow fwnode links to NVMEM compatible fwnodes Michael Pratt
2024-02-05 15:11 ` Miquel Raynal
2024-02-25 17:35 ` Michael Pratt
2024-02-05 20:06 ` [PATCH v1 0/4] fw_devlink: generically handle bad links to child fwnodes Saravana Kannan
2024-02-14 3:28 ` Saravana Kannan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240205160011.42d1cf80@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=abel.vesa@linaro.org \
--cc=alexander.stein@ew.tq-group.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ansuelsmth@gmail.com \
--cc=bigunclemax@gmail.com \
--cc=brgl@bgdev.pl \
--cc=colin.foster@in-advantage.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=djrscally@gmail.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=festevam@gmail.com \
--cc=fido_max@inbox.ru \
--cc=frowand.list@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jpb@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=luca.weiss@fairphone.com \
--cc=magnus.damm@gmail.com \
--cc=martin.kepplinger@puri.sm \
--cc=mcpratt@pm.me \
--cc=rafael@kernel.org \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=sakari.ailus@linux.intel.com \
--cc=saravanak@google.com \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).