On Tue, 24 Nov 2026 00:40:54 +0000, netd…@kernel.org wrote:
> > The offset is sampled when asked for, not by the poll: a sample is
> > several dozen transfers per PLL.
>
> [Severity: Low]
> Is this accurate for notifications?
>
> The poll worker calls sit9531x_dpll_changes_check(). That function calls
> dpll_pin_change_ntf() for every selection pin whose state, operstate or
> prio changed. The core then builds the full pin message for that
> notification:
>
> sit9531x_dpll_changes_check()
> dpll_pin_change_ntf()
> dpll_pin_event_send()
> dpll_cmd_pin_get_one()
> dpll_msg_add_phase_offset()
> sit9531x_dpll_input_pin_phase_offset_get()
>
> So when the poll notifies the active input of a PLL (for example, the new
> reference after a switch), the poll worker does two input monitor
> fetches, two routed reference reads and a full TDC sample. A failure there
> can also set tap_pending or key_pending from the poll.
>
> This only happens on change notifications, not on every poll tick. The
> callback also maps errors to -ENODATA, so the notification still goes
> out. Could the commit message be reworded to say this?
Intended: the offset is sampled whenever the core builds a pin message,
the poll's notifications included, and a sample that fails leaves the
attribute out. The v17 message says so.
> > + if (rc == -ENODATA)
> > + dev_dbg(sitdev->dev,
> > + "PLL%c: Fvco unknown, skip TDC\n",
> > + 'A' + pll_idx);
> > + return rc;
> > + }
>
> [Severity: Medium]
> Is an out-of-band Fvco safe to use here?
>
> sit9531x_get_fvco() returns 0 even when Fref * DIVN falls outside the
> PLL's VCO band. It only warns once:
>
> drivers/dpll/sit9531x/core.c:sit9531x_get_fvco() {
> ...
> /*
> * Outside the PLL's VCO band, Fref * DIVN is usually not the rate the
> * PLL runs at, as for a PLL fed from another PLL.
> */
> if (!sit9531x_fvco_in_band(pll_idx, *fvco) &&
> !(sitdev->fvco_band_warned & BIT(pll_idx))) {
> ...
> return 0;
> }
>
> This value has two other users, sit9531x_output_divo_calc() and
> sit9531x_output_phase_adjust_set(). Both return -EINVAL when
> sit9531x_fvco_in_band() fails ("rate not settable" and "delay not
> settable").
>
> This function only checks rc, and then divides the TDC code by that Fvco:
>
> mag = mul_u64_u64_div_u64(tdc_signed < 0 ? -tdc_signed : tdc_signed,
> 1000000000000ULL * DPLL_PHASE_OFFSET_DIVIDER,
> fvco);
>
> The "one code is 203.45 ps at 4.9152 GHz" comment suggests one TDC code is
> one period of the real VCO. If so, wouldn't the reported phase offset be
> off by the ratio of the computed VCO rate to the real one?
> sit9531x_dpll_input_pin_phase_offset_get() would then return 0, and user
> space would receive the wrong value as a valid attribute.
>
> Should this return -ENODATA when sit9531x_fvco_in_band() fails, so the
> attribute is left out?
No. From patch 9 in v17, sit9531x_get_fvco() returns -ENODATA outside
the band, and the phase offset read passes it on, so the attribute is
left out.
> > SIT9531X_PLL_REG_DEBUG,
> > SIT9531X_PLL_DEBUG_LOCK);
> > + sitdev->chan[pll_idx].key_pending = !!lock_rc;
> >
> > return rc ? rc : lock_rc;
> > }
>
> [Severity: Low]
> This line also changes the existing poll path.
> sit9531x_chan_routed_ref_read() runs from sit9531x_chan_state_fetch() on
> every poll and at probe, so a failed relock there now sets key_pending.
>
> The next poll's sit9531x_tap_back_retry() then retries it. At removal,
> sit9531x_tap_pending_retry() warns "left with its debug taps moved or
> window open". Before this patch, that relock failure was never retried.
>
> The retry itself looks reasonable, but the documentation only describes
> the phase-offset path. The kernel-doc in core.h says:
>
> * @key_pending: debug key not locked again after a phase-offset read or tap
> * retry
>
> The comment above sit9531x_tap_back_retry() says "after a failed
> phase-offset read", and the commit message only mentions the taps moved
> for a sample.
>
> Could the kernel-doc, the sit9531x_tap_back_retry() comment and the
> commit message also mention the routed reference read?
In v17 the retry of a failed relock on the poll comes with patch 7, so
this patch no longer changes the poll, and the @key_pending kernel-doc
covers any PLL-page debug key left open.