From: netdev-bot+sashiko@kernel.org
To: arouhi@sitime.com
Cc: jiri@resnulli.us, vadim.fedorenko@linux.dev,
arkadiusz.kubalewski@intel.com, ivecera@redhat.com,
kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, cjubran@nvidia.com,
Oleg.Zadorozhnyi@devoxsoftware.com,
prabhakar.mahadev-lad.rj@bp.renesas.com,
devicetree@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v16 12/13] dpll: sit9531x: add support to get phase offset on the connected input
Date: Tue, 24 Nov 2026 00:40:54 +0000 [thread overview]
Message-ID: <179548085403.3135.8775847073019311030@kernel.org> (raw)
In-Reply-To: <20261119225752.41846-13-arouhi@sitime.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] sit9531x_phase_offset_read() (drivers/dpll/sit9531x/core.c)
turns the TDC code into picoseconds by dividing by the Fvco that…
- [Low] The commit message says "The offset is sampled when asked for,
not by the poll: a sample is several dozen transfers per PLL." That is…
- [Low] The patch adds `sitdev->chan[pll_idx].key_pending = !!lock_rc;`
to the existing helper sit9531x_chan_routed_ref_read()…
--
dpll: sit9531x: add support to get phase offset on the connected input
This adds a phase_offset_get callback to the sit9531x input pins. It reads
the PLL's on-chip TDC through the debug window and converts the code to
picoseconds using the PLL's Fvco. The debug taps are saved and restored
around each sample, and a failed restore or relock is retried by the
poll, at removal and on the probe failure path.
> 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?
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index fd8f0df9116d6..5ec9d2a48fcbf 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> @@ -2594,6 +2620,176 @@ static int sit9531x_clear_notifications(struct sit9531x_dev *sitdev)
> return 0;
> }
>
> +/**
> + * sit9531x_phase_offset_read - read phase difference via TDC
[ ... ]
> +int sit9531x_phase_offset_read(struct sit9531x_dev *sitdev, u8 pll_idx,
> + s64 *phase_offset)
> +{
[ ... ]
> + /*
> + * Read Fvco first; without it there is no reason to open the debug
> + * window.
> + */
> + rc = sit9531x_get_fvco(sitdev, pll_idx, &fvco);
> + if (rc) {
> + 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?
[ ... ]
> @@ -2768,6 +2972,7 @@ static int sit9531x_chan_routed_ref_read(struct sit9531x_dev *sitdev,
> lock_rc = sit9531x_write_pll_close(sitdev, pll_idx,
> 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?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119225752.41846-1-arouhi%40sitime.com
prev parent reply other threads:[~2026-11-24 0:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 22:57 [PATCH net-next v16 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:57 ` [PATCH net-next v16 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:58 ` [PATCH net-next v16 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:58 ` [PATCH net-next v16 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko
2026-11-19 22:58 ` [PATCH net-next v16 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-11-24 0:40 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179548085403.3135.8775847073019311030@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Oleg.Zadorozhnyi@devoxsoftware.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=arouhi@sitime.com \
--cc=cjubran@nvidia.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox