Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ali Rouhi" <arouhi@sitime.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins
Date: Fri, 20 Nov 2026 22:58:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-226322@kernel.org> (raw)
In-Reply-To: <20261119225752.41846-7-arouhi@sitime.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dpll: sit9531x: lock error reported on inactive PLL in
  sit9531x_dpll_lock_status_get()
- [Medium] dpll: sit9531x: unmasked INTRB latches cause storm in
  sit9531x_irq_thread_fn()
--

commit f2688535e3fdf8a8e4a4d89421da6aae6f0f4bb8
Author: Oleg Zadorozhnyi <Oleg.Zadorozhnyi@devoxsoftware.com>

dpll: sit9531x: register DPLL devices and pins

This commit registers each PLL on the SiT9531x as a DPLL device with its
XO pin, adds a periodic kthread worker and optional INTRB threaded IRQ handler
to poll hardware status into a cache, and wires up system sleep PM operations.

> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index 99dd5e70dc5e6..8a63b92fb7d62 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c

[ ... ]

> @@ -181,132 +206,1419 @@ int sit9531x_update_pll_u8(struct sit9531x_dev *sitdev, u8 pll_idx,

[ ... ]

> +/* Queue an immediate poll tick; polling continues as a fallback. */
> +static irqreturn_t sit9531x_irq_thread_fn(int irq, void *data)
> +{
> +	struct sit9531x_dev *sitdev = data;
> +	int rc;
> +
> +	/*
> +	 * Acknowledge here: IRQF_ONESHOT unmasks the line on return, and a
> +	 * still-asserted INTRB would fire again at once.
> +	 */
> +	mutex_lock(&sitdev->multiop_lock);
> +	rc = sit9531x_clear_notifications(sitdev);
> +	mutex_unlock(&sitdev->multiop_lock);
> +	if (rc) {
> +		dev_warn_ratelimited(sitdev->dev,
> +				     "IRQ: failed to clear notifications: %d\n",
> +				     rc);
> +		if (++sitdev->irq_ack_fails < SIT9531X_IRQ_ACK_TRIES)
> +			return IRQ_NONE;
> +
> +		dev_err(sitdev->dev,
> +			"IRQ %d disabled: notifications cannot be cleared, polling only\n",
> +			irq);
> +		disable_irq_nosync(irq);
> +		return IRQ_NONE;
> +	}
> +
> +	sitdev->irq_ack_fails = 0;
> +
> +	kthread_mod_delayed_work(sitdev->kworker, &sitdev->work, 0);
> +	return IRQ_HANDLED;
> +}

[Severity: Medium]
As reported by Jakub Kicinski on v15 [1], can sit9531x_irq_thread_fn()
trigger a level-triggered interrupt storm if the device profile routes a
sticky latch outside the eight registers cleared by
sit9531x_clear_notifications() to INTRB?

The driver does not program the INTRB mask registers, and
sit9531x_eeprom_state_report() reads the sticky SIT9531X_REG_EEPROM_NOTIF
register at probe and leaves its bits set.  If an unmonitored latch like
SIT9531X_REG_EEPROM_NOTIF drives INTRB low, sit9531x_clear_notifications()
succeeds without deasserting the line and sit9531x_irq_thread_fn() returns
IRQ_HANDLED on every pass, preventing the spurious-IRQ detector from steping
in while firing continuous I2C transactions.

> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c
> new file mode 100644
> index 0000000000000..6d676fabf13ee
> --- /dev/null
> +++ b/drivers/dpll/sit9531x/dpll.c
> @@ -0,0 +1,295 @@

[ ... ]

> +static int
> +sit9531x_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
> +			      enum dpll_lock_status *status,
> +			      enum dpll_lock_status_error *status_error,
> +			      struct netlink_ext_ack *extack)
> +{
> +	struct sit9531x_dpll *sitdpll = dpll_priv;
> +	struct sit9531x_dev *sitdev = sitdpll->dev;
> +	const struct sit9531x_chan *chan;
> +
> +	if (status_error)
> +		*status_error = DPLL_LOCK_STATUS_ERROR_NONE;
> +
> +	chan = sit9531x_chan_state_get(sitdev, sitdpll->id);
> +
> +	mutex_lock(&sitdev->multiop_lock);
> +
> +	if (chan->stale) {
> +		*status = DPLL_LOCK_STATUS_UNLOCKED;
> +		if (status_error)
> +			*status_error = DPLL_LOCK_STATUS_ERROR_UNDEFINED;
> +	} else if (!chan->active) {
> +		/*
> +		 * An unused PLL never goes active and its loss-of-lock bit is
> +		 * not driven.
> +		 */
> +		*status = DPLL_LOCK_STATUS_UNLOCKED;
> +	} else if (chan->inner_lol) {
> +		/*
> +		 * The core reports the error detail only with an unlocked or
> +		 * holdover status.
> +		 */
> +		*status = chan->ho_freeze ? DPLL_LOCK_STATUS_HOLDOVER :
> +					    DPLL_LOCK_STATUS_UNLOCKED;
> +	} else if (chan->mode) {
> +		/*
> +		 * In free-run the outer loop is disabled and its loss-of-lock
> +		 * bit is meaningless.
> +		 */
> +		*status = DPLL_LOCK_STATUS_UNLOCKED;
> +	} else if (chan->ho_freeze) {
> +		/*
> +		 * Test freeze before lock: a frozen PLL tracks no reference
> +		 * whatever its outer loss-of-lock bit reads.
> +		 */
> +		*status = DPLL_LOCK_STATUS_HOLDOVER;
> +	} else if (chan->locked) {
> +		if (chan->ho_valid)
> +			*status = DPLL_LOCK_STATUS_LOCKED_HO_ACQ;
> +		else
> +			*status = DPLL_LOCK_STATUS_LOCKED;
> +	} else {
> +		*status = DPLL_LOCK_STATUS_UNLOCKED;
> +	}
> +
> +	if (status_error && chan->inner_lol)
> +		*status_error = DPLL_LOCK_STATUS_ERROR_UNDEFINED;

[Severity: Medium]
Should setting *status_error = DPLL_LOCK_STATUS_ERROR_UNDEFINED for
chan->inner_lol move inside the else if (chan->inner_lol) branch?

Because it sits after the if/else-if chain, an unused PLL (!chan->active)
whose inner_lol bit is set still reports DPLL_LOCK_STATUS_ERROR_UNDEFINED
alongside DPLL_LOCK_STATUS_UNLOCKED, and sit9531x_dpll_changes_check() will
emit change notifications if inner_lol toggles on an inactive PLL.

[1] https://lore.kernel.org/r/20261117021814.2220156-1-kuba@kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119225752.41846-1-arouhi@sitime.com?part=6

  reply	other threads:[~2026-11-20 22:58 UTC|newest]

Thread overview: 21+ 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-19 22:57 ` [PATCH net-next v16 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-20 22:58   ` sashiko-bot
2026-11-19 22:57 ` [PATCH net-next v16 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator 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-19 22:57 ` [PATCH net-next v16 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-20 22:58   ` sashiko-bot [this message]
2026-11-19 22:57 ` [PATCH net-next v16 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-20 22:58   ` sashiko-bot
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-19 22:57 ` [PATCH net-next v16 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-20 22:58   ` sashiko-bot
2026-11-19 22:57 ` [PATCH net-next v16 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-11-20 22:58   ` sashiko-bot
2026-11-19 22:58 ` [PATCH net-next v16 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-20 22:58   ` sashiko-bot
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-20 22:58   ` sashiko-bot
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

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=sashiko-outbox-226322@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arouhi@sitime.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.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