dpll/ice: Add generic DPLL type and full TX reference clock control for E825
Subsystems (5)
v14 cover dpll/ice: Add generic DPLL type and full TX reference clock control for E825
NOTE: This series is intentionally submitted on net-next (not intel-wired-lan) as early feedback of DPLL subsystem changes is welcomed. In the past possible approaches were discussed in [1].
This series adds TX reference clock support for E825 devices and exposes TX clock selection and synchronization status via the Linux DPLL subsystem.
Here is the high-level connection diagram for E825 device:
+------------------------------------------------------------------+ | | | +-----------------------------+ | | | | | | | MAC | | | |+------------+-----+ | | | ||RX/1588 |PHC|tspll<----\ | | +---+----+ ||MUX +---+-^---| | | | | E | RX >---------------------> | >--\ | | | | T | | /----------------> | >-\| | | | | H |----+ | |+---------+----^---+ || | | | | 1 | TX <----|----------------+TX MUX < OCXO | || | | | | |PLL | | || |--------| || | | | +---+----+ | /----+ <-ext_ref<-||-|----|------ext_ref | E | RX >----/ | || |--------+ || | | | | T | | | || < SyncE | || | | | | H |----+ | |+-----------^------+ || | | | | 2 | TX <----------------/ | | /------||-/ | | | |PLL | +------------|-|------||------+ | +---+----+ /--/ | || | | . | RX >--- | | || | | . | | +----------|----|------||--+ | | . |----+ | +-^-+--^+ || | | | | TX <--- | |EEC|PPS| || | | | |PLL | | +-------+ || | | +---+----+ | | <-CLK0/| | | | E | RX >--- | | DPLL | | | | | T | | | | <-CLK1-/ | | | H |----+ | | | | | | X | TX <--- | | <---SMA---< | | |PLL | | | | | | +---+----+ | | <---GPS---< | | | | | | | | | | <---...---< | | | | | | | | | +-------+ | | | | External timing module | | | +--------------------------+ | +------------------------------------------------------------------+
E825 hardware contains a dedicated TX clock domain with per-port source selection behavior that is distinct from PPS handling and from board-level EEC distribution. TX reference clock selection is device-wide, shared across ports, and mediated by firmware as part of link bring-up. As a result, TX clock selection intent may differ from effective hardware configuration, and software must verify outcome after link-up.
To support this, the series extends the DPLL core and the ice driver incrementally. The series also introduces DPLL_TYPE_GENERIC as a broad UAPI class for DPLL instances outside PPS/EEC categories. The intent is to keep type naming reusable and scalable across different ASIC topologies while preserving functional discoverability via driver/device context and pin topology.
This follows netdev discussion guidance that UAPI type naming should avoid location-specific or vendor-specific taxonomy, because such labels do not scale across different ASIC designs. The function of a given DPLL instance is already discoverable from driver/device context and pin topology, and does not require an additional narrow type identifier in UAPI.
At the same time, a separate DPLL object is still needed for E825 TX clock control/reporting semantics. Using DPLL_TYPE_GENERIC provides a reusable class for devices outside PPS/EEC without overfitting UAPI naming to one topology.
The relevant discussion is in [2].
Series content
- add a new generic DPLL type for devices outside PPS/EEC classes;
- relax DPLL pin registration rules for firmware-described shared pins and extend pin notifications with a source identifier;
- allow dynamic state control of SyncE reference pins where hardware supports it;
- add CPI infrastructure for PHY-side TX clock control on E825C;
- introduce a TX-clock DPLL device and TX reference clock pins (EXT_EREF0 and SYNCE) in the ice driver;
- extend the Restart Auto-Negotiation command to carry a TX reference clock index;
- implement hardware-backed TX reference clock switching, post-link verification, and TX synchronization reporting.
TXCLK pins report TX reference topology only. Actual synchronization success is reported via DPLL lock status, updated after hardware
verification: external TX references report LOCKED, while the internal ENET/TXCO source reports UNLOCKED.
This provides reliable TX reference selection and observability on E825 devices using standard DPLL interfaces, without conflating user intent with effective hardware behavior.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
Changes in v14:
- rebased
- addressed AI review comments:
Two new dpll fixes inserted, shifting old 06-11 to 08-13.
* 06/13 (new) "dpll: guard sync-pair removal on full pin unregister":
dpll_pin_ref_sync_pair_del() now runs only when the last registration is torn down.
* 07/13 (new) "dpll: balance create/delete notifications in __dpll_pin_(un)register": emit dpll_pin_delete_ntf() inside __dpll_pin_unregister(), drop the redundant wrapper call.
* 11/13 "ice: implement CPI support for E825C": init ports_per_phy / port_num when ICE_FLAG_PTP_SUPPORTED is clear, fixing div-by-zero on DPLL-only E825 configs.
* 13/13 "ice: implement E825 TX ref clock control and TXC hardware":
* drop txclk_notify_rwsem from ice_dpll_txclk_state_on_dpll_set() (removes AB-BA with dpll_lock);
* ice_txclk_set_clk(): bail with -EOPNOTSUPP when ctrl PF DPLL unavailable;
* clear txclk_switch_requested after the AN restart AQ, not before (race with link-up).
Changes in v13:
- rebased
- addressed AI review comments:
New dpll-core fixes (prerequisites for the ice patches; surfaced under rmmod/rebind with zl3073x sharing the fwnode RCLK parent):
* 3/11 dpll: fix stale iteration in dpll_pin_on_pin_unregister(). Walk pin->dpll_refs and filter by dpll_pin_registration_find(cookie=parent); both parent->dpll_refs and an unfiltered pin->dpll_refs are unsafe when another driver (un)registers the parent against more DPLLs after the child was attached, leaving WARN_ON(!reg) and dangling registrations.
* 4/11 dpll: send delete notification before unregister in on-pin rollback. Otherwise the last unregister clears DPLL_REGISTERED and the notification fails dpll_pin_available() with -ENODEV.
* 5/11 dpll: emit per-dpll delete notifications in dpll_pin_on_pin_unregister(). Register emits N creates over parent->dpll_refs; unregister now emits N matching deletes.
Fix possible deadlock on flush_workqueue() on error path:
* 8/11 (was 5/8) ice: introduce TXC DPLL device...: signal pf->dplls.dpll_init from the error path of ice_dpll_init_fwnode_pins() so a notifier worker blocked on it can drain, avoiding a flush_workqueue() deadlock during teardown.
- Renumbered v12 3-4/8 and 6-8/8; rebased on net-next; no functional change in those.
Changes in v12:
- rebased
- rename the second parameter of ice_cpi_ena_dis_clk_ref() from "port" to "phy"; the value is a PHY index, not a port number (patch 6/8)
- Addressed AI review concerns (patch 8/8):
- Close UAF on rmmod in ice_dpll_txclk_state_on_dpll_set(): hold
pf->dplls.txclk_notify_rwsem for read and gate on ICE_FLAG_DPLL
under pf->dplls.lock so a late netlink set call cannot queue
txclk_work after cancel_work_sync() and touch freed pins. - ice_dpll_deinit_txclk_pins(): NULL the EREF pin slot after ice_dpll_release_pins() (the SYNCE path already does this via ice_dpll_release_fwnode_pin()), so ice_txclk_get_pin() cannot return a dangling pointer to late callers.
- ice_dpll_init_info_e825c(): seed dt->dpll_state from ice_txclk_lock_status(pf->ptp.port.tx_clk) so boards that boot with SYNCE or EREF0 already selected report LOCKED at probe instead of staying UNLOCKED until the next switch.
- ice_txclk_set_clk() and ice_txclk_enable_peer(): hold ctrl_pf->dplls.lock across the any_port_uses() check and the ice_cpi_ena_dis_clk_ref() enable AQ, closing the cross-PF check-then-act window that allowed duplicate enables.
- ice_txclk_set_clk(): clear pf->dplls.txclk_switch_requested before submitting the AN restart so the post-AN link-up running ice_txclk_update_and_notify() does not bail on a stale "switch still pending" check.
- ice_txclk_update_and_notify(): take ctrl_pf->dplls.lock (conditionally when ctrl_pf != pf) across the tx_refclks[phy][i] update loops per the documented order
pf->dplls.lock -> ctrl_pf->dplls.lock, so writers and readers on non-controlling PFs share a non-empty lockset.
Patches 1-5, 7: no functional change
Changes in v11:
- rebased
- changed 'opcode' argument type to u8 (patch 6/8)
- fixed white spaces (changed to TAB) in ice_cpi.h (patch 6/8)
- removed duplicated definition of ICE_E825_MAX_PHYS (patch 8/8)
Changes in v10:
- rebased
Addressed AI review (Sashiko) concerns (all in patch 8/8):
- moved INIT_WORK(txclk_work) and added init_rwsem(txclk_notify_rwsem) next to mutex_init(&d->lock) in ice_dpll_init_e825() so both are initialized before any path that can fail and trigger ice_dpll_deinit()
- added struct rw_semaphore txclk_notify_rwsem to struct ice_dplls and used it (down_read across the whole critical region of ice_txclk_update_and_notify(), including the out-of-lock dpll_*_change_ntf() calls; down_write/up_write barrier in ice_dpll_deinit() to drain in-flight notifiers before pins and the TXC DPLL device are freed) - closes a use-after-free window on rmmod
- ice_dpll_txclk_state_on_dpll_set(): reject pin states other than CONNECTED/DISCONNECTED with -EINVAL and NL_SET_ERR_MSG() instead of silently treating them as a connect request
- ice_dpll_txclk_work(): on a failed switch, capture old/new pin pointers under the lock and emit dpll_pin_change_ntf() after dropping it, so userspace sees the requested pin flip back to DISCONNECTED and the effective pin to CONNECTED
- ice_dpll_txclk_work(): only clear txclk_switch_requested / roll back tx_clk_req when no newer request arrived while the lock was dropped, so a re-queued worker run picks up the updated value
- ice_txclk_update_and_notify(): replaced the
pf->dplls.txc.dpll = ERR_PTR(-ENODEV) "suppress notification" hack with an explicit local bool notify_dpll; the dpll_state update and the notification decision are made under the lock, the notification itself is emitted after unlock
- ice_ptp_setup_pf(): seed the per-PHY Tx reference clock usage map only on E825 and explained the "no locking needed" invariant in a comment (runs before pf->dplls.lock exists and before any link event or DPLL callback can observe the map)
- moved port_num/phy and tx_ref_clk locals into the E825-only branches where they are actually used
- ice_txclk_enable_peer(): use ice_pf_to_dev(pf) for dev_err() to match the rest of the file (was ice_hw_to_dev(&pf->hw))
- extended ctrl_pf->dplls.lock coverage in ice_txclk_set_clk() and ice_txclk_enable_peer() across both the usage check and the ice_cpi_ena_dis_clk_ref() AQ command so two PFs racing to switch to the same (phy, clk) cannot both observe clk_in_use == false and issue duplicate enables
Other:
- replaced ternary-for-statement-effect (`(clk == i) ? set_bit() :
clear_bit();`) with plain if/else in the two tx_refclks bitmap loops
- dropped 15 unused CFG_*/CFG_RESERVED* SERDES field defines in ice_ptp_hw.h; kept only CFG_ICTL_PCS_REF_SEL_RX_NT, CFG_ICTL_PCS_REF_SEL_TX_NT and REF_SEL_NT_ENET/EREF0/SYNCE which are actually consumed
- updated kernel-doc for struct ice_dpll
Patch 7/8:
- cosmetic: removed a stray double space in the ice_aq_set_link_restart_an() prototype
Patches 1-6: unchanged
Changes in v9:
- rebased
- fixed kernel-doc: member 'module_name' not described in 'dpll_pin' (patch 2/8) Addressed AI review concerns:
- reworded commit message to use 'src_clock_id' instead 'src_id' (patch 3/8)
- use rclk.num_parents when setting is_rclk_parent (patch 5/8)
- fixed retry mechanism in ice_cpi_wait_ack (patch 6/8)
- fixed txclk_switch_requested, tx_clk, tx_clk_req settings on HW failure (patch 8/8)
- use cancel_work_sync instead flush_work (patch 8/8)
- protect clearing ICE_FLAG_DPLL flag with mitex on DPLL
deinit (patch 8/8)
- dpll_state update and the notify_dpll decision are made inside the lock (patch 8/8)
Changes in v8:
- rebased
Addressed AI review concerns:
- caching the module name in the pin object at allocation time and using the cached string in netlink paths (patch 2/8)
- dropped references to netlink in the commit message for (patch 3/8, it's internal notification only)
- replaced the commit 4/8 with the new one (relax the capability check in dpll_pin_state_set)
- resolved potential teradown race between ice_dpll_deinit_txclk_pins and ice_dpll_pin_notify_work() that is about to register the SYNCE pin (patch 5/8)
- resolved potential path deadlock during driver probe and error path (patch 5/8)
- relaxed kernel-doc regarding cpi mutex usage (patch 6/8)
- fixed ice_cpi.c header (patch 6/8)
- fix retry mechanism in ice_cpi_wait_req0_ack0 (patch 6/8)
- fix potrntial leaving LM.REQ stuck asserted on the hardware (patch 6/8)
- fix kernel-doc for ice_cpi_ena_dis_clk_ref
- removed unused CPI definitions (patch 6/8)
- fix header inclusion (patch 6/8)
- addressed Sashiko issues for patch (8/8)
Changes in v7:
- rebased
- replace TXC-specific DPLL type with DPLL_TYPE_GENERIC (patch 1/8)
- update TXC framework to use DPLL_TYPE_GENERIC instead of DPLL_TYPE_GENERIC (patch 5/8)
- AI-review: added short trailing comment to the local mutex declaration to satisfy checkpatch report (patch 6/8)
Changes in v6:
- rebased
- AI-review: fix unprotected concurrent access to shared clock bitmap (patch 8/8)
- AI-review: fix potential issue in tx-clk pin state request handling ('already set' early-exit based now on tx_clk_req comparison, patch 8/8)
- AI-review: CPI transaction serialization (patch 6/8)
Changes in v5:
- rebased
- reworded cover letter
- replace 'ntfy_src' new argument name with 'src_clk_id' and use it consistently in DPLL notification calls (patch 3/8)
- reworded commit message (patch 5/8)
- use FIELD_PREP/GENMSK macros instead of struct bitfields (patch 6/8)
- reworded commit message (patch 5/8, patch 8/8)
- refactor the code to avoid sleeping while DPLL mutex is held (using work_queue, patch 8/8)
- added TXCLK pins and TXC DPLL notifications (patch 8/8)
- removed 'unused clock disable' mechanism from the scope of this series
Changes in v4:
- rebased
- edited, shortened the commit message in 3/8 patch
- moved ice_get_ctrl_pf to the header file (patch 8/8) and removed duplicated static definitions from ice_ptp and ice_txlck modules
- add NULL/invalid pointer checker for returned pointer from ice_get_ctrl_pf (patch 8/8)
- edited error message in case AN restart failure (patch 8/8)
Changes in v3:
- improved commit message (patch 1/8, AI review comment)
- improved deinitialization path in ice_dpll_deinit_txclk_pins to avoid potential NULL dereference. NULL checking moved to ice_dpll_unregister_pins (patch 5/8, found by AI review)
- removed redundant semicolon (patch 6/8)
Changes in v2:
- rebased
- added autogenerated DPLL files (patch 1/8)
- fixed checkpatch 'parenthesis alignment' warning (patch 2/8)
- fixed error path in ice_dpll_init_txclk_pins (AI warning, patch 5/8)
- fixed kdoc warnings (patch 6/8, patch 8/8)
Grzegorz Nitka (13):
dpll: add generic DPLL type
dpll: allow registering FW-identified pin with a different DPLL
dpll: fix stale iteration in dpll_pin_on_pin_unregister()
dpll: send delete notification before unregister in on-pin rollback
dpll: emit per-dpll delete notifications in
dpll_pin_on_pin_unregister()
dpll: guard sync-pair removal on full pin unregister
dpll: balance create/delete notifications in __dpll_pin_(un)register
dpll: extend pin notifier with notification source ID
dpll: allow fwnode pins to attempt state change without capability bit
ice: introduce TXC DPLL device and TX ref clock pin framework for E825
ice: implement CPI support for E825C
ice: add Tx reference clock index handling to AN restart command
ice: implement E825 TX ref clock control and TXC hardware sync status
Documentation/netlink/specs/dpll.yaml | 3 + drivers/dpll/dpll_core.c | 48 +- drivers/dpll/dpll_core.h | 5 +- drivers/dpll/dpll_netlink.c | 26 +- drivers/dpll/dpll_netlink.h | 4 +- drivers/dpll/dpll_nl.c | 2 +- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice.h | 12 + drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_common.c | 5 +- drivers/net/ethernet/intel/ice/ice_common.h | 2 +- drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 ++ drivers/net/ethernet/intel/ice/ice_dpll.c | 500 +++++++++++++++++- drivers/net/ethernet/intel/ice/ice_dpll.h | 36 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 +- drivers/net/ethernet/intel/ice/ice_ptp.c | 37 +- drivers/net/ethernet/intel/ice/ice_ptp.h | 6 + drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 37 ++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 17 + drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_txclk.c | 354 +++++++++++++ drivers/net/ethernet/intel/ice/ice_txclk.h | 40 ++ drivers/net/ethernet/intel/ice/ice_type.h | 2 + include/linux/dpll.h | 1 + include/uapi/linux/dpll.h | 2 + 28 files changed, 1517 insertions(+), 65 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.h create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.c create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.h
base-commit: 903db046d5579bef0ea699eae4b279dd6455fc9f
Signature · 1 line
2.39.3
PATCH v14 1/13 dpll: add generic DPLL type
Add DPLL_TYPE_GENERIC to represent DPLL devices which do not fit the existing PPS or EEC classes.
The UAPI type is intentionally generic. During netdev discussion, maintainers pointed out that introducing identifiers tied to a specific placement or single design does not scale across ASICs and vendors. The role of a DPLL is already inferable from the spawning driver, bus device, and pin topology, without encoding additional purpose-specific taxonomy in the type name.
Using a generic type keeps the UAPI extensible and avoids premature naming that may become incorrect as new hardware topologies are exposed through the DPLL subsystem.
Expose the new type through UAPI and netlink specification as "generic".
--- Documentation/netlink/specs/dpll.yaml | 3 +++ drivers/dpll/dpll_nl.c | 2 +- include/uapi/linux/dpll.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
Documentation/netlink/specs/dpll.yaml +3 -0
@@ -138,6 +138,9 @@ definitions: - name: eec doc: dpll drives the Ethernet Equipment Clock + - + name: generic + doc: generic dpll type for devices outside PPS/EEC classes render-max: true - type: enum
drivers/dpll/dpll_nl.c +1 -1
@@ -37,7 +37,7 @@ const struct nla_policy dpll_reference_sync_nl_policy[DPLL_A_PIN_STATE + 1] = {static const struct nla_policy dpll_device_id_get_nl_policy[DPLL_A_TYPE +1 ] = { [DPLL_A_MODULE_NAME ] = { .type =NLA_NUL_STRING , }, [DPLL_A_CLOCK_ID ] = { .type =NLA_U64 , }, - [DPLL_A_TYPE ] =NLA_POLICY_RANGE (NLA_U32 ,1 ,2 ), + [DPLL_A_TYPE ] =NLA_POLICY_RANGE (NLA_U32 ,1 ,3 ), };/* DPLL_CMD_DEVICE_GET - do */
include/uapi/linux/dpll.h +2 -0
@@ -109,10 +109,12 @@ enum dpll_clock_quality_level {* enum dpll_type - type of dpll, valid values for DPLL_A_TYPE attribute * @DPLL_TYPE_PPS: dpll produces Pulse-Per-Second signal * @DPLL_TYPE_EEC: dpll drives the Ethernet Equipment Clock +* @DPLL_TYPE_GENERIC: generic dpll type for devices outside PPS/EEC classes */ enum dpll_type {DPLL_TYPE_PPS =1 ,DPLL_TYPE_EEC , +DPLL_TYPE_GENERIC ,/* private: */ __DPLL_TYPE_MAX,
Signature · 1 line
2.39.3
PATCH v14 2/13 dpll: allow registering FW-identified pin with a different DPLL
In reply to Grzegorz NitkaRelax the (module, clock_id) equality requirement when registering a pin identified by firmware (pin->fwnode). Some platforms associate a FW-described pin with a DPLL instance that differs from the pin's (module, clock_id) tuple. For such pins, permit registration without requiring the strict match. Non-FW pins still require equality.
Keep netlink pin module reporting/filtering safe for this relaxed registration model by caching the module name in the pin object at allocation time and using the cached string in netlink paths. This avoids dereferencing pin->module after provider module teardown.
--- drivers/dpll/dpll_core.c | 20 ++++++++++++++++---- drivers/dpll/dpll_core.h | 2 ++ drivers/dpll/dpll_netlink.c | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/dpll/dpll_core.c +16 -4
@@ -11,6 +11,7 @@#include <linux/device.h> #include <linux/err.h> #include <linux/idr.h> +#include <linux/module.h> #include <linux/property.h> #include <linux/slab.h> #include <linux/string.h>
@@ -652,6 +653,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, pin->pin_idx = pin_idx; pin->clock_id = clock_id; pin->module = module; +strscpy (pin->module_name,module_name (module));if (WARN_ON (prop->type <DPLL_PIN_TYPE_MUX || prop->type >DPLL_PIN_TYPE_MAX )) { ret = -EINVAL ;
@@ -884,11 +886,21 @@ dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,return -EINVAL ;mutex_lock (&dpll_lock); -if (WARN_ON (!(dpll->module == pin->module && - dpll->clock_id == pin->clock_id))) + +/* +* For pins identified via firmware (pin->fwnode), allow registration +* even if the pin's (module, clock_id) differs from the target DPLL. +* For non-fwnode pins, require a strict (module, clock_id) match. +*/ +if (!pin->fwnode && +WARN_ON_ONCE (dpll->module != pin->module || + dpll->clock_id != pin->clock_id)) { ret = -EINVAL ; -else - ret =__dpll_pin_register (dpll, pin, ops, priv,NULL ); + goto out_unlock; + } + + ret =__dpll_pin_register (dpll, pin, ops, priv,NULL ); +out_unlock:mutex_unlock (&dpll_lock);return ret;
drivers/dpll/dpll_core.h +2 -0
@@ -45,6 +45,7 @@ struct dpll_device {* @pin_idx: index of a pin given by dev driver * @clock_id: clock_id of creator * @module: module of creator +* @module_name: module name of creator * @fwnode: optional reference to firmware node * @dpll_refs: hold referencees to dplls pin was registered with * @parent_refs: hold references to parent pins pin was registered with
@@ -59,6 +60,7 @@ struct dpll_pin {u32 pin_idx;u64 clock_id;struct module *module; +char module_name[MODULE_NAME_LEN ];struct fwnode_handle *fwnode;struct xarray dpll_refs;struct xarray parent_refs;
drivers/dpll/dpll_netlink.c +3 -3
@@ -703,7 +703,7 @@ dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin,if (ret)return ret;if (nla_put_string (msg,DPLL_A_PIN_MODULE_NAME , -module_name (pin->module))) + pin->module_name))return -EMSGSIZE ;if (nla_put_64bit (msg,DPLL_A_PIN_CLOCK_ID ,sizeof (pin->clock_id), &pin->clock_id,DPLL_A_PIN_PAD ))
@@ -1650,9 +1650,9 @@ dpll_pin_find(u64 clock_id, struct nlattr *mod_name_attr,xa_for_each_marked (&dpll_pin_xa, i, pin,DPLL_REGISTERED ) { prop = &pin->prop; cid_match = clock_id ? pin->clock_id == clock_id : true; - mod_match = mod_name_attr &&module_name (pin->module) ? + mod_match = mod_name_attr && pin->module_name[0 ] ? !nla_strcmp (mod_name_attr, -module_name (pin->module)) : true; + pin->module_name) : true; type_match = type ? prop->type == type : true; board_match = board_label ? (prop->board_label ? !nla_strcmp(board_label, prop->board_label) : false) :
Signature · 1 line
2.39.3
PATCH v14 3/13 dpll: fix stale iteration in dpll_pin_on_pin_unregister()
In reply to Grzegorz NitkaNeither parent->dpll_refs nor pin->dpll_refs on its own is a correct iteration target at unregister time:
- pin->dpll_refs includes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss in dpll_xa_ref_pin_del().
- parent->dpll_refs reflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.
Walk pin->dpll_refs and use dpll_pin_registration_find() to filter to entries whose cookie is this parent. Symmetric with dpll_pin_on_pin_register(), correct under any subsequent change to parent->dpll_refs.
--- drivers/dpll/dpll_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/dpll/dpll_core.c +6 -1
@@ -1031,14 +1031,19 @@ EXPORT_SYMBOL_GPL(dpll_pin_on_pin_register);void dpll_pin_on_pin_unregister (struct dpll_pin *parent,struct dpll_pin *pin,const struct dpll_pin_ops *ops,void *priv) { +struct dpll_pin_registration *reg;struct dpll_pin_ref *ref;unsigned long i;mutex_lock (&dpll_lock);dpll_pin_delete_ntf (pin);dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin); -xa_for_each (&pin->dpll_refs, i, ref) +xa_for_each (&pin->dpll_refs, i, ref) { + reg =dpll_pin_registration_find (ref, ops, priv, parent); +if (!reg) +continue ;__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); + }mutex_unlock (&dpll_lock); }EXPORT_SYMBOL_GPL (dpll_pin_on_pin_unregister);
Signature · 1 line
2.39.3
Kubalewski, Arkadiusz
maintainerRE: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 35 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMNeither
parent->dpll_refsnorpin->dpll_refson its own is a correct iteration target at unregister time:-
pin->dpll_refsincludes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss indpll_xa_ref_pin_del().
-parent->dpll_refsreflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.Walk
pin->dpll_refsand usedpll_pin_registration_find()to filter to entries whose cookie is this parent. Symmetric withdpll_pin_on_pin_register(), correct under any subsequent change toparent->dpll_refs.Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1031,14 +1031,19 @@ EXPORT_SYMBOL_GPL(dpll_pin_on_pin_register);void dpll_pin_on_pin_unregister(struct
dpll_pin*parent, structdpll_pin*pin,
const structdpll_pin_ops*ops, void *priv)
{drivers/dpll/dpll_core.c +1
-0+struct dpll_pin_registration *reg;
Quoted 5 lines
struct dpll_pin_ref *ref; unsigned long i; mutex_lock(&dpll_lock); dpll_pin_delete_ntf(pin);
Hey Grzegorz,
This line is redundant after 7/13?
Quoted 13 lines
dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);drivers/dpll/dpll_core.c +4
-1-xa_for_each (&pin->dpll_refs, i, ref) +xa_for_each (&pin->dpll_refs, i, ref) { + reg =dpll_pin_registration_find (ref, ops, priv, parent); +if (!reg) +continue ;__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);drivers/dpll/dpll_core.c +1
-0+ }mutex_unlock(&dpll_lock); }
EXPORT_SYMBOL_GPL(dpll_pin_on_pin_unregister);
--
2.39.3
RE: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 54 lines
-----Original Message-----
From: Kubalewski, Arkadiusz <[email protected]>
Sent: Monday, June 8, 2026 6:51 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros, Petr <[email protected]>; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v14 net-next 03/13] dpll: fix stale iteration indpll_pin_on_pin_unregister()drivers/dpll/dpll_core.c
Quoted 30 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMNeither
parent->dpll_refsnorpin->dpll_refson its own is a correct iteration target at unregister time:-
pin->dpll_refsincludes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss indpll_xa_ref_pin_del().
-parent->dpll_refsreflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.Walk
pin->dpll_refsand usedpll_pin_registration_find()to filter to entries whose cookie is this parent. Symmetric withdpll_pin_on_pin_register(), correct under any subsequent change toparent->dpll_refs.Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1031,14 +1031,19 @@
EXPORT_SYMBOL_GPL(dpll_pin_on_pin_register);Quoted 8 lines
void dpll_pin_on_pin_unregister(struct
dpll_pin*parent, structdpll_pin*pin,
const structdpll_pin_ops*ops, void *priv)
{drivers/dpll/dpll_core.c +1
-0+struct dpll_pin_registration *reg;struct dpll_pin_ref *ref; unsigned long i;
Quoted 7 lines
Quoted 2 lines
mutex_lock(&dpll_lock); dpll_pin_delete_ntf(pin);Hey Grzegorz,
This line is redundant after 7/13?
Hi Arek,
Yes, in general.
The reason for which I put it as separate patches (applies to all new 'Fixes' patches) is:
- to identify atomic changes and
- to make it easy to backport to other branches ('old' ones) if the call is to backport it
Regards
Grzegorz
Quoted 13 lines
Quoted 13 lines
dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);drivers/dpll/dpll_core.c +4
-1-xa_for_each (&pin->dpll_refs, i, ref) +xa_for_each (&pin->dpll_refs, i, ref) { + reg =dpll_pin_registration_find (ref, ops, priv, parent); +if (!reg) +continue ;__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);drivers/dpll/dpll_core.c +1
-0+ }mutex_unlock(&dpll_lock); }
EXPORT_SYMBOL_GPL(dpll_pin_on_pin_unregister);
--
2.39.3
Paolo Abeni
maintainerRe: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
In reply to Grzegorz NitkaQuoted 11 lines · Grzegorz Nitka
Neither
parent->dpll_refsnorpin->dpll_refson its own is a correct iteration target at unregister time:-
pin->dpll_refsincludes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss indpll_xa_ref_pin_del().
-parent->dpll_refsreflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.
Quoted 7 lines
Walk
pin->dpll_refsand usedpll_pin_registration_find()to filter to entries whose cookie is this parent. Symmetric withdpll_pin_on_pin_register(), correct under any subsequent change toparent->dpll_refs.Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>
The current guidance is to avoid the Fixes tag for net-next patches, when such tag refers to code already into Linus's tree.
If it's a real user-visible issue, the patch should target net. Otherwise if the intended target is really net-next, no fixes tag please.
Unrelated important node: sashiko (gemini) still has some comments, some of them looks new and relevant to me i.e. the possible divide by zero bug in patch 11, see:
https://sashiko.dev/#/patchset/20260607183045.1213735-1-grzegorz.nitka%40intel.com
/P
RE: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 44 lines
-----Original Message-----
From: Paolo Abeni <[email protected]>
Sent: Thursday, June 11, 2026 10:50 AM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros, Petr <[email protected]>; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v14 net-next 03/13] dpll: fix stale iteration indpll_pin_on_pin_unregister()Quoted 11 lines · Grzegorz Nitka
Neither
parent->dpll_refsnorpin->dpll_refson its own is a correct iteration target at unregister time:-
pin->dpll_refsincludes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss indpll_xa_ref_pin_del().
-parent->dpll_refsreflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.Quoted 7 lines
Walk
pin->dpll_refsand usedpll_pin_registration_find()to filter to entries whose cookie is this parent. Symmetric withdpll_pin_on_pin_register(), correct under any subsequent change toparent->dpll_refs.Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>The current guidance is to avoid the Fixes tag for net-next patches, when such tag refers to code already into Linus's tree.
If it's a real user-visible issue, the patch should target net. Otherwise if the intended target is really net-next, no fixes tag please.
Quoted 8 lines
Unrelated important node: sashiko (gemini) still has some comments, some of them looks new and relevant to me i.e. the possible divide by zero bug in patch 11, see:
https://sashiko.dev/#/patchset/20260607183045.1213735-1-
grzegorz.nitka%40intel.com/P
Hi Paolo
Thanks for your feedback.
Regarding patches with 'Fixes' tag ...
Actually patches from 3 to 7 in this series are indeed fix patches for the existing code. It was reported by Sashiko earlier for this series as pre-existing issues. Kuba suggested, at least this is how I understood it, to include it in the series to see a clean AI scan.
So please advise on the next steps ...
Should I simply remove 'Fixes' tag from the commits and keep those patches in the series? Or ... to remove them from the series and re-send as regular fix patches on 'net'?
Regarding the latest Sahiko comments .. this specific one about divide-by-zero panic is false-positive. It was fixed with the latest revision.
I'll respond in a separate message with my view on the other high ones.
Regards
Grzegorz
Paolo Abeni
maintainerRe: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 53 lines · Grzegorz
Quoted 42 lines
-----Original Message-----
From: Paolo Abeni <[email protected]>
Sent: Thursday, June 11, 2026 10:50 AM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros, Petr <[email protected]>; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v14 net-next 03/13] dpll: fix stale iteration indpll_pin_on_pin_unregister()Quoted 11 lines · Grzegorz Nitka
Neither
parent->dpll_refsnorpin->dpll_refson its own is a correct iteration target at unregister time:-
pin->dpll_refsincludes DPLLs the child was registered against via a different parent or directly; blind unregister WARNs on the cookie miss indpll_xa_ref_pin_del().
-parent->dpll_refsreflects the parent's current attachments, not those at child-register time. Another driver may have (un)reg'd the parent against additional DPLLs in the meantime, so we miss registrations that exist and visit DPLLs that have none.Quoted 7 lines
Walk
pin->dpll_refsand usedpll_pin_registration_find()to filter to entries whose cookie is this parent. Symmetric withdpll_pin_on_pin_register(), correct under any subsequent change toparent->dpll_refs.Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>The current guidance is to avoid the Fixes tag for net-next patches, when such tag refers to code already into Linus's tree.
If it's a real user-visible issue, the patch should target net. Otherwise if the intended target is really net-next, no fixes tag please.
Quoted 8 lines
Unrelated important node: sashiko (gemini) still has some comments, some of them looks new and relevant to me i.e. the possible divide by zero bug in patch 11, see:
https://sashiko.dev/#/patchset/20260607183045.1213735-1-
grzegorz.nitka%40intel.com/P
Hi Paolo
Quoted 9 lines
Thanks for your feedback.
Regarding patches with 'Fixes' tag ...
Actually patches from 3 to 7 in this series are indeed fix patches for the existing code. It was reported by Sashiko earlier for this series as pre-existing issues. Kuba suggested, at least this is how I understood it, to include it in the series to see a clean AI scan.
So please advise on the next steps ...
Should I simply remove 'Fixes' tag from the commits and keep those patches in the series? Or ... to remove them from the series and re-send as regular fix patches on 'net'?
The current guidance for the Fixes tag is to avoid it in net-next patches, unless fixed patch is only present on net-next. My reading of Jakub suggestion would be to drop the fixes tag as 'are not actually bugs.':
https://lore.kernel.org/netdev/[email protected]/
Note that I could misread his wording.
Fixes tag could be stripped when applying the patches as needed, and I think that could be preferable to a repost just for such thing, given the current PW load...
Quoted 3 lines
Regarding the latest Sahiko comments .. this specific one about divide-by-zero panic is false-positive. It was fixed with the latest revision.
I'll respond in a separate message with my view on the other high ones.
... unless sashiko points to something really relevant. Please report on the ML.
Thanks,
Paolo
Jakub Kicinski
maintainerRe: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 3 lines · On Thu, 11 Jun 2026 16:41:07 +0200 Paolo Abeni wrote:
Fixes tag could be stripped when applying the patches as needed, and I think that could be preferable to a repost just for such thing, given the current PW load...
To be clear tho, this series has already been marked as changes requested. Presumably based on the other comments?
RE: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 19 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Thursday, June 11, 2026 7:41 PM
To: Paolo Abeni <[email protected]>
Cc: Nitka, Grzegorz <[email protected]>; [email protected]; [email protected]; [email protected]; Oros, Petr <[email protected]>; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; Kubalewski, Arkadiusz <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v14 net-next 03/13] dpll: fix stale iteration indpll_pin_on_pin_unregister()
Quoted 7 lines
Quoted 3 lines · On Thu, 11 Jun 2026 16:41:07 +0200 Paolo Abeni wrote:
Fixes tag could be stripped when applying the patches as needed, and I think that could be preferable to a repost just for such thing, given the current PW load...
To be clear tho, this series has already been marked as changes requested. Presumably based on the other comments?
Hi Kuba, Paolo
To sum up ...
For v14 patchset, I got only comments from Arek and Paolo.
In my opinion, after rethinking, Arek's concerns are not valid (explained in the responses). Maybe I could squash some changes, but the final code would remain the same as for v14.
Paolo raised 'Fixes' tags which I added and critical divide-by-zero panic Regarding 'Fixes' tag, It might be my fault or misunderstanding. I can remove them if we want and re-send the series. Regarding div-by-zero - see my comments about AI concern list below.
Also, what was raised by AI, I unintentionally changed WARN_ON to WARN_ON_ONCE in patch 2. I'd restore it to WARN_ON.
Below is my summary on other AI concerns (take a look at "potential issues" section). I'm aware we're about window closure. I'm polishing this series for a long time. A lot was fixed already. I'm afraid adding another fixes will trigger a new ones 😊 Please, let me know if we still have time for another version. I can do that if you think the remaining issues are 'must have' fix. In my subjective opinion - it's not.
Potential issues:
---------------------
Patch 11:
- hw->lane_num < 0
It's a fatal error scenario. PTP module already returning an error in such case, so it's visible to the user anyway.
I could add something similar to dpll module initialization. But from my perspective it's more a kind of very defensive approach.
Patch 13
- potential software state desynchronized from the hardware:
Worth to fix but in the next release - this is in my opinion a kind of a corner/sophisticated scenario.
- bypass the new ice_txclk_update_and_notify when pf->ptp.state != ICE_PTP_READY Again, worth to fix in the next release (fatal PTP error case)
- worker thread is preempted right before clearing txclk_switch_requested Race is real but practically unreachable. Good to have it fixed in the next release
Not an issue (false-positive):
-------------------------------------
Patch 11:
- potential divide by zero panic (CRITICAL)
That was fixed in v14. In case PTP hardware initilization is failed, DPLL re-initializes module will set hw->ptp.ports_per_phy on its own.
- error path in ice_dpll_init_e825 and the risk of double-destroy the mutex when ice_dpll_deinit()
still guarded by ICE_FLAG_DPLL flag
Patch 13
- attempt to lock ctrl_pf->dplls.lock when controlling PF's DPLL subsytem is not initilized
This condition is checked when triggering tx-clk change and appropriate error is returned.
These is pre-existing issue, out of the scope of this series in my opinion
- patch 12: silently ignoring non-EMODE firmware errors.
Regards
Grzegorz
Jakub Kicinski
maintainerRe: [PATCH v14 net-next 03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister()
Quoted 5 lines · Grzegorz
For v14 patchset, I got only comments from Arek and Paolo.
In my opinion, after rethinking, Arek's concerns are not valid (explained in the responses). Maybe I could squash some changes, but the final code would remain the same as for v14.
Quoted 7 lines
Paolo raised 'Fixes' tags which I added and critical divide-by-zero panic Regarding 'Fixes' tag, It might be my fault or misunderstanding. I can remove them if we want and re-send the series. Regarding div-by-zero - see my comments about AI concern list below.
Also, what was raised by AI, I unintentionally changed
WARN_ONtoWARN_ON_ONCEin patch 2. I'd restore it toWARN_ON.
Alright, let me apply this.
But please investigate the situation with the notifications. Maybe there are two create notifications because we add more info to the second one? If not we should drop the duplicates.. YNL can monitor the notifications during tests if you need a repro.
You can follow up with the fixes during the merge window.
PATCH v14 4/13 dpll: send delete notification before unregister in on-pin rollback
In reply to Grzegorz NitkaThe rollback path in dpll_pin_on_pin_register() called __dpll_pin_unregister() before dpll_pin_delete_ntf(). When the unregister dropped the pin's last DPLL reference it cleared the DPLL_REGISTERED mark in dpll_pin_xa, so the subsequent dpll_pin_event_send() failed dpll_pin_available() and aborted with -ENODEV. As a result userspace was never notified of the rollback deletion and remained out of sync with the kernel.
Send the delete notification first, matching the order used by dpll_pin_unregister() and dpll_pin_on_pin_unregister().
--- drivers/dpll/dpll_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
@@ -1007,9 +1007,9 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, dpll_unregister:xa_for_each (&parent->dpll_refs, i, ref)if (i < stop) { +dpll_pin_delete_ntf (pin);__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); -dpll_pin_delete_ntf (pin); }dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin); unlock:
Signature · 1 line
2.39.3
Kubalewski, Arkadiusz
maintainerRE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollback
Quoted 32 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMThe rollback path in
dpll_pin_on_pin_register()called__dpll_pin_unregister()beforedpll_pin_delete_ntf(). When the unregister dropped the pin's last DPLL reference it cleared theDPLL_REGISTEREDmark indpll_pin_xa, so the subsequentdpll_pin_event_send()faileddpll_pin_available()and aborted with-ENODEV. As a result userspace was never notified of the rollback deletion and remained out of sync with the kernel.Send the delete notification first, matching the order used by
dpll_pin_unregister()anddpll_pin_on_pin_unregister().Fixes 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1007,9 +1007,9 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
dpll_unregister:xa_for_each(&parent->dpll_refs, i, ref) if (i < stop) {drivers/dpll/dpll_core.c +1
-0+dpll_pin_delete_ntf (pin);__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);
drivers/dpll/dpll_core.c int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, · line 1012
Quoted 1 line
drivers/dpll/dpll_core.c +0
-1-dpll_pin_delete_ntf (pin);
Hey Grzegorz,
Since patch 7/13 this is already part of __dpll_pin_unregister ? The call should be removed at all? Please make sure all calls to __dpll_pin_unregister(..) are aware of that, also maybe better to put this all related to one patch?
Quoted 5 lines
} dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);unlock:
--
2.39.3
RE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollback
Quoted 52 lines
-----Original Message-----
From: Kubalewski, Arkadiusz <[email protected]>
Sent: Monday, June 8, 2026 6:45 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros, Petr <[email protected]>; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollbackQuoted 32 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMThe rollback path in
dpll_pin_on_pin_register()called__dpll_pin_unregister()beforedpll_pin_delete_ntf(). When the unregister dropped the pin's last DPLL reference it cleared theDPLL_REGISTEREDmark indpll_pin_xa, so the subsequentdpll_pin_event_send()faileddpll_pin_available()and aborted with-ENODEV. As a result userspace was never notified of the rollback deletion and remained out of sync with the kernel.Send the delete notification first, matching the order used by
dpll_pin_unregister()anddpll_pin_on_pin_unregister().Fixes 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1007,9 +1007,9 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
dpll_unregister:xa_for_each(&parent->dpll_refs, i, ref) if (i < stop) {drivers/dpll/dpll_core.c +1
-0+dpll_pin_delete_ntf (pin);__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);drivers/dpll/dpll_core.c int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, · line 1012
Quoted 1 line
drivers/dpll/dpll_core.c +0
-1-dpll_pin_delete_ntf (pin);Hey Grzegorz,
Quoted 5 lines
Since patch 7/13 this is already part of
__dpll_pin_unregister? The call should be removed at all? Please make sure all calls to__dpll_pin_unregister(..)are aware of that, also maybe better to put this all related to one patch?
Yes, I think this patch is a good candidate to squash with 7/13 (with proper commit message edit).
Same 'Fixes' tag and both touch notifications fix.
Thanks
Grzegorz
Quoted 5 lines
Quoted 5 lines
} dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);unlock:
--
2.39.3
RE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollback
Quoted 79 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Nitka, Grzegorz
Sent: Tuesday, June 9, 2026 9:10 AM
To: Kubalewski, Arkadiusz <[email protected]>; [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollbackQuoted 5 lines
-----Original Message-----
From: Kubalewski, Arkadiusz <[email protected]>
Sent: Monday, June 8, 2026 6:45 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros,Petr
Quoted 1 line
Quoted 6 lines
Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v14 net-next 04/13] dpll: send delete notificationbefore
Quoted 38 lines
unregister in on-pin rollback
Quoted 32 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMThe rollback path in
dpll_pin_on_pin_register()called__dpll_pin_unregister()beforedpll_pin_delete_ntf(). When the unregister dropped the pin's last DPLL reference it cleared theDPLL_REGISTEREDmark indpll_pin_xa, so the subsequentdpll_pin_event_send()faileddpll_pin_available()and aborted with-ENODEV. As a result userspace was never notified of the rollback deletion and remained out of sync with the kernel.Send the delete notification first, matching the order used by
dpll_pin_unregister()anddpll_pin_on_pin_unregister().Fixes 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1007,9 +1007,9 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
dpll_unregister:xa_for_each(&parent->dpll_refs, i, ref) if (i < stop) {drivers/dpll/dpll_core.c +1
-0+dpll_pin_delete_ntf (pin);__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);drivers/dpll/dpll_core.c int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, · line 1012
Quoted 1 line
drivers/dpll/dpll_core.c +0
-1-dpll_pin_delete_ntf (pin);Hey Grzegorz,
Quoted 5 lines
Since patch 7/13 this is already part of
__dpll_pin_unregister? The call should be removed at all? Please make sure all calls to__dpll_pin_unregister(..)are aware of that, also maybe better to put this all related to one patch?
Quoted 7 lines
Yes, I think this patch is a good candidate to squash with 7/13 (with proper commit message edit).
Same 'Fixes' tag and both touch notifications fix.Thanks
Grzegorz
Hi Arek,
I revisited your comment, from the perspective of redundant calls
to dpll_pin_delete_ntf after patch 7/13 is applied to.
Yes, there are still 2 "redundant" calls to dpll_pin_delete_ntf on top of __dpll_pin_unregister. I'm going to send v14 with this fix and reordered commits in the patchset (7/13 moved up).
Regards
Grzegorz
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
} dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);unlock:
--
2.39.3
RE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollback
Quoted 115 lines
-----Original Message-----
From: Nitka, Grzegorz
Sent: Wednesday, June 10, 2026 9:42 PM
To: Nitka, Grzegorz <[email protected]>; Kubalewski, Arkadiusz <[email protected]>; [email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollbackQuoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Nitka, Grzegorz
Sent: Tuesday, June 9, 2026 9:10 AM
To: Kubalewski, Arkadiusz <[email protected]>;Quoted 8 lines
[email protected]
Cc: Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; [email protected];Quoted 12 lines
Subject: Re: [Intel-wired-lan] [PATCH v14 net-next 04/13] dpll: send delete notification before unregister in on-pin rollback
Quoted 5 lines
-----Original Message-----
From: Kubalewski, Arkadiusz <[email protected]>
Sent: Monday, June 8, 2026 6:45 PM
To: Nitka, Grzegorz <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Oros,Petr
Quoted 1 line
Quoted 25 lines
Quoted 6 lines
Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; Vecera, Ivan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v14 net-next 04/13] dpll: send delete notificationbefore
Quoted 17 lines
unregister in on-pin rollback
Quoted 15 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PMThe rollback path in
dpll_pin_on_pin_register()called__dpll_pin_unregister()beforedpll_pin_delete_ntf(). When the unregister dropped the pin's last DPLL reference it cleared theDPLL_REGISTEREDmark indpll_pin_xa, so the subsequentdpll_pin_event_send()faileddpll_pin_available()and aborted with-ENODEV. As a result userspace was never notified of the rollback deletion and remained out of sync with the kernel.Send the delete notification first, matching the order used by
dpll_pin_unregister()anddpll_pin_on_pin_unregister().Fixes 9d71b54b65b1 ("dpll: netlink: Add DPLL framework basefunctions")
Quoted 27 lines
Quoted 21 lines
Quoted 17 lines
Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/dpll/dpll_core.c +0
-0@@ -1007,9 +1007,9 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
dpll_unregister:xa_for_each(&parent->dpll_refs, i, ref) if (i < stop) {drivers/dpll/dpll_core.c +1
-0+dpll_pin_delete_ntf (pin);__dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);drivers/dpll/dpll_core.c int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, · line 1012
Quoted 1 line
drivers/dpll/dpll_core.c +0
-1-dpll_pin_delete_ntf (pin);Hey Grzegorz,
Quoted 5 lines
Since patch 7/13 this is already part of
__dpll_pin_unregister? The call should be removed at all? Please make sure all calls to__dpll_pin_unregister(..)are aware of that, also maybe better to put this all related to one patch?Quoted 7 lines
Yes, I think this patch is a good candidate to squash with 7/13 (with proper commit message edit).
Same 'Fixes' tag and both touch notifications fix.Thanks
Grzegorz
Hi Arek,
I revisited your comment, from the perspective of redundant calls to
dpll_pin_delete_ntfafter patch 7/13 is applied to.
Yes, there are still 2 "redundant" calls todpll_pin_delete_ntfon top of__dpll_pin_unregister.
I'm going to send v14 with this fix and reordered commits in the patchset (7/13 moved up).
Quoted 4 lines
Regards
Grzegorz
Wait ... those 2 mentioned calls to dpll_pin_delete_ntf are symmetric behavior for calls to dpll_pin_create_ntf on success path in dpll_pin_on_pin_register. I don't understand why there are two pin create notifications needed (inside and Outside of __dpll_pin_register).
However it's long-standing code, maybe there is a consensus to have two calls. So I'm skeptical to change it, unless someone tell me it's the right thing to do. It's out of scope of this series, in my opinion. I'd leave it as it is.
Regards
Grzegorz
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
} dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);unlock:
--
2.39.3
PATCH v14 5/13 dpll: emit per-dpll delete notifications in dpll_pin_on_pin_unregister()
In reply to Grzegorz Nitkadpll_pin_on_pin_register() emits a creation notification for every parent->dpll_refs entry, but dpll_pin_on_pin_unregister() emitted only one deletion notification outside the loop. When a pin is registered against multiple parent dplls, userspace sees N creates but a single delete and leaks per-dpll state.
Move dpll_pin_delete_ntf() into the loop and call it before __dpll_pin_unregister() so the DPLL_REGISTERED mark is still set when dpll_pin_available() is consulted.
--- drivers/dpll/dpll_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dpll/dpll_core.c +2 -2
@@ -1036,14 +1036,14 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin,unsigned long i;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin); -dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);xa_for_each (&pin->dpll_refs, i, ref) { reg =dpll_pin_registration_find (ref, ops, priv, parent);if (!reg)continue ; +dpll_pin_delete_ntf (pin);__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); } +dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);mutex_unlock (&dpll_lock); }EXPORT_SYMBOL_GPL (dpll_pin_on_pin_unregister);
Signature · 1 line
2.39.3
RE: [PATCH v14 net-next 05/13] dpll: emit per-dpll delete notifications in dpll_pin_on_pin_unregister()
Quoted 9 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PM
dpll_pin_on_pin_register()emits a creation notification for everyparent->dpll_refsentry, butdpll_pin_on_pin_unregister()emitted only one deletion notification outside the loop. When a pin is registered against multiple parent dplls, userspace sees N creates but a single delete and leaks per-dpll state.
Quoted 5 lines
Move
dpll_pin_delete_ntf()into the loop and call it before__dpll_pin_unregister()so theDPLL_REGISTEREDmark is still set whendpll_pin_available()is consulted.Fixes 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")
Quoted 29 lines
Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/dpll/dpll_core.c +2
-2@@ -1036,14 +1036,14 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin, unsigned long i;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin); -dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);xa_for_each (&pin->dpll_refs, i, ref) { reg =dpll_pin_registration_find (ref, ops, priv, parent);if (!reg)continue ; +dpll_pin_delete_ntf (pin);__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); } +dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);mutex_unlock (&dpll_lock); }
EXPORT_SYMBOL_GPL(dpll_pin_on_pin_unregister);
--
2.39.3
PATCH v14 6/13 dpll: guard sync-pair removal on full pin unregister
In reply to Grzegorz Nitka__dpll_pin_unregister() wiped the global sync-pair state on every (dpll, ops, priv, cookie) tuple removed from a pin. When a pin is registered multiple times and only one registration is being torn down, this dropped sync-pair pairings still in use by the surviving registrations.
Move dpll_pin_ref_sync_pair_del() inside the xa_empty(&pin->dpll_refs) branch so it only runs when the last registration is gone, alongside clearing the DPLL_REGISTERED mark.
--- drivers/dpll/dpll_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/dpll/dpll_core.c +3 -2
@@ -926,11 +926,12 @@ __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv, void *cookie) {ASSERT_DPLL_PIN_REGISTERED (pin ); -dpll_pin_ref_sync_pair_del (pin->id);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv, cookie);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv, cookie); -if (xa_empty (&pin->dpll_refs)) +if (xa_empty (&pin->dpll_refs)) { +dpll_pin_ref_sync_pair_del (pin->id);xa_clear_mark (&dpll_pin_xa, pin->id,DPLL_REGISTERED ); + } }/**
Signature · 1 line
2.39.3
RE: [PATCH v14 net-next 06/13] dpll: guard sync-pair removal on full pin unregister
Quoted 9 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PM
__dpll_pin_unregister()wiped the global sync-pair state on every (dpll, ops, priv, cookie) tuple removed from a pin. When a pin is registered multiple times and only one registration is being torn down, this dropped sync-pair pairings still in use by the surviving registrations.
Quoted 5 lines
Move
dpll_pin_ref_sync_pair_del()inside thexa_empty(&pin->dpll_refs)branch so it only runs when the last registration is gone, alongside clearing theDPLL_REGISTEREDmark.Fixes 58256a26bfb3 ("dpll: add reference sync get/set")
Quoted 28 lines
Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)drivers/dpll/dpll_core.c +3
-2@@ -926,11 +926,12 @@ __dpll_pin_unregister(struct dpll_device *dpll,struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv, void *cookie) {ASSERT_DPLL_PIN_REGISTERED (pin ); -dpll_pin_ref_sync_pair_del (pin->id);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv, cookie);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv, cookie); -if (xa_empty (&pin->dpll_refs)) +if (xa_empty (&pin->dpll_refs)) { +dpll_pin_ref_sync_pair_del (pin->id);xa_clear_mark (&dpll_pin_xa, pin->id,DPLL_REGISTERED ); + } }/**
--
2.39.3
PATCH v14 7/13 dpll: balance create/delete notifications in __dpll_pin_(un)register
In reply to Grzegorz Nitka__dpll_pin_register() emits dpll_pin_create_ntf() internally, but __dpll_pin_unregister() left the matching delete to its callers. The counts then diverge on dpll_pin_on_pin_register() rollback and on dpll_pin_on_pin_unregister(), leaking stale notifications.
Emit dpll_pin_delete_ntf() inside __dpll_pin_unregister() and drop the now-redundant call in dpll_pin_unregister().
--- drivers/dpll/dpll_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
@@ -926,6 +926,7 @@ __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv, void *cookie) {ASSERT_DPLL_PIN_REGISTERED (pin ); +dpll_pin_delete_ntf (pin);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv, cookie);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv, cookie);if (xa_empty (&pin->dpll_refs)) {
@@ -953,7 +954,6 @@ void dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,return ;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin);__dpll_pin_unregister (dpll, pin, ops, priv,NULL );mutex_unlock (&dpll_lock); }
Signature · 1 line
2.39.3
RE: [PATCH v14 net-next 07/13] dpll: balance create/delete notifications in __dpll_pin_(un)register
Quoted 8 lines
From: Nitka, Grzegorz <[email protected]>
Sent: Sunday, June 7, 2026 8:31 PM
__dpll_pin_register()emitsdpll_pin_create_ntf()internally, but__dpll_pin_unregister()left the matching delete to its callers. The counts then diverge ondpll_pin_on_pin_register()rollback and ondpll_pin_on_pin_unregister(), leaking stale notifications.
Quoted 4 lines
Emit
dpll_pin_delete_ntf()inside__dpll_pin_unregister()and drop the now-redundant call indpll_pin_unregister().Fixes 9431063ad323 ("dpll: core: Add DPLL framework base functions")
Quoted 30 lines
Signed-off-by Grzegorz Nitka <[email protected]>---
drivers/dpll/dpll_core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/dpll/dpll_core.c +1
-0@@ -926,6 +926,7 @@ __dpll_pin_unregister(struct dpll_device *dpll, structdpll_pin *pin, const struct dpll_pin_ops *ops, void *priv, void *cookie) {ASSERT_DPLL_PIN_REGISTERED (pin ); +dpll_pin_delete_ntf (pin);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv, cookie);dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv, cookie); if (xa_empty(&pin->dpll_refs)) {drivers/dpll/dpll_core.c +0
-1@@ -953,7 +954,6 @@ void dpll_pin_unregister(struct dpll_device *dpll,struct dpll_pin *pin, return;mutex_lock (&dpll_lock); -dpll_pin_delete_ntf (pin);__dpll_pin_unregister (dpll, pin, ops, priv,NULL );mutex_unlock (&dpll_lock);}
--
2.39.3
PATCH v14 8/13 dpll: extend pin notifier with notification source ID
In reply to Grzegorz NitkaExtend the DPLL pin notification API to include a source identifier indicating where the notification originates. This allows notifier consumers to distinguish between notifications coming from an associated DPLL instance, a parent pin, or the pin itself.
A new field, src_clock_id, is added to struct dpll_pin_notifier_info and is passed through all pin-related notification paths. Callers of dpll_pin_notify() are updated to provide a meaningful source identifier based on their context:
- pin registration/unregistration uses the DPLL's clock_id,
- pin-on-pin operations use the parent pin's clock_id,
- pin changes use the pin's own clock_id.
As introduced in the commit ("dpll: allow registering FW-identified pin with a different DPLL"), it is possible to share the same physical pin via firmware description (fwnode) with DPLL objects from different kernel modules. This means that a given pin can be registered multiple times.
Driver such as ICE (E825 devices) rely on this mechanism when listening for the event where a shared-fwnode pin appears, while avoiding reacting to events triggered by their own registration logic.
This change only extends the notification metadata and does not alter existing semantics for drivers that do not use the new field.
--- drivers/dpll/dpll_core.c | 14 ++++++++------ drivers/dpll/dpll_core.h | 3 ++- drivers/dpll/dpll_netlink.c | 10 +++++----- drivers/dpll/dpll_netlink.h | 4 ++-- include/linux/dpll.h | 1 + 5 files changed, 18 insertions(+), 14 deletions(-)
drivers/dpll/dpll_core.c +8 -6
@@ -72,7 +72,8 @@ void dpll_device_notify(struct dpll_device *dpll, unsigned long action)call_dpll_notifiers (action, &info); } -void dpll_pin_notify (struct dpll_pin *pin,unsigned long action) +void dpll_pin_notify (struct dpll_pin *pin,u64 src_clock_id, +unsigned long action) {struct dpll_pin_notifier_info info = { .pin = pin,
@@ -81,6 +82,7 @@ void dpll_pin_notify(struct dpll_pin *pin, unsigned long action) .clock_id = pin->clock_id, .fwnode = pin->fwnode, .prop = &pin->prop, + .src_clock_id = src_clock_id, };call_dpll_notifiers (action, &info);
@@ -849,7 +851,7 @@ __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,if (ret) goto ref_pin_del;xa_set_mark (&dpll_pin_xa, pin->id,DPLL_REGISTERED ); -dpll_pin_create_ntf (pin); +dpll_pin_create_ntf (pin, dpll->clock_id);return ret;
@@ -926,7 +928,7 @@ __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin, const struct dpll_pin_ops *ops, void *priv, void *cookie) {ASSERT_DPLL_PIN_REGISTERED (pin ); -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, dpll->clock_id);dpll_xa_ref_pin_del (&dpll->pin_refs, pin, ops, priv, cookie);dpll_xa_ref_dpll_del (&pin->dpll_refs, dpll, ops, priv, cookie);if (xa_empty (&pin->dpll_refs)) {
@@ -999,7 +1001,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, stop = i; goto dpll_unregister; } -dpll_pin_create_ntf (pin); +dpll_pin_create_ntf (pin, parent->clock_id); }mutex_unlock (&dpll_lock);
@@ -1008,7 +1010,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin, dpll_unregister:xa_for_each (&parent->dpll_refs, i, ref)if (i < stop) { -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, parent->clock_id);__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); }
@@ -1041,7 +1043,7 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin, reg =dpll_pin_registration_find (ref, ops, priv, parent);if (!reg)continue ; -dpll_pin_delete_ntf (pin); +dpll_pin_delete_ntf (pin, parent->clock_id);__dpll_pin_unregister (ref->dpll, pin, ops, priv, parent); }dpll_xa_ref_pin_del (&pin->parent_refs, parent, ops, priv, pin);
drivers/dpll/dpll_core.h +2 -1
@@ -100,6 +100,7 @@ extern struct xarray dpll_pin_xa;extern struct mutex dpll_lock;void dpll_device_notify (struct dpll_device *dpll,unsigned long action); -void dpll_pin_notify (struct dpll_pin *pin,unsigned long action); +void dpll_pin_notify (struct dpll_pin *pin,u64 src_clock_id, +unsigned long action);#endif
drivers/dpll/dpll_netlink.c +5 -5
@@ -915,15 +915,15 @@ dpll_pin_event_send(enum dpll_cmd event, struct dpll_pin *pin)return ret; } -int dpll_pin_create_ntf (struct dpll_pin *pin) +int dpll_pin_create_ntf (struct dpll_pin *pin,u64 src_clock_id) { -dpll_pin_notify (pin,DPLL_PIN_CREATED ); +dpll_pin_notify (pin, src_clock_id,DPLL_PIN_CREATED );return dpll_pin_event_send (DPLL_CMD_PIN_CREATE_NTF , pin); } -int dpll_pin_delete_ntf (struct dpll_pin *pin) +int dpll_pin_delete_ntf (struct dpll_pin *pin,u64 src_clock_id) { -dpll_pin_notify (pin,DPLL_PIN_DELETED ); +dpll_pin_notify (pin, src_clock_id,DPLL_PIN_DELETED );return dpll_pin_event_send (DPLL_CMD_PIN_DELETE_NTF , pin); }
@@ -938,7 +938,7 @@ int dpll_pin_delete_ntf(struct dpll_pin *pin)int __dpll_pin_change_ntf (struct dpll_pin *pin) {lockdep_assert_held (&dpll_lock); -dpll_pin_notify (pin,DPLL_PIN_CHANGED ); +dpll_pin_notify (pin, pin->clock_id,DPLL_PIN_CHANGED );return dpll_pin_event_send (DPLL_CMD_PIN_CHANGE_NTF , pin); }EXPORT_SYMBOL_GPL (__dpll_pin_change_ntf);
drivers/dpll/dpll_netlink.h +2 -2
@@ -8,6 +8,6 @@ int dpll_device_create_ntf(struct dpll_device *dpll);int dpll_device_delete_ntf (struct dpll_device *dpll); -int dpll_pin_create_ntf (struct dpll_pin *pin); +int dpll_pin_create_ntf (struct dpll_pin *pin,u64 src_clock_id); -int dpll_pin_delete_ntf (struct dpll_pin *pin); +int dpll_pin_delete_ntf (struct dpll_pin *pin,u64 src_clock_id);
include/linux/dpll.h +1 -0
@@ -233,6 +233,7 @@ struct dpll_pin_notifier_info {u64 clock_id;const struct fwnode_handle *fwnode;const struct dpll_pin_properties *prop; +u64 src_clock_id; };#if IS_ENABLED (CONFIG_DPLL )
Signature · 1 line
2.39.3
PATCH v14 9/13 dpll: allow fwnode pins to attempt state change without capability bit
In reply to Grzegorz NitkaPins registered with an fwnode may have .state_on_dpll_set implemented without advertising DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE upfront. Requiring the bit for fwnode pins ties firmware description to driver implementation details unnecessarily.
Relax the capability check in dpll_pin_state_set() and dpll_pin_on_pin_state_set(): when a pin has an associated fwnode, bypass the capability gate and let the ops layer decide, returning -EOPNOTSUPP if .state_on_dpll_set is absent. Non-fwnode pins retain the original strict behavior.
This is used later in the series by the SyncE_Ref output pin, which relies on the fwnode path for state control.
--- drivers/dpll/dpll_netlink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/dpll/dpll_netlink.c +8 -2
@@ -1325,8 +1325,11 @@ dpll_pin_on_pin_state_set(struct dpll_pin *pin, u32 parent_idx,unsigned long i;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops +* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; }
@@ -1361,8 +1364,11 @@ dpll_pin_state_set(struct dpll_device *dpll, struct dpll_pin *pin,struct dpll_pin_ref *ref;int ret; +/* fwnode pins may not set the capability bit upfront; let the ops +* layer return -EOPNOTSUPP if the operation is unsupported. +*/ if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & - pin->prop.capabilities)) { + pin->prop.capabilities) && !pin->fwnode) {NL_SET_ERR_MSG (extack,"state changing is not allowed" );return -EOPNOTSUPP ; }
Signature · 1 line
2.39.3
PATCH v14 10/13 ice: introduce TXC DPLL device and TX ref clock pin framework for E825
In reply to Grzegorz NitkaE825 devices provide a dedicated TX clock (TXC) domain which may be driven by multiple reference clock sources, including external board references and port-derived SyncE. To support future TX clock control and observability through the Linux DPLL subsystem, introduce a separate TXC DPLL device (of DPLL_TYPE_GENERIC) and a framework for representing TX reference clock inputs.
This change adds a new internal DPLL pin type (TXCLK) and registers TX reference clock pins for E825-based devices:
- EXT_EREF0: a board-level external electrical reference
- SYNCE: a port-derived SyncE reference described via firmware nodes
The TXC DPLL device is created and managed alongside the existing PPS and EEC DPLL instances. TXCLK pins are registered directly or deferred via a notifier when backed by fwnode-described pins. A per-pin attribute encodes the TX reference source associated with each TXCLK pin.
At this stage, TXCLK pin state callbacks and TXC DPLL lock status reporting are implemented as placeholders. Pin state getters always return DISCONNECTED, and the TXC DPLL is initialized in the UNLOCKED state. No hardware configuration or TX reference switching is performed yet.
This patch establishes the structural groundwork required for hardware-backed TX reference selection, verification, and synchronization status reporting, which will be implemented in subsequent patches.
Also signal dpll_init from the fwnode pin init error path so any notifier worker already blocked on it can drain, avoiding a flush_workqueue() deadlock during teardown.
--- drivers/net/ethernet/intel/ice/ice_dpll.c | 327 ++++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_dpll.h | 6 + drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 7 + 3 files changed, 315 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/ice/ice_dpll.c +302 -25
@@ -19,6 +19,11 @@#define ICE_DPLL_SW_PIN_INPUT_BASE_QSFP 6#define ICE_DPLL_SW_PIN_OUTPUT_BASE 0 +#define E825_EXT_EREF_PIN_IDX 0 +#define E825_EXT_SYNCE_PIN_IDX 1 +#define E825_RCLK_PARENT_0_PIN_IDX 0 +#define E825_RCLK_PARENT_1_PIN_IDX 1 +#define ICE_DPLL_PIN_SW_INPUT_ABS (in_idx) \ (ICE_DPLL_SW_PIN_INPUT_BASE_SFP + (in_idx))
@@ -57,6 +62,7 @@* @ICE_DPLL_PIN_TYPE_OUTPUT: output pin * @ICE_DPLL_PIN_TYPE_RCLK_INPUT: recovery clock input pin * @ICE_DPLL_PIN_TYPE_SOFTWARE: software controlled SMA/U.FL pins +* @ICE_DPLL_PIN_TYPE_TXCLK: transmit clock reference input pin */ enum ice_dpll_pin_type {ICE_DPLL_PIN_INVALID ,
@@ -64,6 +70,7 @@ enum ice_dpll_pin_type {ICE_DPLL_PIN_TYPE_OUTPUT ,ICE_DPLL_PIN_TYPE_RCLK_INPUT ,ICE_DPLL_PIN_TYPE_SOFTWARE , + ICE_DPLL_PIN_TYPE_TXCLK, }; static const char * const pin_type_name[] = {
@@ -71,10 +78,13 @@ static const char * const pin_type_name[] = { [ICE_DPLL_PIN_TYPE_OUTPUT] = "output", [ICE_DPLL_PIN_TYPE_RCLK_INPUT] = "rclk-input", [ICE_DPLL_PIN_TYPE_SOFTWARE] = "software", + [ICE_DPLL_PIN_TYPE_TXCLK] = "txclk-input", };static const char *const ice_dpll_sw_pin_sma[] = {"SMA1" ,"SMA2" };static const char *const ice_dpll_sw_pin_ufl[] = {"U.FL1" ,"U.FL2" }; +static const char *const ice_dpll_ext_eref_pin ="EXT_EREF0" ; +static const char *const ice_dpll_fwnode_ext_synce ="clk_ref_synce" ;static const struct dpll_pin_frequency ice_esync_range[] = {DPLL_PIN_FREQUENCY_RANGE (0 ,DPLL_PIN_FREQUENCY_1_HZ ),
@@ -2605,12 +2615,75 @@ ice_dpll_rclk_state_on_pin_get(const struct dpll_pin *pin, void *pin_priv,return ret; } +/** +* ice_dpll_txclk_state_on_dpll_set - set a state on TX clk pin +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: registered dpll pointer +* @dpll_priv: private data pointer passed on dpll registration +* @state: state to be set on pin +* @extack: error reporting +* +* Dpll subsystem callback, set a state of a Tx reference clock pin +* +* Return: +* * negative - failure +*/ +static int +ice_dpll_txclk_state_on_dpll_set (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll, +void *dpll_priv,enum dpll_pin_state state, +struct netlink_ext_ack *extack) +{ +/* +* TODO: set HW accordingly to selected TX reference clock. +* To be added in the follow up patches. +*/ +return -EOPNOTSUPP ; +} + +/** +* ice_dpll_txclk_state_on_dpll_get - get a state of Tx clk reference pin +* @pin: pointer to a pin +* @pin_priv: private data pointer passed on pin registration +* @dpll: registered dpll pointer +* @dpll_priv: private data pointer passed on dpll registration +* @state: on success holds pin state on parent pin +* @extack: error reporting +* +* dpll subsystem callback, get a state of a TX clock reference pin. +* +* Return: +* * 0 - success +*/ +static int +ice_dpll_txclk_state_on_dpll_get (const struct dpll_pin *pin,void *pin_priv, +const struct dpll_device *dpll, +void *dpll_priv, +enum dpll_pin_state *state, +struct netlink_ext_ack *extack) +{ +/* +* TODO: query HW status to determine if the TX reference is selected. +* To be added in the follow up patches. +*/ + *state =DPLL_PIN_STATE_DISCONNECTED ; + +return 0 ; +} +static const struct dpll_pin_ops ice_dpll_rclk_ops = { .state_on_pin_set = ice_dpll_rclk_state_on_pin_set, .state_on_pin_get = ice_dpll_rclk_state_on_pin_get, .direction_get = ice_dpll_input_direction, }; +static const struct dpll_pin_ops ice_dpll_txclk_ops = { + .state_on_dpll_set = ice_dpll_txclk_state_on_dpll_set, + .state_on_dpll_get = ice_dpll_txclk_state_on_dpll_get, + .direction_get = ice_dpll_input_direction, +}; +static const struct dpll_pin_ops ice_dpll_pin_sma_ops = { .state_on_dpll_set = ice_dpll_sma_pin_state_set, .state_on_dpll_get = ice_dpll_sw_pin_state_get,
@@ -3133,9 +3206,13 @@ ice_dpll_unregister_pins(struct dpll_device *dpll, struct ice_dpll_pin *pins, {int i; -for (i =0 ; i < count; i++) -if (!pins[i].hidden) -dpll_pin_unregister (dpll, pins[i].pin, ops, &pins[i]); +for (i =0 ; i < count; i++) { +if (pins[i].hidden) +continue ; +if (IS_ERR_OR_NULL (pins[i].pin)) +continue ; +dpll_pin_unregister (dpll, pins[i].pin, ops, &pins[i]); + } }/**
@@ -3309,19 +3386,42 @@ static bool ice_dpll_is_fwnode_pin(struct ice_dpll_pin *pin)return !IS_ERR_OR_NULL (pin->fwnode); } +static bool ice_dpll_fwnode_eq (const struct fwnode_handle *a, +const struct fwnode_handle *b) +{ +return a && a == b; +} +static void ice_dpll_pin_notify_work (struct work_struct *work) {struct ice_dpll_pin_work *w =container_of (work, struct ice_dpll_pin_work, work);struct ice_dpll_pin *pin, *parent = w->pin; +bool is_tx_synce_parent = false;struct ice_pf *pf = parent->pf; +bool is_rclk_parent = false;int ret;wait_for_completion (&pf->dplls.dpll_init);if (!test_bit (ICE_FLAG_DPLL , pf->flags)) goto out;/* DPLL initialization failed */ +/* Decide which parent we are handling, defensively checking FWNs */ +for (int i =0 ; i < pf->dplls.rclk.num_parents; i++) { +if (ice_dpll_fwnode_eq (parent->fwnode, + pf->dplls.inputs[i].fwnode)) { + is_rclk_parent = true; +break ; + } + } + + is_tx_synce_parent = +ice_dpll_fwnode_eq (parent->fwnode, + pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ].fwnode); +if (!is_rclk_parent && !is_tx_synce_parent) + goto out; +switch (w->action) {case DPLL_PIN_CREATED :if (!IS_ERR_OR_NULL (parent->pin)) {
@@ -3338,16 +3438,28 @@ static void ice_dpll_pin_notify_work(struct work_struct *work) goto out; } -/* Register rclk pin */ - pin = &pf->dplls.rclk; - ret =dpll_pin_on_pin_register (parent->pin, pin->pin, - &ice_dpll_rclk_ops, pin); -if (ret) { -dev_err (ice_pf_to_dev (pf), -"Failed to register pin: %pe\n" ,ERR_PTR (ret)); -dpll_pin_put (parent->pin, &parent->tracker); - parent->pin =NULL ; - goto out; +if (is_rclk_parent) { +/* Register rclk pin via on-pin relationship */ + pin = &pf->dplls.rclk; + ret =dpll_pin_on_pin_register (parent->pin, pin->pin, + &ice_dpll_rclk_ops, pin); +if (ret) { +dev_err (ice_pf_to_dev (pf), +"RCLK pin register failed: %pe\n" , +ERR_PTR (ret)); + goto drop_parent_ref; + } + }else if (is_tx_synce_parent) { +/* Register TX-CLK SYNCE pin directly to TXC DPLL */ + pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; + ret =dpll_pin_register (pf->dplls.txc.dpll, pin->pin, + &ice_dpll_txclk_ops, pin); +if (ret) { +dev_err (ice_pf_to_dev (pf), +"TX SYNCE pin register failed: %pe\n" , +ERR_PTR (ret)); + goto drop_parent_ref; + } }break ;case DPLL_PIN_DELETED :
@@ -3356,11 +3468,18 @@ static void ice_dpll_pin_notify_work(struct work_struct *work) goto out; } -/* Unregister rclk pin */ - pin = &pf->dplls.rclk; -dpll_pin_on_pin_unregister (parent->pin, pin->pin, - &ice_dpll_rclk_ops, pin); - +if (is_rclk_parent) { +/* Unregister rclk pin */ + pin = &pf->dplls.rclk; +dpll_pin_on_pin_unregister (parent->pin, pin->pin, + &ice_dpll_rclk_ops, pin); + }else if (is_tx_synce_parent) { +/* Unregister TX-CLK SYNCE pin from TXC DPLL */ + pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; +dpll_pin_unregister (pf->dplls.txc.dpll, pin->pin, + &ice_dpll_txclk_ops, pin); + } +drop_parent_ref:/* Drop fwnode pin reference */ dpll_pin_put (parent->pin, &parent->tracker); parent->pin =NULL ;
@@ -3386,6 +3505,12 @@ static int ice_dpll_pin_notify(struct notifier_block *nb, unsigned long action,if (pin->fwnode != info->fwnode)return NOTIFY_DONE ;/* Not this pin */ +/* Ignore notification which are the outcome of internal pin +* registration/unregistration calls - synce pin case. +*/ +if (info->src_clock_id == pin->pf->dplls.clock_id) +return NOTIFY_DONE ; + work =kzalloc_obj (*work);if (!work)return NOTIFY_DONE ;
@@ -3488,10 +3613,16 @@ ice_dpll_init_rclk_pin(struct ice_pf *pf, int start_idx, }static void -ice_dpll_deinit_fwnode_pin (struct ice_dpll_pin *pin) +ice_dpll_stop_fwnode_pin_activity (struct ice_dpll_pin *pin,bool flush) {unregister_dpll_notifier (&pin->nb); -flush_workqueue (pin->pf->dplls.wq); +if (flush) +flush_workqueue (pin->pf->dplls.wq); +} + +static void +ice_dpll_release_fwnode_pin (struct ice_dpll_pin *pin) +{if (!IS_ERR_OR_NULL (pin->pin)) {dpll_pin_put (pin->pin, &pin->tracker); pin->pin =NULL ;
@@ -3500,6 +3631,13 @@ ice_dpll_deinit_fwnode_pin(struct ice_dpll_pin *pin) pin->fwnode =NULL ; } +static void +ice_dpll_deinit_fwnode_pin (struct ice_dpll_pin *pin) +{ +ice_dpll_stop_fwnode_pin_activity (pin, true); +ice_dpll_release_fwnode_pin (pin); +} +static void ice_dpll_deinit_fwnode_pins (struct ice_pf *pf,struct ice_dpll_pin *pins,int start_idx)
@@ -3511,6 +3649,20 @@ ice_dpll_deinit_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,destroy_workqueue (pf->dplls.wq); } +static int ice_dpll_deinit_txclk_pins (struct ice_pf *pf) +{ +struct ice_dpll_pin *synce_pin = &pf->dplls.txclks[E825_EXT_SYNCE_PIN_IDX ]; +struct ice_dpll *dt = &pf->dplls.txc; + +ice_dpll_stop_fwnode_pin_activity (synce_pin, true); +ice_dpll_unregister_pins (dt->dpll, pf->dplls.txclks, + &ice_dpll_txclk_ops, +ARRAY_SIZE (pf->dplls.txclks)); +ice_dpll_release_pins (&pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ],1 ); +ice_dpll_release_fwnode_pin (synce_pin); +return 0 ; +} +/** * ice_dpll_deinit_pins - deinitialize direct pins * @pf: board private structure
@@ -3530,8 +3682,10 @@ static void ice_dpll_deinit_pins(struct ice_pf *pf, bool cgu)struct ice_dpll *dp = &d->pps;ice_dpll_deinit_rclk_pin (pf); -if (pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) +if (pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) { +ice_dpll_deinit_txclk_pins (pf);ice_dpll_deinit_fwnode_pins (pf, pf->dplls.inputs,0 ); + }if (cgu) {ice_dpll_unregister_pins (dp->dpll, inputs, &ice_dpll_input_ops, num_inputs);
@@ -3654,6 +3808,11 @@ ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,return 0 ; error: +/* +* A notifier worker may already be queued and blocked on dpll_init; +* release it so the per-pin flush below does not deadlock. +*/ +complete_all (&pf->dplls.dpll_init);while (i--)ice_dpll_deinit_fwnode_pin (&pins[start_idx + i]);
@@ -3662,6 +3821,64 @@ ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,return ret; } +static int ice_dpll_init_txclk_pins (struct ice_pf *pf,int start_idx) +{ +struct ice_dpll_pin *ref_pin = pf->dplls.txclks; +struct ice_dpll *txc = &pf->dplls.txc; +int ret; + +/* Configure EXT_EREF0 pin */ + ret =ice_dpll_get_pins (pf, ref_pin, start_idx,1 , pf->dplls.clock_id); +if (ret) +return ret; + ret =dpll_pin_register (txc->dpll, ref_pin->pin, &ice_dpll_txclk_ops, + ref_pin); +if (ret) + goto err_release_ext_eref; + +/* +* Configure EXT_SYNCE pin (fwnode-backed). +* The pin may not yet be available; in that case registration +* will be deferred via the notifier path. +*/ + ref_pin++; + ret =ice_dpll_init_fwnode_pin (ref_pin, ice_dpll_fwnode_ext_synce); +if (ret) + goto err_unregister_ext_eref; + +if (IS_ERR_OR_NULL (ref_pin->pin)) { +dev_dbg (ice_pf_to_dev (pf), +"Tx-clk SYNCE pin not registered yet\n" ); +return 0 ; + } + + ret =dpll_pin_register (txc->dpll, ref_pin->pin, &ice_dpll_txclk_ops, + ref_pin); +if (ret) + goto err_deinit_synce; + +return 0 ; + +err_deinit_synce: +/* +* Avoid deadlock against notifier workers blocked on dpll_init. +* The outer init error path will complete dpll_init and flush the +* shared workqueue before destroying it. +*/ +ice_dpll_stop_fwnode_pin_activity (ref_pin, false); +ice_dpll_release_fwnode_pin (ref_pin); +err_unregister_ext_eref: +dpll_pin_unregister (txc->dpll, + pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ].pin, + &ice_dpll_txclk_ops, + &pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ]); + +err_release_ext_eref: +ice_dpll_release_pins (&pf->dplls.txclks[E825_EXT_EREF_PIN_IDX ],1 ); + +return ret; +} +/** * ice_dpll_init_pins_e825 - init pins and register pins with a dplls * @pf: board private structure
@@ -3684,6 +3901,15 @@ static int ice_dpll_init_pins_e825(struct ice_pf *pf) ret =ice_dpll_init_rclk_pin (pf,DPLL_PIN_IDX_UNSPEC , &ice_dpll_rclk_ops); + +if (ret) + goto unregister_pins; + + ret =ice_dpll_init_txclk_pins (pf,0 ); +if (ret) +ice_dpll_deinit_rclk_pin (pf); + +unregister_pins:if (ret) {/* Inform DPLL notifier works that DPLL init was finished * unsuccessfully (ICE_DPLL_FLAG not set).
@@ -3802,7 +4028,7 @@ static int ice_dpll_init_pins(struct ice_pf *pf, bool cgu)static void ice_dpll_deinit_dpll (struct ice_pf *pf,struct ice_dpll *d,bool cgu) { -if (cgu) +if (cgu || pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 )dpll_device_unregister (d->dpll, d->ops, d);dpll_device_put (d->dpll, &d->tracker); }
@@ -3837,12 +4063,13 @@ ice_dpll_init_dpll(struct ice_pf *pf, struct ice_dpll *d, bool cgu,return ret; } d->pf = pf; -if (cgu) { +if (cgu || pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) {const struct dpll_device_ops *ops = &ice_dpll_ops;if (type ==DPLL_TYPE_PPS &&ice_dpll_is_pps_phase_monitor (pf)) ops = &ice_dpll_pom_ops; -ice_dpll_update_state (pf, d, true); +if (cgu) +ice_dpll_update_state (pf, d, true); ret =dpll_device_register (d->dpll, type, ops, d);if (ret) {dpll_device_put (d->dpll, &d->tracker);
@@ -4208,6 +4435,36 @@ static int ice_dpll_init_info_sw_pins(struct ice_pf *pf)return 0 ; } +/** +* ice_dpll_init_info_txclk_pins_e825c - initializes tx-clk pins information +* @pf: board private structure +* +* Init information for tx-clks pin, cache them in pf->dplls.txclks +* +* Return: +* * 0 - success +*/ +static int ice_dpll_init_info_txclk_pins_e825c (struct ice_pf *pf) +{ +struct ice_dpll_pin *tx_pin; + +for (int i =0 ; i <ICE_DPLL_TXCLK_NUM_MAX ; i++) { + tx_pin = &pf->dplls.txclks[i]; + tx_pin->prop.type =DPLL_PIN_TYPE_EXT ; + tx_pin->prop.capabilities |= +DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE ; + tx_pin->pf = pf; +if (i ==E825_EXT_EREF_PIN_IDX ) { + tx_pin->prop.board_label = ice_dpll_ext_eref_pin; + tx_pin->tx_ref_src =ICE_REF_CLK_EREF0 ; + }else if (i ==E825_EXT_SYNCE_PIN_IDX ) { + tx_pin->tx_ref_src =ICE_REF_CLK_SYNCE ; + } + } + +return 0 ; +} +/** * ice_dpll_init_pins_info - init pins info wrapper * @pf: board private structure
@@ -4233,6 +4490,9 @@ ice_dpll_init_pins_info(struct ice_pf *pf, enum ice_dpll_pin_type pin_type)return ice_dpll_init_info_rclk_pin (pf);case ICE_DPLL_PIN_TYPE_SOFTWARE :return ice_dpll_init_info_sw_pins (pf); + +case ICE_DPLL_PIN_TYPE_TXCLK : +return ice_dpll_init_info_txclk_pins_e825c (pf);default :return -EINVAL ; }
@@ -4266,11 +4526,15 @@ static void ice_dpll_deinit_info(struct ice_pf *pf)static int ice_dpll_init_info_e825c (struct ice_pf *pf) {struct ice_dplls *d = &pf->dplls; +struct ice_dpll *dt = &d->txc;int ret =0 ;int i; d->clock_id =ice_generate_clock_id (pf); d->num_inputs =ICE_SYNCE_CLK_NUM ; + dt->dpll_state =DPLL_LOCK_STATUS_UNLOCKED ; + dt->mode =DPLL_MODE_MANUAL ; + dt->dpll_idx = pf->ptp.port.port_num; d->inputs =kzalloc_objs (*d->inputs, d->num_inputs);if (!d->inputs)
@@ -4287,6 +4551,11 @@ static int ice_dpll_init_info_e825c(struct ice_pf *pf) ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_RCLK_INPUT );if (ret) goto deinit_info; + + ret =ice_dpll_init_pins_info (pf,ICE_DPLL_PIN_TYPE_TXCLK ); +if (ret) + goto deinit_info; +dev_dbg (ice_pf_to_dev (pf),"%s - success, inputs: %u, outputs: %u, rclk-parents: %u\n" , __func__, d->num_inputs, d->num_outputs, d->rclk.num_parents);
@@ -4419,6 +4688,9 @@ void ice_dpll_deinit(struct ice_pf *pf)ice_dpll_deinit_dpll (pf, &pf->dplls.pps, cgu);if (!IS_ERR_OR_NULL (pf->dplls.eec.dpll))ice_dpll_deinit_dpll (pf, &pf->dplls.eec, cgu); +if (!IS_ERR_OR_NULL (pf->dplls.txc.dpll)) +ice_dpll_deinit_dpll (pf, &pf->dplls.txc, false); +ice_dpll_deinit_info (pf);mutex_destroy (&pf->dplls.lock); }
@@ -4444,14 +4716,19 @@ static void ice_dpll_init_e825(struct ice_pf *pf) err =ice_dpll_init_info_e825c (pf);if (err) goto err_exit; - err =ice_dpll_init_pins_e825 (pf); + err =ice_dpll_init_dpll (pf, &pf->dplls.txc, false,DPLL_TYPE_GENERIC );if (err) goto deinit_info; + err =ice_dpll_init_pins_e825 (pf); +if (err) + goto deinit_txclk;set_bit (ICE_FLAG_DPLL , pf->flags);complete_all (&d->dpll_init);return ; +deinit_txclk: +ice_dpll_deinit_dpll (pf, &pf->dplls.txc, false); deinit_info:ice_dpll_deinit_info (pf); err_exit:
drivers/net/ethernet/intel/ice/ice_dpll.h +6 -0
@@ -7,6 +7,7 @@#include "ice.h" #define ICE_DPLL_RCLK_NUM_MAX 4 +#define ICE_DPLL_TXCLK_NUM_MAX 2#define ICE_CGU_R10 0x28#define ICE_CGU_R10_SYNCE_CLKO_SEL GENMASK(8, 5)
@@ -79,6 +80,7 @@ struct ice_dpll_pin {u8 ref_sync;bool active;bool hidden; +enum ice_e825c_ref_clk tx_ref_src; };/** ice_dpll - store info required for DPLL control
@@ -127,9 +129,11 @@ struct ice_dpll {* @lock: locks access to configuration of a dpll * @eec: pointer to EEC dpll dev * @pps: pointer to PPS dpll dev +* @txc: pointer to TXC dpll dev * @inputs: input pins pointer * @outputs: output pins pointer * @rclk: recovered pins pointer +* @txclks: TX clock reference pins pointer * @num_inputs: number of input pins available on dpll * @num_outputs: number of output pins available on dpll * @cgu_state_acq_err_num: number of errors returned during periodic work
@@ -147,11 +151,13 @@ struct ice_dplls {struct completion dpll_init;struct ice_dpll eec;struct ice_dpll pps; +struct ice_dpll txc;struct ice_dpll_pin *inputs;struct ice_dpll_pin *outputs;struct ice_dpll_pin sma[ICE_DPLL_PIN_SW_NUM ];struct ice_dpll_pin ufl[ICE_DPLL_PIN_SW_NUM ];struct ice_dpll_pin rclk; +struct ice_dpll_pin txclks[ICE_DPLL_TXCLK_NUM_MAX ];u8 num_inputs;u8 num_outputs;u8 sma_data;
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +7 -0
@@ -265,6 +265,13 @@ struct ice_cgu_pin_desc {struct dpll_pin_frequency *freq_supp; }; +enum ice_e825c_ref_clk { +ICE_REF_CLK_ENET , +ICE_REF_CLK_SYNCE , +ICE_REF_CLK_EREF0 , +ICE_REF_CLK_MAX , +}; +#define E810C_QSFP_C827_0_HANDLE 2#define E810C_QSFP_C827_1_HANDLE 3
Signature · 1 line
2.39.3
PATCH v14 11/13 ice: implement CPI support for E825C
In reply to Grzegorz NitkaAdd full CPI (Converged PHY Interface) command handling required for E825C devices. The CPI interface allows the driver to interact with PHY-side control logic through the LM/PHY command registers, including enabling/disabling/selection of PHY reference clock.
This patch introduces:
- a new CPI subsystem (ice_cpi.c / ice_cpi.h) implementing the CPI request/acknowledge state machine, including REQ/ACK protocol, command execution, and response handling
- helper functions for reading/writing PHY registers over Sideband Queue
- CPI command execution API (ice_cpi_exec) and a helper for enabling or disabling Tx reference clocks (CPI 0xF1 opcode 'Config PHY clocking')
- assurance of CPI transaction serialization into the CPI core.
CPI REQ/ACK is a multi-step handshake and must be executed
atomically per PHY. Centralize the lock in ice_cpi_exec() and use adapter-scoped per-PHY mutexes, which match the hardware sharing model across PFs.
- addition of the non-posted write opcode (wr_np) to SBQ
- Makefile integration to build CPI support together with the PTP stack
This provides the infrastructure necessary to support PHY-side configuration flows on E825C and is required for advanced link control and Tx reference clock management.
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice_adapter.c | 4 + drivers/net/ethernet/intel/ice/ice_adapter.h | 7 + drivers/net/ethernet/intel/ice/ice_cpi.c | 362 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_cpi.h | 58 +++ drivers/net/ethernet/intel/ice/ice_dpll.c | 11 + drivers/net/ethernet/intel/ice/ice_sbq_cmd.h | 5 +- drivers/net/ethernet/intel/ice/ice_type.h | 2 + 8 files changed, 448 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.c create mode 100644 drivers/net/ethernet/intel/ice/ice_cpi.h
drivers/net/ethernet/intel/ice/Makefile +1 -1
@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o +ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o ice_cpi.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
drivers/net/ethernet/intel/ice/ice_adapter.c +4 -0
@@ -62,6 +62,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev) adapter->index =ice_adapter_index (pdev);spin_lock_init (&adapter->ptp_gltsyn_time_lock);spin_lock_init (&adapter->txq_ctx_lock); +for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++) +mutex_init (&adapter->cpi_phy_lock[i]);refcount_set (&adapter->refcount,1 );mutex_init (&adapter->ports.lock);
@@ -73,6 +75,8 @@ static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev)static void ice_adapter_free (struct ice_adapter *adapter) {WARN_ON (!list_empty (&adapter->ports.ports)); +for (int i =0 ; i <ARRAY_SIZE (adapter->cpi_phy_lock); i++) +mutex_destroy (&adapter->cpi_phy_lock[i]);mutex_destroy (&adapter->ports.lock);kfree (adapter);
drivers/net/ethernet/intel/ice/ice_adapter.h +7 -0
@@ -5,9 +5,12 @@#define _ICE_ADAPTER_H_#include <linux/types.h> +#include <linux/mutex.h> #include <linux/spinlock_types.h> #include <linux/refcount_types.h> +#include "ice_type.h" +struct pci_dev ;struct ice_pf ;
@@ -31,6 +34,8 @@ struct ice_port_list {* @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME * register of the PTP clock. * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register +* @cpi_phy_lock: Per-PHY mutex serializing CPI REQ/ACK transactions. +* Index 0 = PHY0, index 1 = PHY1. Used on E825C devices. * @ctrl_pf: Control PF of the adapter * @ports: Ports list * @index: 64-bit index cached for collision detection on 32bit systems
@@ -41,6 +46,8 @@ struct ice_adapter {spinlock_t ptp_gltsyn_time_lock;/* For access to GLCOMM_QTX_CNTX_CTL register */ spinlock_t txq_ctx_lock; +/* Serialize CPI REQ/ACK transactions per PHY (E825C only) */ +struct mutex cpi_phy_lock[ICE_E825_MAX_PHYS ];struct ice_pf *ctrl_pf;struct ice_port_list ports;
drivers/net/ethernet/intel/ice/ice_cpi.c new file +362 -0
362 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_cpi.h new file +58 -0
58 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_dpll.c +11 -0
@@ -4710,6 +4710,17 @@ static void ice_dpll_init_e825(struct ice_pf *pf)struct ice_dplls *d = &pf->dplls;int err; +/* E825 sets ICE_F_PHY_RCLK unconditionally, so DPLL may run without +* PTP. Populate the HW-topology fields the TX-clk path divides by, +* otherwise userspace can trigger div-by-zero in ice_txclk_set_clk(). +* When PTP is supported, ice_ptp_init() handles this. +*/ +if (!test_bit (ICE_FLAG_PTP_SUPPORTED , pf->flags)) { +ice_ptp_init_hw (&pf->hw); +if (pf->hw.lane_num >=0 ) + pf->ptp.port.port_num = pf->hw.lane_num; + } +mutex_init (&d->lock);init_completion (&d->dpll_init);
drivers/net/ethernet/intel/ice/ice_sbq_cmd.h +3 -2
@@ -54,8 +54,9 @@ enum ice_sbq_dev_id { };enum ice_sbq_msg_opcode { - ice_sbq_msg_rd =0x00 , - ice_sbq_msg_wr =0x01 + ice_sbq_msg_rd =0x00 , + ice_sbq_msg_wr =0x01 , + ice_sbq_msg_wr_np =0x02 };#define ICE_SBQ_MSG_FLAGS 0x40
drivers/net/ethernet/intel/ice/ice_type.h +2 -0
@@ -893,6 +893,8 @@ struct ice_ptp_hw {u8 ports_per_phy; }; +#define ICE_E825_MAX_PHYS 2 +/* Port hardware description */ struct ice_hw {u8 __iomem *hw_addr;
Signature · 1 line
2.39.3
PATCH v14 12/13 ice: add Tx reference clock index handling to AN restart command
In reply to Grzegorz NitkaExtend the Restart Auto-Negotiation (AN) AdminQ command with a new parameter allowing software to specify the Tx reference clock index to be used during link restart.
This patch:
- adds REFCLK field definitions to ice_aqc_restart_an
- updates ice_aq_set_link_restart_an() to take a new refclk parameter and properly encode it into the command
- keeps legacy behavior by passing REFCLK_NOCHANGE where appropriate
This prepares the driver for configurations requiring dynamic selection of the Tx reference clock as part of the AN flow.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 2 ++ drivers/net/ethernet/intel/ice/ice_common.c | 5 ++++- drivers/net/ethernet/intel/ice/ice_common.h | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -1169,6 +1169,8 @@ struct ice_aqc_restart_an {u8 cmd_flags;#define ICE_AQC_RESTART_AN_LINK_RESTART BIT(1)#define ICE_AQC_RESTART_AN_LINK_ENABLE BIT(2) +#define ICE_AQC_RESTART_AN_REFCLK_M GENMASK(4, 3) +#define ICE_AQC_RESTART_AN_REFCLK_NOCHANGE 0u8 reserved2[13 ]; };
drivers/net/ethernet/intel/ice/ice_common.c +4 -1
@@ -4124,12 +4124,13 @@ int ice_get_link_status(struct ice_port_info *pi, bool *link_up)* @pi: pointer to the port information structure * @ena_link: if true: enable link, if false: disable link * @cd: pointer to command details structure or NULL +* @refclk: the new TX reference clock, 0 if no change * * Sets up the link and restarts the Auto-Negotiation over the link. */ int ice_aq_set_link_restart_an (struct ice_port_info *pi,bool ena_link, -struct ice_sq_cd *cd) +struct ice_sq_cd *cd,u8 refclk) {struct ice_aqc_restart_an *cmd;struct libie_aq_desc desc;
@@ -4145,6 +4146,8 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,else cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE ; + cmd->cmd_flags |=FIELD_PREP (ICE_AQC_RESTART_AN_REFCLK_M , refclk); +return ice_aq_send_cmd (pi->hw, &desc,NULL ,0 , cd); }
drivers/net/ethernet/intel/ice/ice_common.h +1 -1
@@ -215,7 +215,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fec_mode fec);int ice_aq_set_link_restart_an (struct ice_port_info *pi,bool ena_link, -struct ice_sq_cd *cd); +struct ice_sq_cd *cd,u8 refclk);int ice_aq_set_mac_cfg (struct ice_hw *hw,u16 max_frame_size,struct ice_sq_cd *cd);int
drivers/net/ethernet/intel/ice/ice_lib.c +2 -1
@@ -3769,7 +3769,8 @@ int ice_set_link(struct ice_vsi *vsi, bool ena)if (vsi->type !=ICE_VSI_PF )return -EINVAL ; - status =ice_aq_set_link_restart_an (pi, ena,NULL ); + status =ice_aq_set_link_restart_an (pi, ena,NULL , +ICE_AQC_RESTART_AN_REFCLK_NOCHANGE );/* if link is owned by manageability, FW will return LIBIE_AQ_RC_EMODE. * this is not a fatal error, so print a warning message and return
Signature · 1 line
2.39.3
PATCH v14 13/13 ice: implement E825 TX ref clock control and TXC hardware sync status
In reply to Grzegorz NitkaBuild on the previously introduced TXC DPLL framework and implement full TX reference clock control and hardware-backed synchronization status reporting for E825 devices.
E825 firmware may accept or override TX reference clock requests based on device-wide routing constraints and link conditions. Because the final selection becomes visible only after a link-up event, the driver splits the observation into two complementary signals:
- TXCLK pin state reflects the requested TX reference clock (pf->ptp.port.tx_clk_req). After a link-up, the value is reconciled against the SERDES reference selector by ice_txclk_update_and_notify(); if firmware or auto-negotiation selected a different clock, tx_clk_req is overwritten so that pin state converges to the actual hardware selection.
- TXC DPLL lock status reflects hardware synchronization:
* LOCKED when an external TX reference is in use
* UNLOCKED when falling back to ENET/TXCO, or when a requested external reference has not (yet) been accepted by hardware.
Userspace observing only pin state therefore sees user intent, while lock status is the authoritative indicator of whether the requested clock is actually selected and synchronizing. This matches the DPLL subsystem model where pin state describes topology and device lock status describes signal quality.
TX reference selection topology:
- External references (SYNCE, EREF0) are represented as TXCLK pins
- The internal ENET/TXCO clock has no pin representation; when selected, all TXCLK pins are reported DISCONNECTED
With this change, TX reference clocks on E825 devices can be reliably selected, observed via standard DPLL interfaces, and monitored for effective synchronization through TXC DPLL lock status.
--- drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice.h | 12 + drivers/net/ethernet/intel/ice/ice_dpll.c | 188 ++++++++++- drivers/net/ethernet/intel/ice/ice_dpll.h | 30 +- drivers/net/ethernet/intel/ice/ice_ptp.c | 37 +- drivers/net/ethernet/intel/ice/ice_ptp.h | 6 + drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 37 ++ drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 10 + drivers/net/ethernet/intel/ice/ice_txclk.c | 354 ++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_txclk.h | 40 +++ 10 files changed, 696 insertions(+), 20 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.c create mode 100644 drivers/net/ethernet/intel/ice/ice_txclk.h
drivers/net/ethernet/intel/ice/Makefile +1 -1
@@ -54,7 +54,7 @@ ice-$(CONFIG_PCI_IOV) += \ ice_vf_mbx.o \ ice_vf_vsi_vlan_ops.o \ ice_vf_lib.o -ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o ice_cpi.o +ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o ice_tspll.o ice_cpi.o ice_txclk.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
drivers/net/ethernet/intel/ice/ice.h +12 -0
@@ -1155,4 +1155,16 @@ static inline struct ice_hw *ice_get_primary_hw(struct ice_pf *pf) else return &pf->adapter->ctrl_pf->hw; } + +/** +* ice_get_ctrl_pf - Get pointer to Control PF of the adapter +* @pf: pointer to the current PF structure +* +* Return: A pointer to ice_pf structure which is Control PF, +* NULL if it's not initialized yet. +*/ +static inline struct ice_pf *ice_get_ctrl_pf (struct ice_pf *pf) +{ +return !pf->adapter ?NULL : pf->adapter->ctrl_pf; +}#endif /* _ICE_H_ */
drivers/net/ethernet/intel/ice/ice_dpll.c +175 -13
263 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_dpll.h +29 -1
@@ -8,6 +8,8 @@#define ICE_DPLL_RCLK_NUM_MAX 4#define ICE_DPLL_TXCLK_NUM_MAX 2 +#define E825_EXT_EREF_PIN_IDX 0 +#define E825_EXT_SYNCE_PIN_IDX 1#define ICE_CGU_R10 0x28#define ICE_CGU_R10_SYNCE_CLKO_SEL GENMASK(8, 5)
@@ -126,7 +128,8 @@ struct ice_dpll {/** ice_dplls - store info required for CCU (clock controlling unit) * @kworker: periodic worker * @work: periodic work -* @lock: locks access to configuration of a dpll +* @wq: workqueue used to schedule DPLL-related deferred work +* @lock: protects DPLL configuration (see Locking below) * @eec: pointer to EEC dpll dev * @pps: pointer to PPS dpll dev * @txc: pointer to TXC dpll dev
@@ -142,6 +145,28 @@ struct ice_dpll {* @input_phase_adj_max: max phase adjust value for an input pins * @output_phase_adj_max: max phase adjust value for an output pins * @periodic_counter: counter of periodic work executions +* @generic: true when generic DPLL ops are used +* @txclk_work: deferred TX reference clock switch worker +* @txclk_switch_requested: a TX ref clock switch is queued in @txclk_work +* @txclk_notify_rwsem: drains in-flight TXCLK notifications on teardown +* +* Locking: +* Acquisition order (top to bottom): +* +* txclk_notify_rwsem (read) +* -> pf->dplls.lock +* -> ctrl_pf->dplls.lock +* +* - @lock serializes all DPLL state mutations on this PF. When the +* controlling PF's lock must also be taken (e.g. updating the shared +* tx_refclks usage map), acquire pf->dplls.lock first, then +* ctrl_pf->dplls.lock. Skip the second acquire when pf == ctrl_pf +* to avoid recursive locking. +* - @txclk_notify_rwsem is held for read across +* ice_txclk_update_and_notify(), including the out-of-lock +* dpll_*_change_ntf() calls. ice_dpll_deinit() takes the write side +* standalone (not nested under any other lock) to drain in-flight +* readers before pins and the TXC DPLL device are freed. */ struct ice_dplls {struct kthread_worker *kworker;
@@ -168,6 +193,9 @@ struct ice_dplls {s32 output_phase_adj_max;u32 periodic_counter;bool generic; +struct work_struct txclk_work; +bool txclk_switch_requested; +struct rw_semaphore txclk_notify_rwsem; };#if IS_ENABLED (CONFIG_PTP_1588_CLOCK )
drivers/net/ethernet/intel/ice/ice_ptp.c +32 -5
@@ -4,6 +4,7 @@#include "ice.h" #include "ice_lib.h" #include "ice_trace.h" +#include "ice_txclk.h" static const char ice_pin_names[][64 ] = {"SDP0" ,
@@ -54,11 +55,6 @@ static const struct ice_ptp_pin_desc ice_pin_desc_dpll[] = { { SDP3, { 3, -1 }, { 0, 0 }}, }; -static struct ice_pf *ice_get_ctrl_pf (struct ice_pf *pf) -{ -return !pf->adapter ?NULL : pf->adapter->ctrl_pf; -} -static struct ice_ptp *ice_get_ctrl_ptp (struct ice_pf *pf) {struct ice_pf *ctrl_pf =ice_get_ctrl_pf (pf);
@@ -1328,6 +1324,9 @@ void ice_ptp_link_change(struct ice_pf *pf, bool linkup) } }mutex_unlock (&pf->dplls.lock); + +if (linkup) +ice_txclk_update_and_notify (pf); }switch (hw->mac_type) {
@@ -3090,6 +3089,21 @@ static int ice_ptp_setup_pf(struct ice_pf *pf) &pf->adapter->ports.ports);mutex_unlock (&pf->adapter->ports.lock); +/* Seed the per-PHY Tx reference clock usage map for this port. +* Only meaningful on E825 (other MAC types don't expose tx-clk +* selection). No locking is needed because this runs during +* ice_ptp_init() before pf->dplls.lock exists and before any +* link event or DPLL callback can observe the map. +*/ +if (pf->hw.mac_type ==ICE_MAC_GENERIC_3K_E825 ) { +u8 port_num, phy; + + port_num = ptp->port.port_num; + phy = port_num / pf->hw.ptp.ports_per_phy; +set_bit (port_num, + &ctrl_ptp->tx_refclks[phy][pf->ptp.port.tx_clk]); + } +return 0 ; }
@@ -3318,6 +3332,19 @@ void ice_ptp_init(struct ice_pf *pf) goto err_exit; } + ptp->port.tx_clk =ICE_REF_CLK_ENET ; + ptp->port.tx_clk_req =ICE_REF_CLK_ENET ; +if (hw->mac_type ==ICE_MAC_GENERIC_3K_E825 ) { +enum ice_e825c_ref_clk tx_ref_clk; + + err =ice_get_serdes_ref_sel_e825c (hw, ptp->port.port_num, + &tx_ref_clk); +if (!err) { + ptp->port.tx_clk = tx_ref_clk; + ptp->port.tx_clk_req = tx_ref_clk; + } + } + err =ice_ptp_setup_pf (pf);if (err) goto err_exit;
drivers/net/ethernet/intel/ice/ice_ptp.h +6 -0
@@ -144,6 +144,8 @@ struct ice_ptp_tx {* @link_up: indicates whether the link is up * @tx_fifo_busy_cnt: number of times the Tx FIFO was busy * @port_num: the port number this structure represents +* @tx_clk: currently active Tx reference clock source +* @tx_clk_req: requested Tx reference clock source (new target) */ struct ice_ptp_port {struct list_head list_node;
@@ -153,6 +155,8 @@ struct ice_ptp_port {bool link_up;u8 tx_fifo_busy_cnt;u8 port_num; +enum ice_e825c_ref_clk tx_clk; +enum ice_e825c_ref_clk tx_clk_req; };enum ice_ptp_tx_interrupt {
@@ -236,6 +240,7 @@ struct ice_ptp_pin_desc {* @info: structure defining PTP hardware capabilities * @clock: pointer to registered PTP clock device * @tstamp_config: hardware timestamping configuration +* @tx_refclks: bitmaps table to store the information about TX reference clocks * @reset_time: kernel time after clock stop on reset * @tx_hwtstamp_good: number of completed Tx timestamp requests * @tx_hwtstamp_skipped: number of Tx time stamp requests skipped
@@ -261,6 +266,7 @@ struct ice_ptp {struct ptp_clock_info info;struct ptp_clock *clock;struct kernel_hwtstamp_config tstamp_config; +unsigned long tx_refclks[ICE_E825_MAX_PHYS ][ICE_REF_CLK_MAX ];u64 reset_time;u64 tx_hwtstamp_good;u32 tx_hwtstamp_skipped;
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +37 -0
@@ -486,6 +486,43 @@ static int ice_read_phy_eth56g(struct ice_hw *hw, u8 port, u32 addr, u32 *val)return err; } +/** +* ice_get_serdes_ref_sel_e825c - Read current Tx ref clock source +* @hw: pointer to the HW struct +* @port: port number for which Tx reference clock is read +* @clk: Tx reference clock value (output) +* +* Return: 0 on success, other error codes when failed to read from PHY +*/ +int ice_get_serdes_ref_sel_e825c (struct ice_hw *hw,u8 port, +enum ice_e825c_ref_clk *clk) +{ +u8 lane = port % hw->ptp.ports_per_phy; +u32 serdes_rx_nt, serdes_tx_nt; +u32 val; +int ret; + + ret =ice_read_phy_eth56g (hw, port, +SERDES_IP_IF_LN_FLXM_GENERAL (lane,0 ), + &val); +if (ret) +return ret; + + serdes_rx_nt =FIELD_GET (CFG_ICTL_PCS_REF_SEL_RX_NT , val); + serdes_tx_nt =FIELD_GET (CFG_ICTL_PCS_REF_SEL_TX_NT , val); + +if (serdes_tx_nt ==REF_SEL_NT_SYNCE && + serdes_rx_nt ==REF_SEL_NT_SYNCE ) + *clk =ICE_REF_CLK_SYNCE ; +else if (serdes_tx_nt ==REF_SEL_NT_EREF0 && + serdes_rx_nt ==REF_SEL_NT_EREF0 ) + *clk =ICE_REF_CLK_EREF0 ; +else + *clk =ICE_REF_CLK_ENET ; + +return 0 ; +} +/** * ice_phy_res_address_eth56g - Calculate a PHY port register address * @hw: pointer to the HW struct
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +10 -0
@@ -383,6 +383,8 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port);int ice_phy_cfg_intr_eth56g (struct ice_hw *hw,u8 port,bool ena,u8 threshold);int ice_phy_cfg_ptp_1step_eth56g (struct ice_hw *hw,u8 port);int ice_ptp_phy_soft_reset_eth56g (struct ice_hw *hw,u8 port); +int ice_get_serdes_ref_sel_e825c (struct ice_hw *hw,u8 port, +enum ice_e825c_ref_clk *clk);#define ICE_ETH56G_NOMINAL_INCVAL 0x140000000ULL#define ICE_ETH56G_NOMINAL_PCS_REF_TUS 0x100000000ULL
@@ -795,4 +797,12 @@ static inline u64 ice_get_base_incval(struct ice_hw *hw)#define PHY_PTP_1STEP_PD_DELAY_M GENMASK(30, 1)#define PHY_PTP_1STEP_PD_DLY_V_M BIT(31) +#define SERDES_IP_IF_LN_FLXM_GENERAL (n, m) \ + (0x32B800 + (m) * 0x100000 + (n) * 0x8000) +#define CFG_ICTL_PCS_REF_SEL_RX_NT GENMASK(9, 6) +#define CFG_ICTL_PCS_REF_SEL_TX_NT GENMASK(28, 25) +#define REF_SEL_NT_ENET 0 +#define REF_SEL_NT_EREF0 1 +#define REF_SEL_NT_SYNCE 2 +#endif /* _ICE_PTP_HW_H_ */
drivers/net/ethernet/intel/ice/ice_txclk.c new file +354 -0
354 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txclk.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2026 Intel Corporation */ + +#ifndef _ICE_TXCLK_H_ +#define _ICE_TXCLK_H_ + +/** +* ice_txclk_any_port_uses - check if any port on a PHY uses this TX refclk +* @ctrl_pf: control PF (owner of the shared tx_refclks map) +* @phy: PHY index +* @clk: TX reference clock +* +* Return: true if any bit (port) is set for this clock on this PHY +*/ +static inline bool +ice_txclk_any_port_uses (const struct ice_pf *ctrl_pf,u8 phy, +enum ice_e825c_ref_clk clk) +{ +return find_first_bit (&ctrl_pf->ptp.tx_refclks[phy][clk], +BITS_PER_LONG ) <BITS_PER_LONG ; +} + +static inline enum dpll_lock_status +ice_txclk_lock_status (enum ice_e825c_ref_clk clk) +{ +switch (clk) { +case ICE_REF_CLK_SYNCE : +case ICE_REF_CLK_EREF0 : +return DPLL_LOCK_STATUS_LOCKED ; +case ICE_REF_CLK_ENET : +default : +return DPLL_LOCK_STATUS_UNLOCKED ; + } +} + +int ice_txclk_set_clk (struct ice_pf *pf,enum ice_e825c_ref_clk clk); +void ice_txclk_update_and_notify (struct ice_pf *pf); +struct dpll_pin *ice_txclk_get_pin (struct ice_pf *pf, +enum ice_e825c_ref_clk ref_clk); +#endif /* _ICE_TXCLK_H_ */
Signature · 1 line
2.39.3
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Sun, 7 Jun 2026 20:30:32 +0200 you wrote:
NOTE: This series is intentionally submitted on net-next (not intel-wired-lan) as early feedback of DPLL subsystem changes is welcomed. In the past possible approaches were discussed in [1].
This series adds TX reference clock support for E825 devices and exposes TX clock selection and synchronization status via the Linux DPLL subsystem.
[...]
Here is the summary with links:
- [v14,net-next,01/13] dpll: add generic DPLL type
https://git.kernel.org/netdev/net-next/c/9375487c0c78 - [v14,net-next,02/13] dpll: allow registering FW-identified pin with a different DPLL https://git.kernel.org/netdev/net-next/c/c191b319f208 - [v14,net-next,03/13] dpll: fix stale iteration in dpll_pin_on_pin_unregister() https://git.kernel.org/netdev/net-next/c/32239d600236 - [v14,net-next,04/13] dpll: send delete notification before unregister in on-pin rollback https://git.kernel.org/netdev/net-next/c/e83b403eb142 - [v14,net-next,05/13] dpll: emit per-dpll delete notifications in dpll_pin_on_pin_unregister() https://git.kernel.org/netdev/net-next/c/df0ba51ccf87 - [v14,net-next,06/13] dpll: guard sync-pair removal on full pin unregister https://git.kernel.org/netdev/net-next/c/0a5c720a7d57 - [v14,net-next,07/13] dpll: balance create/delete notifications in __dpll_pin_(un)register https://git.kernel.org/netdev/net-next/c/1a2292101c0d - [v14,net-next,08/13] dpll: extend pin notifier with notification source ID https://git.kernel.org/netdev/net-next/c/0bf47f722fa9 - [v14,net-next,09/13] dpll: allow fwnode pins to attempt state change without capability bit https://git.kernel.org/netdev/net-next/c/521b6d5de08d - [v14,net-next,10/13] ice: introduce TXC DPLL device and TX ref clock pin framework for E825 https://git.kernel.org/netdev/net-next/c/5db36ee62849 - [v14,net-next,11/13] ice: implement CPI support for E825C https://git.kernel.org/netdev/net-next/c/fff4ed70ca9b - [v14,net-next,12/13] ice: add Tx reference clock index handling to AN restart command https://git.kernel.org/netdev/net-next/c/4128bda8fc1d - [v14,net-next,13/13] ice: implement E825 TX ref clock control and TXC hardware sync status https://git.kernel.org/netdev/net-next/c/e075d7768386
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html