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 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins
Date: Tue, 1 Dec 2026 23:51:43 +0000 [thread overview]
Message-ID: <20261201235136.95422-12-arouhi@sitime.com> (raw)
In-Reply-To: <179548085598.3135.2881887396981027757@kernel.org>
On Tue, 24 Nov 2026 00:40:55 +0000, netdev-bot+sashiko@kernel.org wrote:
> > + { 0x54, 0x02, 0x00 },
> > + { 0x55, 0x28, 0x20 },
> > + { 0x5C, 0x0F, 0x00 },
> > + { 0x5D, 0xFF, 0x00 },
> > + { 0x6C, 0xDD, 0x00 },
> > +};
>
> [Severity: Low]
> Could each of these eight registers get a short description? The only
> reference is Intsync_enable_disable.py, which isn't public.
> sit9531x_intsync_src_detect() decides source, partial and conflict only
> by counting matches against these bytes.
>
> The comment says the pattern "locks the frequency PLL to the phase PLL".
> The commit message says "one PLL drives the others as a reference".
> Which one describes the hardware? The second is the model this patch
> exposes to user space, as a source pin plus a destination input.
v17 drops the sentence about what the writes do to the PLLs, so the
comment and the message agree; the comment cites the whole-byte writes
of the reference sequence for enable and disable.
> > + (sitdev->intsync_src < 0 ||
> > + (sitdev->intsync_src == src && !sitdev->intsync_partial))) {
> > + sitdev->intsync_src = src;
> > + sitdev->intsync_partial = true;
> > + sitdev->intsync_foreign = false;
> > + }
>
> [Severity: Medium]
> Does this mark a source that is fully driving the line as partial again?
> Suppose an earlier partial record exists for PLLx. If the new scan finds
> the whole pattern on PLLx with the global enable set, the second half of
> the condition is true and intsync_partial goes back to true.
>
> That isn't one of the meanings core.h lists:
>
> * @intsync_partial: @intsync_src holds part of the source pattern, or the whole
> * pattern under a clear global enable; not reported as the source
>
> Both sit9531x_dpll_intsync_src_connected() and sit9531x_intsync_driven()
> ignore partial records. So the PLL driving the line would show a
> DISCONNECTED source pin. The other PLLs' INTSYNC inputs would show
> NO_SIGNAL unless one of them is locked.
>
> sit9531x_resume() uses this same readback for the power-loss case ("A
> part that lost power returns with its profile's INTSYNC routing ... read
> them back"). The partial record may be left by a failed connect or
> disconnect (the owner_kept or rollback_failed paths). If the reloaded
> profile then sources INTSYNC from that same PLL, would connects on other
> PLLs be refused with "PLL%c holds a partial INTSYNC source"? The only
> recovery would be a DISCONNECT, which turns off the profile's source.
The partial record is the only trace that the latched state may differ
from what the page reads, so the driver keeps it, and it refuses
connects on other PLLs. A disconnect on that PLL's source pin clears it.
No change.
> > + dev_warn(sitdev->dev,
> > + "PLL%c: INTSYNC pattern written but the debug window was left open: %d\n",
> > + 'A' + src_pll_idx, lock_rc);
> > +
> > + rc = sit9531x_write_u8(sitdev, SIT9531X_REG_INTSYNC_GLOBAL,
> > + val | BIT(SIT9531X_INTSYNC_EN_BIT));
>
> [Severity: Low]
> What closes the EXT page debug window if this lock fails? The other
> debug windows have a pending flag that gets retried:
>
> - PLL page: chan->key_pending, retried by sit9531x_tap_back_retry()
> - OUTSYS page: outsys_key_pending, retried by the poll
>
> The EXT page has no such flag.
>
> Two other places have the same problem:
>
> - The relock label in __sit9531x_intsync_disable() only warns, and
> the function can still return 0.
> - sit9531x_intsync_src_detect() returns early on a failed lock and
> leaves that page open.
>
> The setter's follow-up detect or readback re-locks each page. Some
> failure cases don't set intsync_stale, for example:
>
> changed && !rc && detect_rc && !intsync_conflict
>
> If that follow-up scan fails in one of those cases, nothing seems to
> retry the lock. The EXT page INTSYNC registers would stay writable, and
> the driver would have no record of it.
Nothing did in v16. In v17 a failed close of the EXT page debug key is
recorded and retried by the poll and at removal.
> > + SIT9531X_REG(ext_page,
> > + intsync_config[i].offset),
> > + intsync_config[i].dis_val);
> > + if (rc)
> > + goto restore_global;
> > + }
>
> [Severity: Medium]
> Can this overwrite profile settings that are not part of the INTSYNC
> switch? Enable and disable both write whole bytes from intsync_config[].
> There is no read-modify-write, and the old contents are not saved.
>
> sit9531x_intsync_src_detect() allows pages that hold "other values",
> and a connect on such a PLL is not refused. The page then ends up with
> the fixed dis_val bytes instead of the profile's values. This happens
> after a connect followed by a disconnect. It also happens on the
> enable-failure rollback, which goes through __sit9531x_intsync_disable()
> with restore == false.
>
> Offset 0x55 has bit 5 set in both en_val (0x28) and dis_val (0x20). That
> suggests the register holds at least one other field, and this code
> forces it to 1. Would it be better to save and restore the original
> bytes, or to change only the INTSYNC bits?
The driver writes the enable and disable values whole, as the reference
sequence does. No change.
> > return sit9531x_input_pin_is_registrable(sitdev, index);
> > }
> >
> > if (index == SIT9531X_INTSYNC_OUT_PIN_ID)
> > - return false;
> > + return true;
>
> [Severity: Medium]
> Once these pins are registered, user space can see their type.
> sit9531x_pin_props_get() in prop.c gives both of them the same type as
> the XO:
>
> drivers/dpll/sit9531x/prop.c:sit9531x_pin_props_get() {
> if (sync_in) {
> /* INTSYNC destination: a reference the PLL can lock to. */
> props->dpll_props.type = DPLL_PIN_TYPE_INT_OSCILLATOR;
> ...
> } else if (sync_out) {
> /* INTSYNC source: driving it is not a reference selection */
> props->dpll_props.type = DPLL_PIN_TYPE_INT_OSCILLATOR;
> ...
> } else if (xo) {
> props->dpll_props.type = DPLL_PIN_TYPE_INT_OSCILLATOR;
> ...
> }
>
> Is INT_OSCILLATOR the right type for a line driven by another PLL? User
> space that finds the free-running oscillator by pin type would see three
> INT_OSCILLATOR pins per DPLL, and two of them are not oscillators. Pin
> type is uAPI and is hard to change after release.
The uAPI has no type for a line one PLL drives inside the device, and
INT_OSCILLATOR is its type for an internally generated clock. The v17
message says why both pins use it. A new type would be a change to the
DPLL core. No change.
> > + u8 i;
> >
> > /*
> > * After power loss the part is on page 0, not the cached page. The
> > * configuration read at probe is not read again.
> > */
>
> [Severity: Low]
> This isn't a bug, but this comment now contradicts the code below. That
> code re-reads probe-time configuration through
> sit9531x_intsync_readback(), sit9531x_output_phase_read() ("read them
> back as probe does") and sit9531x_output_state_refresh().
Agreed. The v17 comment says the part may have reloaded its
configuration and that resume waits as probe does.
> > + * A part that lost power returns with its profile's INTSYNC routing and
> > + * output mutes, which the poll does not read; read them back. Arm one
> > + * re-select for a source lost and restored between samples.
> > + */
> > mutex_lock(&sitdev->multiop_lock);
> > sit9531x_reselect_arm(sitdev);
>
> [Severity: Medium]
> Is the part guaranteed to be ready here? This code assumes the part lost
> power and reloaded its profile. It then immediately reads and caches
> HO_CTRL, the output delay registers, all four EXT pages and the output
> mute state.
>
> Probe waits for internal boot after releasing reset:
>
> sit9531x_dev_probe() {
> ...
> fsleep(10000); /* internal boot after release */
> ...
> }
>
> Suspend and resume don't touch the reset GPIO or power, so nothing here
> knows when the part came back. If this runs while the profile is still
> loading, these fields could be cached from transient values:
>
> - intsync_src, intsync_partial and intsync_foreign
> - out->phase_adj and out->phase_armed
> - out->enabled
>
> The poll does not re-read any of them. table_pending and
> ho_release_pending could also be dropped based on a transient HO_CTRL
> read.
Not in v16. In v17 resume waits the start-up time first, as probe does.
> > + }
> > + if (sitdev->flush_ctrl_pending) {
> > + dev_warn(sitdev->dev,
> > + "flush trigger source select pending before suspend, dropped\n");
> > + sitdev->flush_ctrl_pending = false;
> > + }
>
> [Severity: Low]
> The commit message says resume "drops the writes left pending from
> before suspend, logging each". This loop drops retime_pending,
> flush_pending, flush_arm_pending and flush_ctrl_pending. It drops
> table_pending and ho_release_pending only when HO_FORCE reads clear.
>
> Several retries are left in place:
>
> - tap restore (tap_pending, key_pending)
> - input-off
> - the loops_open relock
> - the outsys_key_pending close
>
> The poll queued at the end of resume then runs them from
> sit9531x_dev_chan_states_update(), against a configuration that may
> have been reloaded:
>
> if (sitdev->loops_open)
> sit9531x_prg_relock(sitdev);
> else if (sitdev->outsys_key_pending)
> sit9531x_outsys_debug_close(sitdev);
> ...
> sit9531x_input_off_retry(sitdev);
> ...
> sit9531x_tap_back_retry(sitdev, i);
>
> Is that intended?
>
> Separately, most of the resume work belongs to the output phase, output
> state, flush and priority table code rather than to the INTSYNC line.
> That includes the delay and mute read-back and the dropped flush, retime
> and table writes. Could it go in its own patch?
In v17 resume also drops a pending bank update and receiver power-down,
and keeps the writes that undo a state the driver set; the comment says
which. The re-reads of the inputs, select modes, routing and output
state moved to patch 6. The delay re-read stays here, since its
notification uses a helper this patch adds.
> > + mutex_lock(&sitdev->multiop_lock);
> > + rc = sit9531x_dpll_intsync_refresh(sitdev, extack);
> > + if (rc) {
> > + mutex_unlock(&sitdev->multiop_lock);
> > + return rc;
> > + }
>
> [Severity: Medium]
> Can a failed refresh here end the pin dump for the whole system? While
> intsync_stale is set, sit9531x_dpll_intsync_refresh() rescans all four
> EXT pages over I2C. If that fails, the error (for example -EIO) goes
> back to the DPLL core, and dpll_nl_pin_get_dumpit() only skips -ENODEV:
>
> ret = dpll_cmd_pin_get_one(skb, pin, cb->extack);
> if (ret) {
> genlmsg_cancel(skb, hdr);
> if (ret == -ENODEV) {
> ret = 0;
> continue;
> }
> break;
> }
>
> The dump then stops, so the pins after this one are never listed,
> including pins of other DPLL drivers. The same pattern is in
> sit9531x_dpll_intsync_dst_state_on_dpll_get() and
> sit9531x_dpll_intsync_dst_operstate_on_dpll_get().
>
> Each INTSYNC pin is one dpll_pin shared by all four DPLLs. PIN_GET and
> change notifications for it would fail too, and
> sit9531x_drive_pins_ntf() would keep setting intsync_ntf_pending.
>
> intsync_stale is set right after an EXT-page read has already failed,
> in sit9531x_resume() or in the source setter. So this path runs when
> the bus is already known to be failing.
> sit9531x_dpll_input_pin_phase_offset_get() maps such errors to
> -ENODATA for this reason.
>
> sit9531x_intsync_driven() already treats a stale record as not driven.
> Could these getters answer from the cached record instead?
It could in v16. In v17 the three getters answer from the kept record
when the refresh fails, and the poll retries the refresh.
> > + if (sitdev->intsync_src >= 0 &&
> > + sitdev->intsync_src != sitdpll->id) {
> > + if (sitdev->intsync_partial)
> > + NL_SET_ERR_MSG_FMT(extack,
> > + "PLL%c holds a partial INTSYNC source; disconnect its source pin first",
> > + 'A' + sitdev->intsync_src);
>
> [Severity: Low]
> How would user space tell which pin needs disconnecting?
> sit9531x_dpll_intsync_src_connected() returns false when
> intsync_partial is set, so the partial owner's source pin already
> reports DISCONNECTED.
>
> A redundant DISCONNECTED write does reach sit9531x_intsync_disable(),
> because the core doesn't short-circuit same-state requests. Nothing in
> the reported state shows that the pin needs it, though, and tools that
> skip no-op state writes would never send it.
The refusal's extack names the PLL that holds the partial source and
says to disconnect its source pin, and the v17 pin-state contract says a
DISCONNECTED request on that pin clears the page.
> > + &owner_kept, &changed);
> > + break;
> > + default:
> > + rc = -EINVAL;
> > + break;
> > + }
>
> [Severity: Low]
> Should this default case set an extack message? SELECTABLE ends up here
> with a bare -EINVAL. The end of the function skips the generic "Failed
> to set INTSYNC source state" message for -EINVAL, so user space gets no
> explanation. The destination pin's CONNECTED refusal does set one
> ("Device selects its reference by priority; use selectable").
Agreed. In v17 the default case sets an extack message.
> > + if (sitdev->intsync_src == sitdpll->id)
> > + *state = DPLL_PIN_STATE_DISCONNECTED;
> > + else
> > + sit9531x_dpll_selection_state_get(sitdev, sitdpll,
> > + SIT9531X_INTSYNC_PIN_ID,
> > + state);
>
> [Severity: Low]
> The pin-state contract comment doesn't cover this case. It says the
> INTSYNC destination is "SELECTABLE while listed in this PLL's priority
> table and DISCONNECTED otherwise".
>
> Here, and in sit9531x_dpll_pin_snapshot(), the pin is forced to
> DISCONNECTED whenever intsync_src matches this PLL. That includes
> partial records and owners detected at probe or resume.
>
> A profile can list INTSYNC in the source PLL's own table.
> sit9531x_dpll_intsync_selected() only refuses that combination for the
> driver's own connect requests. In that case
> sit9531x_dpll_input_pin_prio_get() still returns the live slot, so the
> pin shows DISCONNECTED with a valid priority. Could the contract
> comment and the reported state be made to agree?
Agreed. The v17 contract says the destination is DISCONNECTED on the PLL
recorded as the source, whole or partial.
next prev parent 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 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 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 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 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 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 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: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-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 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 [this message]
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
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-12-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®