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=1796255581; b=zCaSAxkfcji+i+0VBkXldlFwPodGH7FMo+2gU+A4oTt/Nlpskc2pgFvE5XWMGcvIZPYz Kgi+8eRvbTLy2GzeZFRUFbnTfBAMDbRcUouWNpnrNDsb9aS2LW6xZluqZMv0uPYoO2gzr Wf3GHPLTxA07wnJqfi48DHoSRZtG1KLVWtxsOITvwxv3DazS1gHueZxGLwxW0qjdifLeb TLxut/woQn15Q/Krsqym8HsrLkOycT7lc/WwH93HOuoLq6X9RD0SjthufKnffMz6fCY5a lM+VU9fJLBPezaC3SZdL5nxOePsIYCqBRuu2JEXw9edOlCTSsJwT+uOsZA3xpwmlNnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796255581; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ikm0qIMFXsOlTm1/dPDGQEvfZXjdsKLIjuJIt8BfDDM=; b=4pV/u0ZfmAn6xnkZdP/JH+iPKxnTroO2gc9tS3BmnWiGqkoWymnzuDpsDf3JbaBQ2Fxf LBBz0AbbOvdZizX2PoRwCjIakchIJ1Id5mH0zBAlhWD+IdEShdvxgqgix0Dhc22FGy/E4 QuVu9iqHmMSx03OmOLz7J5B3EPSJ4U80YYFyjgvya7/uA95B/tLy1n6ABjEG7p1wWMsOG /jU+ixpISDrVJpByx0Mej6susIK99OjuA75n11nnnoSAhMVUyvhADa8uDHvPMm4/5zoLh dNpxpHro8VaQKjYgvNqinLgm69c7CRlFkfeNE9PqXL0bIX/XubenH2B/CkWr2OnWhVw== 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=Lq7FblI4; 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 B8E28606A330 for ; Wed, 2 Dec 2026 23:53:01 +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=Lq7FblI4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1B5A1F00929; Wed, 2 Dec 2026 23:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255581; bh=ikm0qIMFXsOlTm1/dPDGQEvfZXjdsKLIjuJIt8BfDDM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Lq7FblI4qbDLol59f7gWNpT2Zlz4K2WUq5JfV2vLHF3xarkFBdKI4sCMfdFw3JmUm cv5DfZsCEkyNbpRyMQb/Fg+qwWOn04TSiZ19+iPRIevDUl6f3YlhpJ65LmiPFWfnwY 7DQt4/RoP5QurW6Jdliec/L/YtgFDXdk3o4XSJ0ucuVpOTLRVNfq95SoWIEYoNtdlx l1sX/0v6JWRkPu7NeddoZ2h5c7wcACgVphXrSZUJzZNJEUxAaBArLmuXzbmObaIY/E AMxJ61eb4thUrbMIuAtbkzFmUeumv+tvbzZ36F2jORH22FgvmQYca8/nWCOLpUV/R8 VbASu/GNDrkkQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v17 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Reply-To: sashiko-reviews@lists.linux.dev To: "Ali Rouhi" Cc: =?utf-8?b?ZGV2aWNldHJlZUB2Z2VyLmtlcm5lbC5vcmc=?= , robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261201235202.97645-14-arouhi@sitime.com> References: <20261201235202.97645-1-arouhi@sitime.com> <20261201235202.97645-14-arouhi@sitime.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 23:53:00 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] dpll: sit9531x: stale routing and error test in sit9531x_retime_kept() - [Medium] dpll: sit9531x: per-PLL drop of flush_arm_pending in sit9531x_resume() - [Medium] dpll: sit9531x: premature pin notification on read failure in sit9531x_resume() - [Low] dpll: sit9531x: masked INTSYNC selection state on source PLL -- commit da914769c051305f662b4b8daf460009252cad07 Author: Oleg Zadorozhnyi dpll: sit9531x: model the inter-PLL sync line as a pair of pins This commit models the inter-PLL synchronization line (INTSYNC) as a source pin and a destination pin on each DPLL, and updates the resume path to re-read INTSYNC ownership, output delays, and pending state. > 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 [ ... ] > @@ -4891,6 +5521,41 @@ static const struct of_device_id sit9531x_of_match= [] =3D { > }; > MODULE_DEVICE_TABLE(of, sit9531x_of_match); > =20 > +/* > + * Compare the delay bytes of an output with its pending re-time, decode= d as the > + * delay setter does: 1 if they hold the request, 0 if not or if the req= uest 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) > +{ > + struct sit9531x_out *out =3D &sitdev->out[out_idx]; > + u8 bytes[SIT9531X_OUT_PRG_BYTES], fine, old_fine; > + u64 fvco, divo, coarse, old_coarse; > + s32 phase_adj; > + int rc; > + > + if (!out->routed) > + return 0; > + > + rc =3D sit9531x_get_fvco(sitdev, out->pll_idx, &fvco); > + if (!rc) > + rc =3D sit9531x_output_divo_read(sitdev, out_idx, &divo); > + if (rc) > + return rc =3D=3D -ENODATA ? 0 : rc; > + > + if (sit9531x_output_phase_encode(fvco, divo, out->retime_ps, &coarse, > + &fine, &phase_adj)) > + return 0; > + > + rc =3D sit9531x_output_phase_bytes_read(sitdev, out_idx, bytes); > + if (rc) > + return rc; > + sit9531x_output_phase_bytes_decode(bytes, &old_coarse, &old_fine); > + > + return old_coarse =3D=3D coarse && old_fine =3D=3D fine; > +} > + > /* > * Stop the poll and the IRQ across suspend so no paged I2C sequence rea= ches a > * suspended adapter; the poll worker is not freezable. > @@ -4908,9 +5573,12 @@ static int sit9531x_suspend(struct device *dev) > =20 > static int sit9531x_resume(struct device *dev) > { > + u16 outs_was =3D 0, outs_now =3D 0, outs_unread =3D 0, outs_moved =3D 0; > struct sit9531x_dev *sitdev =3D dev_get_drvdata(dev); > struct sit9531x_dpll *sitdpll; > - u8 modes_moved =3D 0; > + u8 modes_moved =3D 0, kept =3D 0; > + bool src_moved; > + s8 owner; > int rc; > u8 i; > =20 > @@ -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 =3D 0; i < SIT9531X_NUM_PLLS; i++) { > + struct sit9531x_chan *chan =3D &sitdev->chan[i]; > + bool retime =3D false, flush, arm; > + u8 j, ho; > + > + /* > + * A table write-back is pending only under forced holdover; > + * once that is cleared, the next poll reads the table from the > + * registers. > + */ > + if ((chan->table_pending || chan->ho_release_pending) && > + !sit9531x_read_pll_u8(sitdev, i, SIT9531X_PLL_REG_HO_CTRL, > + &ho) && > + !(ho & BIT(SIT9531X_PLL_HO_FORCE_BIT))) { > + dev_warn(sitdev->dev, > + "PLL%c: forced holdover cleared over suspend, priority table restor= e dropped\n", > + 'A' + i); > + chan->table_pending =3D false; > + chan->ho_release_pending =3D false; > + } > + > + for (j =3D 0; j < sitdev->info->num_outputs; j++) { > + if (!sitdev->out[j].retime_pending || > + sitdev->out[j].pll_idx !=3D i) > + continue; > + if (sit9531x_retime_kept(sitdev, j)) { > + kept |=3D BIT(i); > + continue; > + } > + sitdev->out[j].retime_pending =3D false; > + retime =3D true; > + } [Severity: Medium] Can sit9531x_retime_kept() leave out->retime_pending permanently stuck at true on resume? sit9531x_retime_kept() runs here before sit9531x_out_state_fetch() refreshes out->routed and out->pll_idx further down in sit9531x_resume(), and testing its return value with if (sit9531x_retime_kept(sitdev, j)) also treats a negative I2C error return as kept. If the output became unrouted over suspend (or a read fails here and sit9531x_out_state_fetch() then finds it unrouted), the resume delay readback skips the output because out->retime_pending is still set, and every later poll in sit9531x_retime_retry() -> sit9531x_output_phase_adjust_set() returns -ENODEV without clearing out->retime_pending. > + /* > + * A re-time left pending ends in a flush, which first restores > + * the trigger select and the flush enable: keep them pending. > + */ > + flush =3D !(kept & BIT(i)) && chan->flush_pending; > + arm =3D !(kept & BIT(i)) && (sitdev->flush_arm_pending & BIT(i)); > + if (!retime && !flush && !arm) > + continue; > + dev_warn(sitdev->dev, > + "PLL%c: pending before suspend, dropped:%s%s%s\n", > + 'A' + i, retime ? " output delay" : "", > + flush ? " output realignment" : "", > + arm ? " on-demand flush enable" : ""); > + if (kept & BIT(i)) > + continue; > + chan->flush_pending =3D false; > + sitdev->flush_arm_pending &=3D ~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 =3D false; > + } [Severity: Medium] As reported by Jakub Kicinski on v15 [1], does clearing sitdev->flush_arm_pending per PLL when !(kept & BIT(i)) lose the undo of sibling PLLs parked by an earlier phase flush? sit9531x_output_phase_flush() parks every armed sibling PLL by clearing SIT9531X_PLL_PHFL_ON_DEMAND_EN and records any failed restore in sitdev->flush_arm_pending. If one PLL has a kept re-time while another PLL without a kept re-time has its bit set in sitdev->flush_arm_pending, clearing that bit in the per-PLL loop prevents sit9531x_phase_flush_undo_retry() from restoring it before the kept re-time's flush reads SIT9531X_PLL_REG_PHFL_CTRL across all four PLLs, and when kept =3D=3D 0 on a part that kept power across suspend, dropping flush_arm_pending and flush_ctrl_pending abandons the undo of the driver's temporary register values. [ ... ] > @@ -4982,14 +5729,62 @@ static int sit9531x_resume(struct device *dev) > "out%u: state not read on resume: %d\n", > i, rc); > out->state_stale =3D true; > + outs_unread |=3D BIT(i); > } > - if (out->routed !=3D routed || out->pll_idx !=3D pll_idx) > + if (out->routed !=3D routed || out->pll_idx !=3D pll_idx) { > dev_warn(sitdev->dev, > "out%u: routing changed over suspend; its pin stays on the DPLL it = was registered on\n", > i); > + outs_moved |=3D BIT(i); > + } > + if (out->enabled) > + outs_now |=3D BIT(i); > } > + for (i =3D 0; i < sitdev->info->num_outputs; i++) { > + struct sit9531x_out *out =3D &sitdev->out[i]; > + bool beyond, none; > + s64 phase_ps; > + > + /* Bytes of a pending re-time are not a delay the part runs */ > + if (out->retime_pending) > + continue; > + > + rc =3D sit9531x_output_phase_read(sitdev, i, &phase_ps, > + &beyond); > + /* Unrouted or with no valid Fvco, no delay, as at probe */ > + none =3D rc =3D=3D -ENODATA; > + if (none) { > + phase_ps =3D 0; > + beyond =3D false; > + rc =3D 0; > + } > + if (rc) { > + dev_warn(sitdev->dev, > + "out%u: delay not read on resume: %d\n", > + i, rc); > + out->phase_stale =3D true; > + outs_unread |=3D BIT(i); > + continue; > + } > + if (out->phase_adj !=3D phase_ps || out->phase_stale || > + out->phase_none !=3D none) > + outs_moved |=3D BIT(i); > + out->phase_none =3D none; > + out->phase_adj =3D phase_ps; > + out->phase_armed =3D !beyond && phase_ps; > + out->phase_stale =3D false; > + } > + rc =3D sit9531x_intsync_readback(sitdev); > + if (rc) > + dev_warn(sitdev->dev, > + "INTSYNC source not re-detected on resume: %d\n", rc); > + sitdev->intsync_stale =3D rc !=3D 0; > + src_moved =3D rc || owner !=3D sit9531x_intsync_owner(sitdev); > mutex_unlock(&sitdev->multiop_lock); > =20 > + sit9531x_drive_pins_ntf(sitdev, > + (outs_was ^ outs_now) | outs_unread | > + outs_moved, src_moved); [Severity: Medium] When sit9531x_output_phase_read() or sit9531x_intsync_readback() fails on resume, does calling sit9531x_drive_pins_ntf() right away lose the retry notification or send stale state? sit9531x_drive_pins_ntf() only sets out->ntf_pending or sitdev->intsync_ntf_pending when dpll_pin_change_ntf() returns an error. However, when out->phase_stale is true and the read fails again inside dpll_pin_change_ntf(), sit9531x_dpll_output_pin_phase_adjust_get() returns -ENODATA, which dpll_msg_add_pin_phase_adjust() treats as 0; dpll_pin_change_ntf() then succeeds without setting out->ntf_pending, so sit9531x_dpll_output_ntf_pending() never retries or notifies once the bus recovers. Similarly, sit9531x_dpll_intsync_src_state_on_dpll_get() ignores errors from sit9531x_intsync_refresh() and returns 0, so a failed readback on resume immediately notifies the stale pre-suspend owner (or serializes conflicting owners across the four DPLLs if the refresh recovers mid-walk). > 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 [ ... ] > +static int > +sit9531x_dpll_intsync_dst_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 =3D dpll_priv; > + struct sit9531x_dev *sitdev =3D sitdpll->dev; > + > + mutex_lock(&sitdev->multiop_lock); > + sit9531x_intsync_refresh(sitdev); > + if (sitdev->intsync_src =3D=3D sitdpll->id) > + *state =3D DPLL_PIN_STATE_DISCONNECTED; > + else > + sit9531x_dpll_selection_state_get(sitdev, sitdpll, > + SIT9531X_INTSYNC_PIN_ID, > + state); > + mutex_unlock(&sitdev->multiop_lock); > + > + return 0; > +} [Severity: Low] As reported by Jakub Kicinski on v15 [2], does forcing the INTSYNC destination pin to DPLL_PIN_STATE_DISCONNECTED whenever sitdev->intsync_src =3D=3D sitdpll->id (here and in sit9531x_dpll_pin_snapshot()) hide that the PLL still selects INTSYNC? When a PLL has a partial or unenabled INTSYNC pattern on its EXT page (sitdev->intsync_partial is true) and also lists INTSYNC in its priority table or manual selection, both its source pin and its destination pin report DPLL_PIN_STATE_DISCONNECTED, yet connecting the source pin on that PLL fails in sit9531x_dpll_intsync_src_state_on_dpll_set() via sit9531x_dpll_intsync_selected() with -EBUSY ("PLL selects INTSYNC as a reference; it cannot drive it"). [1] https://lore.kernel.org/r/20261117021827.2220456-1-kuba@kernel.org [2] https://lore.kernel.org/r/20261117021827.2220456-1-kuba@kernel.org --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201235202.9764= 5-1-arouhi@sitime.com?part=3D13