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=1796258348; b=4gYHeWoVXke/0m0Hp98AuQyBSyeLYpGrx3M2G7KATO5VGPavTavhLxyeF5CEb+PauOXz TTP0vchfczZ2cJ4VJNhPpXcKfBpS3c0asVxdlo3+BCrv4ErjVWvP6qnGfpiEwHH5OZtMs 0uMYwFvPmWl4VNa/sguB1g5TWKKL/oq6yR+C66QSEtTOEaYWGytyYd28Bviadb5fg5siK aWVtp3I0b5CDM07AALJ7W313zDG/QDtMm9EqhBz/6NkVih50Prjln6a6vD8w3HKD822zJ E35QKqiNY7sb7+NtsK9JIUslyCsYcS0NNLHruUXfM5Vqa4mYrM607Y6snnf6Ow9zSnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796258348; 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=GSDy/Vq9s0mMbCckoIKRXGLRq3TL6UF8CiddZjeL15g=; b=ph2oetT9vtjczmAEquQa5BAeBMVxt3N5mvLT6uVaYLmylS5vsSRqerX5wzvZdK6Ntg/J p+fakdMs6sLcpNov54IiaRR/Xhsv/qCyH7r+fEdpRHzc4UE7DpepyAD0WIlzgoM0gcT8Y IOjNYCiMM1LLIWE6sEp9yhMrJAQLBjOiQ9KaFqrGbD1qWlRGHnXvYe2DWQ6RdA3k6QwTy ScDcjNTtOvT++aZxlK0zjoYsas09n+4BJSqBDcLjm19aVgQ84wj1eCaMJZnfBZnb159JP mzTOJ7799pSWH7YE1Zew2PlqtAgnMPL4axtssruJ4VxjWNX8hP9W39R2vZO3JBMSo/w== 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=BObTlasR; 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 A0272606A33C; Thu, 3 Dec 2026 00:39:08 +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=BObTlasR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CCDB1F0089B; Thu, 3 Dec 2026 00:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796258348; bh=GSDy/Vq9s0mMbCckoIKRXGLRq3TL6UF8CiddZjeL15g=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BObTlasRl4PovlRoVmsZxaTQP+TaP4YMWEp3rsf2n2d9TS0ddSNAN8CplfcTWgcQD nnV9vVbVu81eRtf5RaHKf0HYWjiSEheKenzv1Vhzh08vOU5I/nMwVqNTHZwebPL7BK 6605O1TK5tgNsqSAsb2JLvv4BDoPuElDxokOVESNnYCpRR6crSTlTyvCEPMmc09AXI tfLN6ghEiS3a+cNL0Nc8/eL2M/9geLXP6KIAjOTU0XL33OP4oZEZUftfzxxjVwDnsg 04KYLz9+qQZ480gomBT5QrvYs5PbmG4PbnKCtEC143+bZ4eMvIRRkHdMxUsJVf5tPe evozFBirEZ6dg== Subject: Re: [PATCH net-next v17 06/13] dpll: sit9531x: register DPLL devices and 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:06 +0000 Message-ID: <179625834679.3146.9981782206942012458@kernel.org> In-Reply-To: <20261201235202.97645-7-arouhi@sitime.com> References: <20261201235202.97645-7-arouhi@sitime.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@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 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