Netdev List
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Daniel Scally <djrscally@gmail.com>,
	 Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	Len Brown <lenb@kernel.org>,  Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	 Russell King <linux@armlinux.org.uk>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Christian Marangi <ansuelsmth@gmail.com>
Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	 linux-acpi@vger.kernel.org, netdev@vger.kernel.org,
	 James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH net-next v3 0/4] driver core, net: handle fw_devlink for class devices and PHY packages
Date: Tue, 18 Aug 2026 00:58:56 -0600	[thread overview]
Message-ID: <20260818-submit-phy-package-fwdevlink-v1-v3-0-40a905ea16b6@gmail.com> (raw)

Managed device links normally advance through probe and removal alongside
a device driver. Driverless class devices are added directly, so their
links do not currently receive equivalent transitions. A class supplier
can leave its consumers dormant, while sync-state-only links from a class
consumer can indefinitely prevent suppliers from receiving sync_state().
Removal also does not unbind consumers of a class supplier.

Ethernet PHY packages expose both sides of this problem. A package node
describes resources shared by member PHYs, but is a container rather than
a device. fw_devlink preserves that topology and temporarily represents
those dependencies through the closest device, which for OF MDIO is the
driverless MDIO bus class device. Its proxy links previously remained
after the real PHY had probed and kept the package suppliers from reaching
sync_state().

Handle the generic class-device lifecycle in the driver core. Put
driverless class devices into the probing state while device_add()
publishes them, complete their incoming and outgoing managed links after
class interfaces run, and apply the corresponding unbind and cleanup
transitions during device_del(). This supports class devices as either
suppliers or consumers and keeps descendant firmware links available for
devices created later. Keep inferred links to probing and registered class
suppliers out of no-driver fallback paths, and recognize class-backed
nodes when refreshing dependencies after firmware-tree overlays.

Keep generic firmware parsing faithful to the described topology. Add a
helper through which a subsystem can copy a container node's direct
supplier links onto the firmware node for a real child device, then use it
from PHY registration before device_add(). The ordinary fw_devlink path
consequently creates each managed PHY link at the normal
device-registration stage.

Finally, defer supplier sync-state callbacks across OF MDIO bus
registration and child population. This closes the interval between
completion of the bus class device and installation of the member PHY
links without adding an MDIO-specific device-link state transition.

This was found while validating an X-Powers AC300 package whose input
clock is supplied by PWM. Before the fix, the PWM driver reported that
sync_state() was pending due to stmmac-0 after the PHY had probed.

The complete series was tested on an Allwinner H616 board with an X-Powers
AC300 PHY package. All five package-derived supplier links targeted the
member PHY and no proxy link remained on the driverless MDIO bus. The PWM
supplier reached state_synced while continuing to generate the PHY clock.
These properties remained true after unbinding and rebinding the MAC, and
the PHY renegotiated a 100 Mbps full-duplex link. Both before and after
that lifecycle test, 8 MiB transfers in each direction compared correctly
and 100 consecutive pings completed without loss.

Validation also included:

  - a full arm64 defconfig Image and modules build with W=1;
  - KUnit tests for class supplier/consumer transitions, inferred-link
    preservation, and fwnode supplier copying and device-link conversion;
    and
  - strict per-patch checkpatch and whitespace checks.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes in v3:
- Replace the framework-specific proxy cleanup with generic managed-link
  lifecycle handling for driverless class suppliers and consumers, as
  suggested by Saravana Kannan
- Handle registered class consumers during supplier teardown without a
  no-op driver release or driver-only cleanup warning
- Derive class handling inside the shared bound helpers and clarify the
  lifecycle documentation
- Keep inferred links to probing and registered class suppliers out of
  no-driver fallback paths and include class nodes in overlay refresh
- Keep firmware parsing topology-only and let the PHY layer project package
  suppliers onto member PHYs through a new fwnode-link copy helper, as
  suggested by Saravana Kannan
- Defer supplier sync across MDIO bus and OF child population instead of
  deleting proxy links from the MDIO framework
- Add driver-core KUnit coverage and device-link lifecycle documentation
- Drop the unrelated malformed-graph guard because no concrete DT or
  runtime reproducer was found
- Rebase on current net-next/main
- Link to v2: https://patch.msgid.link/20260816-submit-phy-package-fwdevlink-v1-v2-0-23e55dd59fad@gmail.com

Changes in v2:
- Add a preparatory guard for malformed graph consumers
  (reported by Sashiko)
- Rebase on net-next/main
- Link to v1: https://patch.msgid.link/20260814-submit-phy-package-fwdevlink-v1-v1-0-2319844f057a@gmail.com

---
James Hilliard (4):
      driver core: add fw_devlink supplier-copy helper
      net: mdio: link PHY package suppliers to member PHYs
      net: mdio: defer supplier sync during OF population
      driver core: handle managed links for class devices

 Documentation/driver-api/device_link.rst   |  47 ++-
 drivers/base/base.h                        |   2 +
 drivers/base/core.c                        | 332 +++++++++++++++-----
 drivers/base/dd.c                          |  21 +-
 drivers/base/test/Makefile                 |   2 +
 drivers/base/test/device-link-class-test.c | 479 +++++++++++++++++++++++++++++
 drivers/base/test/fwnode-link-test.c       | 207 +++++++++++++
 drivers/net/mdio/of_mdio.c                 |  34 +-
 include/linux/device.h                     |   9 +-
 include/linux/fwnode.h                     |   2 +
 10 files changed, 1042 insertions(+), 93 deletions(-)
---
base-commit: 47226bbdef69fc0de815b8f5b81b39673f50bbee
change-id: 20260814-submit-phy-package-fwdevlink-v1-76a8f9efe539

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


             reply	other threads:[~2026-08-18  6:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  6:58 James Hilliard [this message]
2026-08-18  6:58 ` [PATCH net-next v3 1/4] driver core: add fw_devlink supplier-copy helper James Hilliard
2026-08-18  7:30   ` Andy Shevchenko
2026-08-18  6:58 ` [PATCH net-next v3 2/4] net: mdio: link PHY package suppliers to member PHYs James Hilliard
2026-08-18  7:39   ` Andy Shevchenko
2026-08-18  6:58 ` [PATCH net-next v3 3/4] net: mdio: defer supplier sync during OF population James Hilliard
2026-08-18  6:59 ` [PATCH net-next v3 4/4] driver core: handle managed links for class devices James Hilliard
2026-08-18  7:48   ` Andy Shevchenko
2026-08-18  7:15 ` [PATCH net-next v3 0/4] driver core, net: handle fw_devlink for class devices and PHY packages Andy Shevchenko

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=20260818-submit-phy-package-fwdevlink-v1-v3-0-40a905ea16b6@gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ansuelsmth@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=djrscally@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=saravanak@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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