mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ali Rouhi <arouhi@sitime.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "jiri@resnulli.us" <jiri@resnulli.us>,
	"vadim.fedorenko@linux.dev" <vadim.fedorenko@linux.dev>,
	"arkadiusz.kubalewski@intel.com" <arkadiusz.kubalewski@intel.com>,
	"ivecera@redhat.com" <ivecera@redhat.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"cjubran@nvidia.com" <cjubran@nvidia.com>,
	"Oleg.Zadorozhnyi@devoxsoftware.com"
	<Oleg.Zadorozhnyi@devoxsoftware.com>,
	"prabhakar.mahadev-lad.rj@bp.renesas.com"
	<prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@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, 1 Dec 2026 23:51:43 +0000	[thread overview]
Message-ID: <20261201235136.95422-11-arouhi@sitime.com> (raw)
In-Reply-To: <179548085403.3135.8775847073019311030@kernel.org>

On Tue, 24 Nov 2026 00:40:54 +0000, netdev-bot+sashiko@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.

  reply	other threads:[~2026-12-01 23:52 UTC|newest]

Thread overview: 38+ 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 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` 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 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
2026-11-19 22:57 ` [PATCH net-next v16 10/13] dpll: sit9531x: implement output " Ali Rouhi
2026-11-24  0:40   ` netdev-bot+sashiko
2026-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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-12-01 23:51     ` Ali Rouhi
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
2026-12-01 23:51     ` Ali Rouhi [this message]
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-12-01 23:51     ` Ali Rouhi

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=20261201235136.95422-11-arouhi@sitime.com \
    --to=arouhi@sitime.com \
    --cc=Oleg.Zadorozhnyi@devoxsoftware.com \
    --cc=arkadiusz.kubalewski@intel.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-bot+sashiko@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

all inboxes | Powered by JetHome®