Article View: linux.kernel.netdev
Article #26063Re: [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 00:39
Date: Thu, 03 Dec 2026 00:39
291 lines
18577 bytes
18577 bytes
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 4
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] A torn output divider (part old bytes, part new) gets
committed to the active NVM bank.
- [Low] For every output, sit9531x_pin_props_get() in
drivers/dpll/sit9531x/prop.c (lines 319-330) advertises…
- [Low] sit9531x_dpll_output_pin_frequency_get()
(drivers/dpll/sit9531x/dpll.c:630) calls sit9531x_output_freq_get() on…
- [Low] When an output's divider chain does not resolve (-ENODATA from
sit9531x_output_freq_get()), sit9531x_dpll_output_pin_frequency_get()…
- [Low] The comment on sit9531x_dpll_input_pin_frequency_get()
(drivers/dpll/sit9531x/dpll.c:308) reads "Report the first supported-…
--
dpll: sit9531x: add support to get and set frequency on pins
This adds frequency_get for input and XO pins, taken from the firmware
description. It also adds frequency_get and frequency_set for output pins,
computed as Fvco / DIVO and programmed by writing a new DIVO inside the
PRG_CMD state. A phase flush follows each write, and the poll and removal
paths retry a failed bank update.
> diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c
> index 6e06e99e5ff82..bce58b3371130 100644
> --- a/drivers/dpll/sit9531x/core.c
> +++ b/drivers/dpll/sit9531x/core.c
> @@ -463,6 +463,153 @@ static int sit9531x_output_forced_hiz(struct sit9531x_dev *sitdev,
[ ... ]
> +/* Update the NVM bank and leave PRG_CMD */
> +static int sit9531x_prg_commit(struct sit9531x_dev *sitdev)
> +{
> + int rc, rc2;
> +
> + rc = sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,
> + SIT9531X_UPDATE_NVM_BANK);
> + sitdev->bank_pending = !!rc;
> + rc2 = sit9531x_prg_relock(sitdev);
> +
> + return rc ? rc : rc2;
> +}
[ ... ]
> @@ -1199,6 +1346,525 @@ int sit9531x_input_prio_add(struct sit9531x_dev *sitdev, u8 pll_idx,
[ ... ]
> +rollback:
> + /* The byte whose write failed may have reached the part */
> + *back = true;
> + for (j = 0; j <= written && j < 5; j++) {
> + rb_rc = sit9531x_write_u8(sitdev,
> + SIT9531X_REG(page, base_reg - j),
> + old_bytes[j]);
> + if (rb_rc) {
> + *back = false;
> + dev_err(sitdev->dev,
> + "out%u: DIVO rollback failed (%d), the divider is part old and part new\n",
> + out_idx, rb_rc);
> + if (!rc)
> + rc = rb_rc;
> + }
> + }
> +
> + return rc;
> +}
[ ... ]
> +int sit9531x_output_freq_set(struct sit9531x_dev *sitdev, u8 out_idx,
> + u8 pll_idx, u64 frequency)
> +{
[ ... ]
> + rc = sit9531x_prg_enter(sitdev);
> + if (rc)
> + return rc;
> +
> + rc = sit9531x_output_divo_write(sitdev, out_idx, divo, &back);
> + /* NVM update and loop lock */
> + ret = sit9531x_prg_commit(sitdev);
[Severity: Medium]
Can this commit a torn DIVO to the running configuration?
The rollback in sit9531x_output_divo_write() can fail partway. When it
does, it logs "the divider is part old and part new" and leaves back set
to false. sit9531x_output_freq_set() never looks at back, and
sit9531x_prg_commit() always issues SIT9531X_UPDATE_NVM_BANK. The mixed
divider is then loaded.
If the bank write fails as well, bank_pending is set. Then
sit9531x_dev_chan_states_update() and sit9531x_dev_stop() reissue the bank
update through sit9531x_prg_retry() as soon as the bus answers. Neither
rewrites the old or intended divider first.
For example, take an old DIVO of 0x31 and a new DIVO with a low byte of
0x00. Byte 0 is written, the byte 1 write fails, and the byte 0 rollback
fails. The registers now hold DIVO = 0, and that is what gets committed. A
small torn divider could also push an LVCMOS output past the 250 MHz limit
that sit9531x_dpll_output_pin_frequency_set() enforces.
Later in the series, "dpll: sit9531x: model the inter-PLL sync line as a
pair of pins" consumes back as landed = !back:
ret = landed ? sit9531x_prg_commit(sitdev) : sit9531x_prg_relock(sitdev);
A failed rollback still gives back == false and so landed == true. The
torn value is still committed, and there is no pending flag to retry the
rollback.
Should a failed rollback skip the bank update and record something the
poll can use to rewrite a consistent divider?
> + if (ret && !rc)
> + rc = ret;
> + if (rc)
> + return rc;
[ ... ]
> diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c
> index 3a31d0707127a..25bee483bb5a7 100644
> --- a/drivers/dpll/sit9531x/dpll.c
> +++ b/drivers/dpll/sit9531x/dpll.c
> @@ -305,6 +305,24 @@ sit9531x_dpll_input_pin_direction_get(const struct dpll_pin *pin,
> return 0;
> }
>
> +/* Report the first supported-frequencies-hz entry */
> +static int
> +sit9531x_dpll_input_pin_frequency_get(const struct dpll_pin *pin,
> + void *pin_priv,
> + const struct dpll_device *dpll,
> + void *dpll_priv, u64 *frequency,
> + struct netlink_ext_ack *extack)
> +{
> + struct sit9531x_dpll_pin *dpin = pin_priv;
> + struct sit9531x_dpll *sitdpll = dpll_priv;
> + const struct sit9531x_ref *ref;
> +
> + ref = sit9531x_ref_state_get(sitdpll->dev, dpin->id);
> + *frequency = ref->freq;
> +
> + return 0;
> +}
[Severity: Low]
This isn't a bug, but the comment does not cover every user of this
callback. It is also installed in sit9531x_dpll_xo_pin_ops and
sit9531x_dpll_xo_pin_manual_ops. For the XO, sit9531x_pin_props_get()
takes curr_freq from sitdev->xtal_freq and skips the firmware properties,
so the value is not a supported-frequencies-hz entry.
The XO ops also have no norate variant. If xtal_freq were 0, the XO would
report 0 Hz, while other inputs with no rate leave the attribute out.
[ ... ]
> @@ -567,8 +609,84 @@ sit9531x_dpll_output_pin_direction_get(const struct dpll_pin *pin,
[ ... ]
> +static int
> +sit9531x_dpll_output_pin_frequency_get(const struct dpll_pin *pin,
> + void *pin_priv,
> + const struct dpll_device *dpll,
> + void *dpll_priv, u64 *frequency,
> + struct netlink_ext_ack *extack)
> +{
> + struct sit9531x_dpll_pin *dpin = pin_priv;
> + struct sit9531x_dpll *sitdpll = dpll_priv;
> + struct sit9531x_dev *sitdev = sitdpll->dev;
> + int rc;
> +
> + mutex_lock(&sitdev->multiop_lock);
> + rc = sit9531x_output_freq_get(sitdev, dpin->id, frequency);
[Severity: Low]
Is a live hardware read intended on every get and dump here?
sit9531x_output_freq_get() reads the following through sit9531x_get_fvco():
- the DIVN integer byte
- 4 numerator bytes
- 4 denominator bytes
- the XO doubler register
It then reads 5 DIVO bytes through sit9531x_output_divo_read(). That is
about 15 paged I2C reads per output pin, plus page selects. They all run
under multiop_lock and the core's dpll_lock. With up to 12 outputs, one
pin dump becomes a few hundred I2C transfers.
The earlier commit "dpll: sit9531x: register DPLL devices and pins"
describes the poll as filling "a cache the callbacks answer from, so a
netlink call does not become a burst of I2C transfers".
This patch keeps sitdev->out[].freq up to date but only uses it as was in
the set path. Could the get answer from the cached value? If not, could
the commit message mention the departure?
> + if (rc == -ENODATA)
> + *frequency = 0;
> + mutex_unlock(&sitdev->multiop_lock);
> +
> + return rc == -ENODATA ? 0 : rc;
> +}
[Severity: Low]
When the divider chain does not resolve, this emits DPLL_A_PIN_FREQUENCY
= 0. That is below the 1 Hz minimum that sit9531x_pin_props_get()
advertises for the pin, and userspace cannot tell it from a real reading.
For inputs with no rate, the same patch adds
sit9531x_dpll_input_pin_norate_ops and
sit9531x_dpll_input_pin_norate_manual_ops so the attribute is left out
instead.
Both approaches work around dpll_msg_add_pin_freq() in dpll_netlink.c,
which fails the whole pin dump on any error:
ret = ops->frequency_get(pin, dpll_pin_on_dpll_priv(dpll, pin), dpll,
dpll_priv(dpll), &freq, extack);
if (ret)
return ret;
The phase_adjust, phase_offset and ffo helpers already treat -ENODATA as
an absent attribute. The first patch of this series, "dpll: omit pin phase
attributes the driver has no value for", added that handling because "a
zero cannot be told from a measurement". The same reasoning applies here.
Would it be better to give dpll_msg_add_pin_freq() the same -ENODATA
handling and return -ENODATA from here? That would avoid making 0 Hz part
of the uAPI, and it would also remove the need for the separate norate
input ops.
> +
> +static int
> +sit9531x_dpll_output_pin_frequency_set(const struct dpll_pin *pin,
[ ... ]
> + mutex_lock(&sitdev->multiop_lock);
> + /* The advertised range is the same for every output mode */
> + if (sitdev->out[dpin->id].cmos &&
> + frequency > SIT9531X_OUT_FREQ_CMOS_MAX_HZ) {
> + mutex_unlock(&sitdev->multiop_lock);
> + NL_SET_ERR_MSG(extack,
> + "Frequency above the 250 MHz limit of an LVCMOS output");
> + return -EINVAL;
> + }
[Severity: Low]
Should the supported set advertised for an LVCMOS output stop at 250 MHz?
sit9531x_pin_props_get() advertises the same rates for every output: 1 Hz
to 800 MHz, plus 61.44 MHz times {15, 20, 24, 30, 32, 40, 48}, up to about
2.949 GHz. It does not check sitdev->out[index].cmos. That flag is already
known at probe, because sit9531x_output_mode_fetch() runs in
sit9531x_dev_state_fetch() before the pins are registered.
dpll_pin_freq_set() in the core checks the request only against
freq_supported. When the driver then fails, the core overwrites the
message set here:
NL_SET_ERR_MSG_FMT(extack,
"frequency set failed for dpll_id:%u",
dpll->id);
So a user who picks an advertised rate above 250 MHz on a CMOS output gets
-EINVAL with only the generic message.
The continuous 1 Hz to 800 MHz range has a milder form of the same gap.
sit9531x_output_divo_calc() accepts only exact Fvco/N values, and it
reports the reason only through dev_dbg().
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201235202.97645-1-arouhi%40sitime.com
Technical Details
Message-ID:
<179625835286.3146.13064702356278777587@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376164-linux-kernel-netdev=dewy.ruReferences:
<20261201235202.97645-10-arouhi@sitime.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376164-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Date: Thu, 03 Dec 2026 00:39:12 +0000 Organization: Usenet Network Message-ID: <179625835286.3146.13064702356278777587@kernel.org> References: <20261201235202.97645-10-arouhi@sitime.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2097768"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ZdE0Ul65yoxiL9whCy2f6zc0OLc= sha256:EYwcvme9+WTXGhTei6O7YbUz/97lYdiqhoP8hielT+g= sha1:0jEbuADH1FAxe9yZ0TYHgCiEXRg= sha256:EAjaKO+AUBQZbKybrjrJbcI/D2pKS+3m+xZ0IsOeZjg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 1DCA51177BE; Thu, 3 Dec 2026 03:40:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WXU7NGSwgFLB; Thu, 3 Dec 2026 03:40:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376164-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id EF9251177BD; Thu, 3 Dec 2026 03:39:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 855EA2DF17; Thu, 3 Dec 2026 00:39:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796258355; b=ZuL59wWdf5BSr6dSxEGFXCxlsVF7KgR191JI20RvfWHL3zNcHliO10y4o0fbrhLqibFK 07wgY9ukgg22S2fuvv9etqAlNV0fSTohKEFX0szZKHpMrAKFWwPZ3WR7P2Cu576gpyqtP iIOmRFhQe4ziowENbtPo1LvAyP7XCPwY2v6eozQWAFfdXwdBQC+XcACAPzlKNSzJbANyh cTwJwud87Hu4zA+BPmBT0rrrrzYLgPqW+e9jKH7FYRaW3xYFVjZVTjY0rL3pLKvMMzNhp geAvE80OrvtaBTZMe2JKBJ54G9z3q/aD1NKkBp/69Rb/HTMVRSDKUdklJuCiGwK+Zbg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258355; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=7HqO6Xo4KDx1c7X9FIjna/dfPZ227CmjJptWjUywgYQ=; b=wkb7ww2dsk740csYV5n2+yX4ph0YiGcAeLL9gdpXW2D0UbB3YukYFNBbeHuBf2d2TYHa LgGeW8afPHNhr+x+EGRWB368rLTPT9o29LuzYAclanvtZiuYJUmxq58znf3NW3f0eVIBR 6+i4h7PV3r8eMQFWGNhcUc7FoO2uK89ttoFVFnOHWJqKjJnPJ2YPG7+JxOKUEysIH769t cH4ol9LPwrGklubL4G9/eJ3gObrU9Khp4a76bb1siplrgcHCFLdomYnacV6vXUlh2PgmU aIeqbrRBOPgIq5CiZ+Zkyq2jKcoZQmTo8TRaa/+wmo8lKsebxRDt63JqJIofB3Mz/wg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hBiKFJd0; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63E0F60A2613; Thu, 3 Dec 2026 00:39:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hBiKFJd0 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796258354; b=mPIrm6jrnX6ImBS7vLoZuAEXhzNE+C4YtMAh3TI2SSmrYDFk2p6lLgxzd0TeDhvEIBy/ lU5I6sTjEJAWfQGV2ADxTUnmTWAoUpSb6/Pgve2MN7ac/p3gX7dgJ3xo3MlBKq8rYT6VK aq6k0TJiZJN+ve3NJRozNxFPJqk+qxAeZGnkQDIyCFb/9ff7+JON/7ypXw0ftTwLjUrCX pvjQqPpFixTEYoAVYX2IicNu3XbLI1HduY7n0GraiCvoZ6eDziMFaHyDiqDNmz8qCae87 mN+73q3WA52V7trO9aBXyy3263hBvZeu4YhB+0220euSK5IyM+Fydo8RGECXcvV96lw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258354; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=7HqO6Xo4KDx1c7X9FIjna/dfPZ227CmjJptWjUywgYQ=; b=NmpfRvZ7825G1I7KROnGoWptdMYl4O9Ta1DtEbfYBRo/uGX0yV7PpFRyK6FsUbij6bQp jvAaRLC19AVvALjhn0AtemFlffkuMxsMV6HbVJWYN7MuKhI8TO2csgxTrsdsTNOuZwM3y rwDJz5BQ2K6QepKZcZzYbIBo56qkP+2c8E964egHeUci+QS12+AJpLWxgOSWqquXV9zO0 AiGmj4vWReiAbIlIQUcWDcr9LwQkfyV4C6CbtMUquBdg4lVyQUNiXElw64GVTaFlUssUz TTxmU7p/rREwa1epO5L/QQg9NrwKvCYDc7HqL13G+c/8T6eJ+VBYTCkNcbrM8C7HHlQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hBiKFJd0; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8557E606A68F; Thu, 3 Dec 2026 00:39:14 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F5071F00893; Thu, 3 Dec 2026 00:39:13 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796258354; bh=7HqO6Xo4KDx1c7X9FIjna/dfPZ227CmjJptWjUywgYQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=hBiKFJd0Ttm5hXq8B30piLlHWzYbaAByZK11pkYsdGm2Pqr2Qu75GQBE6y5VngEUJ ko8DBgUjO5eYAvh5nmS4ojEdIZPUW/VW/giEO14GoGRTUbLxZDo+gkmkH4cTtkV8Yx 4hmZRc7oiU/tyeCXU37H7Mw4Znjvw2D73Xf7Xq45gNqPfeiuAAA0zQsjpAxwuWuyCT 637s7X++HkZSRT3uPKLD/eUq/MPOhSiMs79jZwtFx2E6GVi9YKPHgY+HOgzMwpiATU GCDTXfHe1xz97eV3LNMl6U4HuNUjdw5ZreLBH+w4Lq9EfLi3zf8/xol+BLocxN/e6W u7cYlOUYyIoEg== X-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 X-In-Reply-To: <20261201235202.97645-10-arouhi@sitime.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list