Skip to content

Commit 1a41b58

Browse files
orospPaolo Abeni
authored andcommitted
ice: fix missing dpll notifications for SW pins
The SMA/U.FL pin redesign (commit 2dd5d03 ("ice: redesign dpll sma/u.fl pins control")) introduced software-controlled pins that wrap backing CGU input/output pins, but never updated the notification and data paths to propagate pin events to these SW wrappers. The periodic work sends dpll_pin_change_ntf() only for direct CGU input pins. SW pins that wrap these inputs never receive change or phase offset notifications, so userspace consumers such as synce4l monitoring SMA pins via dpll netlink never learn about state transitions or phase offset updates. Similarly, ice_dpll_phase_offset_get() reads the SW pin's own phase_offset field which is never updated; the PPS monitor writes to the backing CGU input's field instead. Fix by introducing ice_dpll_pin_ntf(), a wrapper around dpll_pin_change_ntf() that also notifies any registered SMA/U.FL pin whose backing CGU input matches. Replace all direct dpll_pin_change_ntf() calls in the periodic notification paths with this wrapper. Fix ice_dpll_phase_offset_get() to return the backing CGU input's phase_offset for input-direction SW pins. Fixes: 2dd5d03 ("ice: redesign dpll sma/u.fl pins control") Signed-off-by: Petr Oros <poros@redhat.com> Tested-by: Alexander Nowlin <alexander.nowlin@intel.com> Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20260427-jk-iwl-net-petr-oros-fixes-v1-10-cdcb48303fd8@intel.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 620055c commit 1a41b58

1 file changed

Lines changed: 36 additions & 11 deletions

File tree

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,10 @@ ice_dpll_phase_offset_get(const struct dpll_pin *pin, void *pin_priv,
19631963
d->active_input == p->input->pin))
19641964
*phase_offset = d->phase_offset * ICE_DPLL_PHASE_OFFSET_FACTOR;
19651965
else if (d->phase_offset_monitor_period)
1966-
*phase_offset = p->phase_offset * ICE_DPLL_PHASE_OFFSET_FACTOR;
1966+
*phase_offset = (p->input &&
1967+
p->direction == DPLL_PIN_DIRECTION_INPUT ?
1968+
p->input->phase_offset :
1969+
p->phase_offset) * ICE_DPLL_PHASE_OFFSET_FACTOR;
19671970
else
19681971
*phase_offset = 0;
19691972
mutex_unlock(&pf->dplls.lock);
@@ -2657,6 +2660,27 @@ static u64 ice_generate_clock_id(struct ice_pf *pf)
26572660
return pci_get_dsn(pf->pdev);
26582661
}
26592662

2663+
/**
2664+
* ice_dpll_pin_ntf - notify pin change including any SW pin wrappers
2665+
* @dplls: pointer to dplls struct
2666+
* @pin: the dpll_pin that changed
2667+
*
2668+
* Send a change notification for @pin and for any registered SMA/U.FL pin
2669+
* whose backing CGU input matches @pin.
2670+
*/
2671+
static void ice_dpll_pin_ntf(struct ice_dplls *dplls, struct dpll_pin *pin)
2672+
{
2673+
dpll_pin_change_ntf(pin);
2674+
for (int i = 0; i < ICE_DPLL_PIN_SW_NUM; i++) {
2675+
if (dplls->sma[i].pin && dplls->sma[i].input &&
2676+
dplls->sma[i].input->pin == pin)
2677+
dpll_pin_change_ntf(dplls->sma[i].pin);
2678+
if (dplls->ufl[i].pin && dplls->ufl[i].input &&
2679+
dplls->ufl[i].input->pin == pin)
2680+
dpll_pin_change_ntf(dplls->ufl[i].pin);
2681+
}
2682+
}
2683+
26602684
/**
26612685
* ice_dpll_notify_changes - notify dpll subsystem about changes
26622686
* @d: pointer do dpll
@@ -2665,6 +2689,7 @@ static u64 ice_generate_clock_id(struct ice_pf *pf)
26652689
*/
26662690
static void ice_dpll_notify_changes(struct ice_dpll *d)
26672691
{
2692+
struct ice_dplls *dplls = &d->pf->dplls;
26682693
bool pin_notified = false;
26692694

26702695
if (d->prev_dpll_state != d->dpll_state) {
@@ -2673,17 +2698,17 @@ static void ice_dpll_notify_changes(struct ice_dpll *d)
26732698
}
26742699
if (d->prev_input != d->active_input) {
26752700
if (d->prev_input)
2676-
dpll_pin_change_ntf(d->prev_input);
2701+
ice_dpll_pin_ntf(dplls, d->prev_input);
26772702
d->prev_input = d->active_input;
26782703
if (d->active_input) {
2679-
dpll_pin_change_ntf(d->active_input);
2704+
ice_dpll_pin_ntf(dplls, d->active_input);
26802705
pin_notified = true;
26812706
}
26822707
}
26832708
if (d->prev_phase_offset != d->phase_offset) {
26842709
d->prev_phase_offset = d->phase_offset;
26852710
if (!pin_notified && d->active_input)
2686-
dpll_pin_change_ntf(d->active_input);
2711+
ice_dpll_pin_ntf(dplls, d->active_input);
26872712
}
26882713
}
26892714

@@ -2712,6 +2737,7 @@ static bool ice_dpll_is_pps_phase_monitor(struct ice_pf *pf)
27122737

27132738
/**
27142739
* ice_dpll_pins_notify_mask - notify dpll subsystem about bulk pin changes
2740+
* @dplls: pointer to dplls struct
27152741
* @pins: array of ice_dpll_pin pointers registered within dpll subsystem
27162742
* @pin_num: number of pins
27172743
* @phase_offset_ntf_mask: bitmask of pin indexes to notify
@@ -2721,15 +2747,14 @@ static bool ice_dpll_is_pps_phase_monitor(struct ice_pf *pf)
27212747
*
27222748
* Context: Must be called while pf->dplls.lock is released.
27232749
*/
2724-
static void ice_dpll_pins_notify_mask(struct ice_dpll_pin *pins,
2750+
static void ice_dpll_pins_notify_mask(struct ice_dplls *dplls,
2751+
struct ice_dpll_pin *pins,
27252752
u8 pin_num,
27262753
u32 phase_offset_ntf_mask)
27272754
{
2728-
int i = 0;
2729-
2730-
for (i = 0; i < pin_num; i++)
2731-
if (phase_offset_ntf_mask & (1 << i))
2732-
dpll_pin_change_ntf(pins[i].pin);
2755+
for (int i = 0; i < pin_num; i++)
2756+
if (phase_offset_ntf_mask & BIT(i))
2757+
ice_dpll_pin_ntf(dplls, pins[i].pin);
27332758
}
27342759

27352760
/**
@@ -2905,7 +2930,7 @@ static void ice_dpll_periodic_work(struct kthread_work *work)
29052930
ice_dpll_notify_changes(de);
29062931
ice_dpll_notify_changes(dp);
29072932
if (phase_offset_ntf)
2908-
ice_dpll_pins_notify_mask(d->inputs, d->num_inputs,
2933+
ice_dpll_pins_notify_mask(d, d->inputs, d->num_inputs,
29092934
phase_offset_ntf);
29102935

29112936
resched:

0 commit comments

Comments
 (0)