From: netdev-bot+sashiko@kernel.org
To: arouhi@sitime.com
Cc: jiri@resnulli.us, ivecera@redhat.com, vadim.fedorenko@linux.dev,
arkadiusz.kubalewski@intel.com, kuba@kernel.org,
pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com,
cjubran@nvidia.com, Oleg.Zadorozhnyi@devoxsoftware.com,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and pins
Date: Thu, 03 Dec 2026 00:39:06 +0000 [thread overview]
Message-ID: <179625834679.3146.9981782206942012458@kernel.org> (raw)
In-Reply-To: <20261201235202.97645-7-arouhi@sitime.com>
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · 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] The XO pin reports DPLL_PIN_STATE_CONNECTED on every DPLL
device at all times.
- [Medium] sit9531x_irq_thread_fn() acknowledges only the fixed
register/bit list in sit9531x_notifs[].
- [Medium] sit9531x_output_mode_fetch() merges ODRn_MISC0 CMOS_ENP (bit
2) and CMOS_ENN (bit 3) into a single out->cmos flag, which loses…
- [Low] When two bound parts produce the same die-ID clock_id, the part
that binds first keeps it.
- [Low] sit9531x_dev_periodic_work() reads the PLL and input status under
multiop_lock and drops the lock.
--
dpll: sit9531x: register DPLL devices and pins
This patch registers each SiT9531x PLL as a DPLL device and the XO as a
pin on each. A kthread worker polls the status registers into a cache, and
an optional INTRB interrupt schedules an early poll. It also adds sleep PM
ops that stop and restart polling, and builds the clock_id from the die ID,
falling back to one from the I2C bus and address.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index 6b9f3609f61c5..4ff9e251eb776 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
[ ... ]
> @@ -16,96 +18,1345 @@
[ ... ]
> +/*
> + * Read whether an output is wired CMOS. Only the Hi-Z pairs for its wiring
> + * control the pad; the other pairs hold what the profile left. Caller must hold
> + * sitdev->multiop_lock.
> + */
> +static int sit9531x_output_mode_fetch(struct sit9531x_dev *sitdev, u8 out_idx)
> +{
[ ... ]
> + sitdev->out[out_idx].cmos = !!(val & (SIT9531X_OUT_CMOS_ENP |
> + SIT9531X_OUT_CMOS_ENN));
> +
> + return 0;
> +}
[ ... ]
> +static int sit9531x_output_forced_hiz(struct sit9531x_dev *sitdev,
> + u8 out_idx, bool *muted, bool *part)
> +{
> + struct sit9531x_hiz_pair p[SIT9531X_HIZ_PAIRS];
> + bool pad_p, pad_n;
> + int rc;
> +
> + sit9531x_output_get_hiz_regs(sitdev->info->clkout_map[out_idx], p);
> +
> + *part = false;
> + if (!sitdev->out[out_idx].cmos)
> + return sit9531x_hiz_pair_forced(sitdev,
> + &p[SIT9531X_HIZ_DIFF], muted);
> +
> + rc = sit9531x_hiz_pair_forced(sitdev, &p[SIT9531X_HIZ_CMOS_P], &pad_p);
> + if (!rc)
> + rc = sit9531x_hiz_pair_forced(sitdev, &p[SIT9531X_HIZ_CMOS_N],
> + &pad_n);
> + if (rc)
> + return rc;
> +
> + *muted = pad_p && pad_n;
> + *part = pad_p != pad_n;
[Severity: Medium]
Can this report a single-pad CMOS output as driving when its only live pad
is tri-stated?
sit9531x_output_mode_fetch() merges CMOS_ENP (bit 2) and CMOS_ENN (bit 3)
into one out->cmos flag, so the driver loses track of which pad is
enabled. The regs.h comment says either bit set means single-ended, "one
pad, or both as CMOS".
Suppose only one CMOS pad is enabled and the loaded profile forces that
pad to Hi-Z. The unused pad's pair keeps its default (not forced). Then
muted is false here, and sit9531x_out_state_fetch() records the output as
driving:
out->enabled = !muted;
At this commit the value is only cached. Once "dpll: sit9531x: implement
output pin state on a DPLL" registers output pins, would this output show
up as CONNECTED to userspace? An unmute would also put the profile's force
back on the live pad. The output would then keep reporting CONNECTED with
no signal. The logic is the same at the end of the series.
Should the mute check use only the pairs for the pads that ENP/ENN
actually enable?
> +
> + return 0;
> +}
[ ... ]
> +/* The latches INTRB reports, each with its sticky bits */
> +static const struct {
> + unsigned int reg;
> + u8 bits;
> +} sit9531x_notifs[] = {
> + { SIT9531X_REG_OUTER_LOL_NOTIF, GENMASK(3, 0) },
> + { SIT9531X_REG_HO_FREEZE_NOTIF, GENMASK(7, 6) | GENMASK(3, 0) },
> + { SIT9531X_REG_PLL_INNER_LOL_NOTIF, GENMASK(7, 6) | GENMASK(3, 0) },
> + { SIT9531X_REG_CMON_NOTIF, GENMASK(5, 4) | GENMASK(1, 0) },
> + { SIT9531X_REG_EEPROM_NOTIF, GENMASK(7, 0) },
> + { SIT9531X_REG_EEPROM_BUS_NOTIF, GENMASK(4, 0) },
> + { SIT9531X_CLKMON_P_NOTIF_01, GENMASK(7, 0) },
> + { SIT9531X_CLKMON_P_NOTIF_23, GENMASK(7, 0) },
> + { SIT9531X_CLKMON_N_NOTIF_01, GENMASK(7, 0) },
> + { SIT9531X_CLKMON_N_NOTIF_23, GENMASK(7, 0) },
> +};
[Severity: Medium]
What happens if the loaded profile routes a sticky source to INTRB that
this table does not cover?
The driver never reads or programs the INTRB enable/mask configuration, so
the profile decides which sources reach INTRB. Some latches would never be
acknowledged:
- a NOTIFY register that is missing from this list
- bits outside the masks listed here, for example outside GENMASK(3, 0)
in OUTER_LOL_NOTIF, or outside GENMASK(5, 4) | GENMASK(1, 0) in
CMON_NOTIF
In that case sit9531x_clear_notifications() finds nothing latched. With
INTRB still asserted, sit9531x_irq_thread_fn() then does:
if (!latched)
return IRQ_NONE;
The handler's own comment says a still-asserted INTRB "would fire again at
once" after IRQF_ONESHOT unmasks the line. The irq_ack_fails cutoff only
counts failed I2C reads, not this case.
Could the line then refire continuously, with about ten paged I2C
transfers per pass, until the spurious-IRQ detector disables it? The list
is the same at the end of the series, and no later patch programs the
INTRB masks.
[ ... ]
> +static void sit9531x_dev_periodic_work(struct kthread_work *work)
> +{
> + struct sit9531x_dev *sitdev = container_of(work, struct sit9531x_dev,
> + work.work);
> + struct sit9531x_dpll *sitdpll;
> + bool latched;
> + int rc;
> +
> + /*
> + * Release multiop_lock before the change checks: their notifications
> + * take DPLL-subsystem locks, which nest outside it.
> + */
> + mutex_lock(&sitdev->multiop_lock);
> + sit9531x_dev_ref_states_update(sitdev);
> + sit9531x_dev_chan_states_update(sitdev);
> + mutex_unlock(&sitdev->multiop_lock);
> +
> + list_for_each_entry(sitdpll, &sitdev->dplls, list)
> + sit9531x_dpll_changes_check(sitdpll);
> +
> + /*
> + * Clear the W1C notification latches on pages 0 and 6 after acting on
> + * them; while set they keep INTRB asserted.
> + */
> + mutex_lock(&sitdev->multiop_lock);
> + rc = sit9531x_clear_notifications(sitdev, &latched);
> + mutex_unlock(&sitdev->multiop_lock);
[Severity: Low]
Can a latch event be acknowledged here before its status has been read?
The sequence in this function is:
1. read the status under multiop_lock, then drop the lock
2. send the DPLL change notifications, which take dpll_lock and build
netlink messages
3. write back every latch bit that is set at that moment
A lock or holdover event that latches between steps 1 and 3 asserts
INTRB. sit9531x_irq_thread_fn() then either blocks on multiop_lock or runs
after this clear, so it sees latched == false and returns before queueing
the early tick:
if (!latched)
return IRQ_NONE;
kthread_mod_delayed_work(sitdev->kworker, &sitdev->work, 0);
The interrupt counts as unhandled and the early tick never runs. The
change is then seen up to SIT9531X_STATUS_POLL_MS later, and a transient
that reverts within that window is never reported. The ordering is the
same at the end of the series.
Would either of these close the window: clearing the latches before
reading the state, or requeuing an immediate tick when this clear finds
bits set?
[ ... ]
> @@ -123,6 +1374,132 @@ static const struct sit9531x_chip_info *sit9531x_match_variant(u8 id)
[ ... ]
> +static int sit9531x_clock_id_take(struct sit9531x_dev *sitdev)
> +{
> + int rc = 0;
> +
> + mutex_lock(&sit9531x_clock_ids_lock);
> + if (sit9531x_clock_id_used(sitdev->clock_id)) {
> + dev_warn(sitdev->dev,
> + "clock id 0x%016llx is in use by another part, clock id from the I2C bus and address\n",
> + sitdev->clock_id);
> + rc = sit9531x_bus_clock_id(sitdev);
[Severity: Low]
Does this make the clock_id of a given part depend on bind order?
When two parts produce the same die-ID clock_id, the one that binds first
keeps it. Only the later one moves to the OUI/bus/address id.
Two parts can share an id if the die ID is not unique. They can also share
one because sit9531x_derive_clock_id() folds nine bytes into 64 bits:
id ^= (u64)die[0] << 56;
so two different die IDs can fold to the same value.
The clock_id identifies the DPLL devices and pins to userspace through
netlink. Async or deferred probe, a different module load order, or an
unbind/rebind can change which part binds first. Could the two ids then
swap between physical parts across reboots?
The commit message mentions the fallback for a duplicate ID, but not that
the result depends on order. The code is the same at the end of the
series.
> + if (!rc && sit9531x_clock_id_used(sitdev->clock_id))
> + rc = dev_err_probe(sitdev->dev, -EBUSY,
> + "clock id 0x%016llx is in use by another part\n",
> + sitdev->clock_id);
> + }
[ ... ]
> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c
> new file mode 100644
> index 0000000000000..e9952e578face
> --- /dev/null
> +++ b/drivers/dpll/sit9531x/dpll.c
[ ... ]
> +/* The XO feeds every PLL and is always connected. */
> +
> +static int
> +sit9531x_dpll_xo_pin_state_on_dpll_get(const struct dpll_pin *pin,
> + void *pin_priv,
> + const struct dpll_device *dpll,
> + void *dpll_priv,
> + enum dpll_pin_state *state,
> + struct netlink_ext_ack *extack)
> +{
> + *state = DPLL_PIN_STATE_CONNECTED;
[Severity: Medium]
Is CONNECTED correct here no matter what the PLL has selected?
The dpll.yaml spec defines the connected state as "pin connected, active
input of phase locked loop". The XO is a selectable priority-table source:
sit9531x_hw_src_input() maps SIT9531X_PRIO_SRC_OCXO to the XO pin id.
sit9531x_chan_state_fetch() already caches the active selection:
chan->selected_ref =
sit9531x_hw_src_input(input_sel & SIT9531X_PRIO_NIBBLE_MASK);
So a PLL locked to IN0 would still report the XO as its active input.
This function is the same at the end of the series. By then, input pins in
automatic mode report only SELECTABLE or DISCONNECTED. That leaves the XO
as the only CONNECTED pin on an AUTOMATIC DPLL. It reports CONNECTED even
though it lacks the CONNECTED_OVERRIDE capability that dpll.rst requires
for a CONNECTED pin in automatic mode. The later patches also add prio_get
for the XO.
On a manual-select PLL, both the XO and the selected input would report
CONNECTED.
Could the XO state be derived from chan->selected_ref instead?
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201235202.97645-1-arouhi%40sitime.com
next prev parent reply other threads:[~2026-12-03 0:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 23:52 [PATCH net-next v17 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-12-01 23:52 ` [PATCH net-next v17 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko [this message]
2026-12-01 23:52 ` [PATCH net-next v17 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 12/13] dpll: sit9531x: add support to get phase offset on the connected input Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
2026-12-01 23:52 ` [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-12-03 0:39 ` netdev-bot+sashiko
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=179625834679.3146.9981782206942012458@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