From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796258359; b=lZluImir2mU+g9vHAyMTW43tg4hFlG1Z8KXxq32pNWlq9y2p2nOojpwTABINEmhRhwdc 4lHj2G/LAhUYU5OLNmFCT4h/Gmd+QqGTfDupM9Mr9WkdZumHW5eoxlIeD7pU6PrkCxDCw 10JS1qQ1A3/QJ/BmMHUwQ02CnAEOuOxdCSIFnMDaXEv4OC4XURIhOfb4/qwpDRjTAy9a7 X750E8GoVAFhyh8/obU8cDJzX4SIIf8vhp0jNGQ7uc4QHr8ydt3nsGxT4MfhDshUd6DQc 98lkORNxiz+YZ5OeMV7DCOy7ZVUVdhMzFzLQIvobmjy5/A3YzIffv5cYwrqk1FLY7Zw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258359; 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=1OkezFb+Oy5mfI5OKRLbuG27l2XpWDZHTp5YNzl2Lkg=; b=0UE/AUDnCnyTkWBbW96cxZpihrLmve04ZdWRP6Oe2t/lQvoTsTG/sZoq8yWn84rM4PtC YVdzNGTNOKHABZ5nMJkX8S+GneBRAaTDqkTdTEIMnCHm60vw/iHDfl82jIzS5iTQTP7OR N0Qf0j7dt3ttFbQYV4O4T9Ga6TJxBOGuWNOPMb8pVseRPQJTDTB+KMlKLP7L/0GY3+3KY AJoe+8fnNElXX+N5FniW3KZl1Clx+qBiFrctGU6ymZpQSsIlDvNl+wJwIBrhoQtY5GVdI my4BNuP72MTtgu1ScTwSuO8Ftj0TLb0iq/aObZSeyZiXS2JbIhJAU7YEb6DDe1nPdiw== 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=nDnzxEGE; arc=none smtp.remote-ip=100.103.45.18 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 2D0A3606A689; Thu, 3 Dec 2026 00:39:18 +0000 (UTC) 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=nDnzxEGE Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEC091F00937; Thu, 3 Dec 2026 00:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796258358; bh=1OkezFb+Oy5mfI5OKRLbuG27l2XpWDZHTp5YNzl2Lkg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=nDnzxEGEhXajcObesG1N5WEijqNdkvErSY3EfRm6n1MJXII5Cqbj5pgrUTRxg9ohL zIz1rgFgpYanyj73q51J5lqmdatsvny0BbFi/WsPrgFW/tD17DxgiBwXYfQVCnEJBv e6wkooDHVoE0Y1/L6XC0v8jgdTMMVCVUAKudCjI/kwudnyEwn7rvGw0eN2JZF7LSD6 FlGxqroelc2wtdPE1WkkrPBROhtRviyUaHecnkRlfNtW92frDjPdbC1uLc26x7aK66 E49H32uHaUEugIWRXT3jUm2qiq4s2yYEWMX5lvjFQeXPhB+2UeKKB/neTZIrXEwjLC diJBytmqJIsmw== Subject: Re: [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins 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 Date: Thu, 03 Dec 2026 00:39:17 +0000 Message-ID: <179625835746.3146.1059556252919082882@kernel.org> In-Reply-To: <20261201235202.97645-14-arouhi@sitime.com> References: <20261201235202.97645-14-arouhi@sitime.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 6 · Low: 1 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] sit9531x_resume() assumes the part lost power and reloaded its profile, and drops pending hardware sequences without checking. - [Medium] sit9531x_retime_kept() documents three outcomes: 1 if the registers hold the pending request, 0 if they do not, and <0 if a read… - [Medium] The kernel-doc in core.h defines @intsync_stale as '@intsync_src must be read back before use'. - [Medium] sit9531x_intsync_src_detect() skips any EXT page where even one INTSYNC register holds a value other than en_val or dis_val: `if… - [Medium] sit9531x_intsync_enable() writes en_val whole to the eight EXT-page registers (core.c:3068). - [Medium] dpll: sit9531x: premature pin notification on read failure in sit9531x_resume() - [Low] This patch is titled and mostly about INTSYNC, but it also reworks sit9531x_resume() in ways that have nothing to do with INTSYNC. -- dpll: sit9531x: model the inter-PLL sync line as a pair of pins This patch models the SiT9531x internal inter-PLL sync line (INTSYNC) as a source pin on every DPLL plus a destination input pin. Connecting the source pin writes an enable pattern to the PLL's EXT page and then sets a global enable. The patch also extends resume to re-read the INTSYNC owner and output delays, notify pins that changed, and drop pending writes to registers a reloaded profile sets. > diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c > index 1f4ed3365ffe1..9761f11a3ec30 100644 > --- a/drivers/dpll/sit9531x/core.c > +++ b/drivers/dpll/sit9531x/core.c [ ... ] > @@ -2760,6 +2779,596 @@ static int sit9531x_clear_notifications(struct sit9531x_dev *sitdev, [ ... ] > +/* > + * The bytes Intsync_enable_disable.py writes, each register whole, to the EXT > + * page of the PLL that drives the line: en_val to drive it, dis_val to stop. > + */ > +struct sit9531x_intsync_reg { > + u8 offset; > + u8 en_val; > + u8 dis_val; > +}; > + > +static const struct sit9531x_intsync_reg intsync_config[] = { > + { 0x2D, 0x02, 0x00 }, > + { 0x50, 0x08, 0x00 }, > + { 0x51, 0x04, 0x00 }, > + { 0x54, 0x02, 0x00 }, > + { 0x55, 0x28, 0x20 }, > + { 0x5C, 0x0F, 0x00 }, > + { 0x5D, 0xFF, 0x00 }, > + { 0x6C, 0xDD, 0x00 }, > +}; [Severity: Medium] Can the connect and disconnect sequences overwrite profile settings held in these EXT page registers? sit9531x_intsync_enable() writes each en_val as a whole byte. __sit9531x_intsync_disable() is used for a disconnect and also for the enable rollback, and it writes each dis_val as a whole byte: rc = sit9531x_write_u8(sitdev, SIT9531X_REG(ext_page, intsync_config[i].offset), intsync_config[i].dis_val); Neither path reads or saves the bytes that were there before, and neither does a read-modify-write. Register 0x55 has bit 5 set in both 0x28 and 0x20. That suggests it also holds fields unrelated to INTSYNC. sit9531x_intsync_src_detect() treats a page with other values as not a source, so a connect is allowed on it. One connect/disconnect cycle, or one failed connect that rolls back, replaces the profile's values with the dis_val image. The next scan then reports the page as an ordinary disabled page. Would it be safer to save the original bytes before the enable and restore them on disconnect, or to change only the INTSYNC bits? > + > +/* > + * Find the PLL whose EXT page holds the INTSYNC enable pattern, whole or in > + * part. Caller must hold sitdev->multiop_lock. > + */ > +int sit9531x_intsync_src_detect(struct sit9531x_dev *sitdev) > +{ [ ... ] > + n_en = 0; > + n_dis = 0; > + for (i = 0; i < ARRAY_SIZE(intsync_config); i++) { > + u16 reg; > + u8 val; > + > + reg = SIT9531X_REG(ext_page, intsync_config[i].offset); > + > + rc = sit9531x_read_u8(sitdev, reg, &val); > + if (rc) > + break; > + if (val == intsync_config[i].en_val) > + n_en++; > + else if (val == intsync_config[i].dis_val) > + n_dis++; > + } > + > + ret = sit9531x_intsync_debug_lock(sitdev, pll); > + if (!rc) > + rc = ret; > + if (rc) > + return rc; > + > + /* > + * A page with the disable pattern or with other values is not a > + * source. > + */ > + if (!n_en || n_en + n_dis != ARRAY_SIZE(intsync_config)) > + continue; > + n_pages++; [Severity: Medium] What happens to a page that holds most of the enable pattern but has one register with some other value? That page is skipped here. It never counts toward n_pages, partial or src, so it sets neither intsync_partial nor intsync_conflict. The driver's own failed sequences can leave a page like that: - sit9531x_intsync_enable() writes the en_val bytes in order and stops at the first failure. The remaining registers keep their profile values, which need not equal dis_val. - If the restore=false rollback in __sit9531x_intsync_disable() also fails partway, the page holds a mix of enable, disable and original values. While the driver stays bound, the rollback_failed/owner_kept result records the PLL as a partial source. After a rebind, the fresh scan from sit9531x_dev_state_fetch() skips the page. A CONNECTED request on another PLL then passes every check in sit9531x_dpll_intsync_src_state_on_dpll_set(). sit9531x_intsync_enable() then sets the global enable over the half-configured page. Its own comment says this may drive the line from that page: The enable comes last: set over a page holding part of the pattern, it may drive the line from that page. Could a page that holds some enable bytes, but matches neither pattern, still be recorded as a partial source? [ ... ] > @@ -4891,6 +5521,41 @@ static const struct of_device_id sit9531x_of_match[] = { > }; > MODULE_DEVICE_TABLE(of, sit9531x_of_match); > > +/* > + * Compare the delay bytes of an output with its pending re-time, decoded as the > + * delay setter does: 1 if they hold the request, 0 if not or if the request has > + * no encoding for the divider, <0 if a read failed. Caller must hold > + * sitdev->multiop_lock. > + */ > +static int sit9531x_retime_kept(struct sit9531x_dev *sitdev, u8 out_idx) > +{ [ ... ] > + rc = sit9531x_get_fvco(sitdev, out->pll_idx, &fvco); > + if (!rc) > + rc = sit9531x_output_divo_read(sitdev, out_idx, &divo); > + if (rc) > + return rc == -ENODATA ? 0 : rc; [ ... ] > + rc = sit9531x_output_phase_bytes_read(sitdev, out_idx, bytes); > + if (rc) > + return rc; [ ... ] > @@ -4924,6 +5592,81 @@ static int sit9531x_resume(struct device *dev) > mutex_lock(&sitdev->multiop_lock); > /* One re-select for a source lost and restored between samples */ > sit9531x_reselect_arm(sitdev); > + /* > + * Drop and report the pending writes to registers a reloaded profile > + * sets. Keep a delay re-time whose bytes still hold the request, and > + * the undo of a state the driver set: loops or a debug key left open, > + * debug taps left selected, a table write-back under forced holdover. > + */ > + for (i = 0; i < SIT9531X_NUM_PLLS; i++) { [Severity: Medium] Does sending the notification here, right after a failed read, lose the retry that ntf_pending would otherwise give? In the resume loop, two failures lead straight to this call: - If sit9531x_output_phase_read() fails, out->phase_stale is set and the output is added to outs_unread. - If sit9531x_intsync_readback() fails, intsync_stale is set and src_moved becomes true. sit9531x_drive_pins_ntf() sets out[].ntf_pending or intsync_ntf_pending only when dpll_pin_change_ntf() itself returns an error. For an output pin, dpll_pin_change_ntf() calls sit9531x_dpll_output_pin_phase_adjust_get(). If the bus is still failing, that getter returns -ENODATA. The core then omits the phase adjust attribute and the notification succeeds. ntf_pending is never set, so sit9531x_dpll_output_ntf_pending() never retries the readback. User space gets no update with the real delay once the bus recovers. For the source pin, sit9531x_dpll_intsync_src_state_on_dpll_get() ignores the result of sit9531x_intsync_refresh() and always returns 0. The notification cannot fail, so the pending flag is never set. That gives three bad outcomes: - If the refresh keeps failing, the message carries the pre-suspend owner. - If the refresh fails for one DPLL in dpll_msg_add_pin_dplls() and succeeds for a later one, a single message can report different owners on different DPLLs. - If the refresh succeeds inside the notification and sees an owner change, it sets intsync_ntf_pending, and the poll sends the same notification a second time. Would it be better to leave a pin whose readback failed out of the resume notification, and set its ntf_pending or intsync_ntf_pending instead? The poll would then notify once the stale record has actually been read back. [Severity: Low] This isn't a bug, but could this resume rework go in its own patch? The subject and most of the commit are about INTSYNC. This part adds the following to sit9531x_resume(): - a per-PLL loop that drops table_pending, ho_release_pending, retime_pending (through the new sit9531x_retime_kept()), flush_pending and flush_arm_pending - drops of flush_ctrl_pending, bank_pending and ref[].off_pending - a re-read of every output's phase delay - the outs_was/outs_now/outs_unread/outs_moved bookkeeping that notifies output pins through sit9531x_drive_pins_ntf() The patch also rewrites the W1C comment in sit9531x_dev_periodic_work(). None of this is related to INTSYNC, and it changes resume behaviour on parts that never use the sync line. The commit message covers all of it in one clause: "Resume reads the line owner and output delays again, notifies pins whose mute, delay or source changed, drops a pending write to registers a reloaded configuration sets, ..." > + struct sit9531x_chan *chan = &sitdev->chan[i]; > + bool retime = false, flush, arm; > + u8 j, ho; [ ... ] > + for (j = 0; j < sitdev->info->num_outputs; j++) { > + if (!sitdev->out[j].retime_pending || > + sitdev->out[j].pll_idx != i) > + continue; > + if (sit9531x_retime_kept(sitdev, j)) { > + kept |= BIT(i); > + continue; > + } > + sitdev->out[j].retime_pending = false; > + retime = true; > + } [Severity: Medium] Is a negative return from sit9531x_retime_kept() meant to take the kept branch here? The helper's comment says it returns "<0 if a read failed". It passes on the I2C error from sit9531x_get_fvco(), sit9531x_output_divo_read() or sit9531x_output_phase_bytes_read(). This caller tests the result as a boolean. On a read failure, retime_pending stays set and BIT(i) is added to kept. kept then blocks the drops of chan->flush_pending and flush_arm_pending below, and of the global flush_ctrl_pending: if (sitdev->flush_ctrl_pending && !kept) { The poll then replays the pre-suspend re-time. sit9531x_phase_flush_undo_retry() then writes the saved flush_ctrl byte and flush-arm bits over a configuration the part may have reloaded. Every other failed read in resume logs a warning; this one does not. > + /* > + * A re-time left pending ends in a flush, which first restores > + * the trigger select and the flush enable: keep them pending. > + */ > + flush = !(kept & BIT(i)) && chan->flush_pending; > + arm = !(kept & BIT(i)) && (sitdev->flush_arm_pending & BIT(i)); [ ... ] > + if (sitdev->flush_ctrl_pending && !kept) { > + dev_warn(sitdev->dev, > + "flush trigger source select pending before suspend, dropped\n"); > + sitdev->flush_ctrl_pending = false; > + } > + if (sitdev->bank_pending) { > + dev_warn(sitdev->dev, > + "output divider bank update pending before suspend, dropped\n"); > + sitdev->bank_pending = false; > + } > + for (i = 0; i < sitdev->info->num_inputs; i++) { > + if (!sitdev->ref[i].off_pending) > + continue; > + dev_warn(sitdev->dev, > + "input %u: receiver gate-off pending before suspend, dropped\n", > + i); > + sitdev->ref[i].off_pending = false; > + } [Severity: Medium] Are these drops safe when the part keeps its power over suspend? sit9531x_suspend() only disables the IRQ and cancels the poll. It touches neither the supplies nor the reset line. In s2idle, or on boards whose rails stay up in S3, the profile is usually not reloaded, and nothing here checks whether it was. In that case, three pending sequences are lost: 1. A bank update that failed before suspend. With loops_open still set, sit9531x_prg_retry() takes this path: if (!sitdev->bank_pending) return sit9531x_prg_relock_retry(sitdev); PRG_CMD is then written without the bank copy, so the divider values the driver wrote are never applied. 2. A receiver gate-off that failed in sit9531x_input_disable(). The receiver stays powered, ref->enabled is already false, and the retry is gone. 3. The output realignment after a divider change. Once flush_pending and flush_arm_pending are cleared, the outputs stay unaligned. The re-time path checks the registers through sit9531x_retime_kept(). The bank, gate-off and flush records get no such check. The INTSYNC record has the opposite problem. sit9531x_intsync_readback() keeps a recorded partial INTSYNC source when the scan finds none: if (partial && !sitdev->intsync_foreign && (sitdev->intsync_src < 0 || (sitdev->intsync_src == src && !sitdev->intsync_partial))) { After a real reload that record is stale. Until the user disconnects that source pin, it keeps refusing connects on other PLLs and keeps reporting the destination pin DISCONNECTED on that PLL. [ ... ] > diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c > index 3fe65e2d5aecc..096749b39f1e1 100644 > --- a/drivers/dpll/sit9531x/dpll.c > +++ b/drivers/dpll/sit9531x/dpll.c [ ... ] > @@ -677,6 +707,366 @@ static const struct dpll_pin_ops sit9531x_dpll_input_pin_norate_manual_ops = { [ ... ] > +/* Caller must hold sitdev->multiop_lock. */ > +static bool > +sit9531x_dpll_intsync_src_connected(const struct sit9531x_dev *sitdev, > + const struct sit9531x_dpll *sitdpll) > +{ > + return sitdev->intsync_src == sitdpll->id && !sitdev->intsync_partial; > +} [ ... ] > +static int > +sit9531x_dpll_intsync_src_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) > +{ > + struct sit9531x_dpll *sitdpll = dpll_priv; > + struct sit9531x_dev *sitdev = sitdpll->dev; > + > + mutex_lock(&sitdev->multiop_lock); > + sit9531x_intsync_refresh(sitdev); > + if (sit9531x_dpll_intsync_src_connected(sitdev, sitdpll)) > + *state = DPLL_PIN_STATE_CONNECTED; > + else > + *state = DPLL_PIN_STATE_DISCONNECTED; > + mutex_unlock(&sitdev->multiop_lock); > + > + return 0; > +} [Severity: Medium] What should this getter report when sit9531x_intsync_refresh() fails and the record stays stale? The kernel-doc in core.h says: * @intsync_stale: @intsync_src must be read back before use sit9531x_intsync_driven() follows that rule: if (sitdev->intsync_src >= 0 && !sitdev->intsync_partial && !sitdev->intsync_stale) return true; This getter drops the refresh error. sit9531x_dpll_intsync_src_connected() then answers from intsync_src and intsync_partial without checking intsync_stale. The same applies to these readers: - sit9531x_dpll_intsync_dst_state_on_dpll_get() - sit9531x_dpll_intsync_dst_operstate_on_dpll_get() - sit9531x_intsync_owner() - sit9531x_dpll_pin_snapshot() The record can stay stale after a failed readback in sit9531x_resume() (intsync_stale = rc != 0), or after a set request that left it stale. While I2C keeps failing, user space would see the source pin CONNECTED and the destination pin DISCONNECTED on the recorded PLL. The destination pins would also report NO_SIGNAL, because sit9531x_intsync_driven() refuses the same record. The setter fails with an extack message when the refresh fails. Should the getters handle a failed refresh the same way as the setter or as sit9531x_intsync_driven()? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201235202.97645-1-arouhi%40sitime.com