Article View: linux.kernel.netdev
Article #20517Re: [PATCH net 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 20:41
Date: Sun, 22 Nov 2026 20:41
141 lines
13179 bytes
13179 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 0
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).
- [High] ptp_ocp_dpll_frequency_get() (drivers/ptp/ptp_ocp.c) still fails
with -EINVAL for an enabled, direction-configurable SMA input that has…
- [Medium] The patch says index passing makes DPLL frequency_set "fail on
ART" and fixes that by choosing the table entry by frequency and…
--
ptp: ocp: use hardware selectors in DPLL frequency operations
This commit changes ptp_ocp_dpll_frequency_set() to pass the selector
table value instead of the table index to ptp_ocp_sma_store_val(). It
also masks the direction enable bit in ptp_ocp_dpll_frequency_get()
before the table lookup, so enabled pins whose direction can be changed
find a matching entry.
Link: https://lore.kernel.org/r/179502617840.3136.12704245716223038161@kernel.org
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 478f7012b23e2..d449ed8ca2d8a 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -5900,7 +5900,8 @@ static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin,
> tbl = bp->sma_op->tbl[sma->mode];
> for (i = 0; tbl[i].name; i++)
> if (tbl[i].frequency == frequency)
> - return ptp_ocp_sma_store_val(bp, i, sma->mode, sma_nr + 1);
> + return ptp_ocp_sma_store_val(bp, tbl[i].value,
> + sma->mode, sma_nr + 1);
[Severity: Medium]
The commit message says passing the index can "fail on ART". Can a
10 MHz request on an ART input reach this line?
The ART input table lists the 10Mhz entry at 1 MHz:
static const struct ocp_selector ptp_ocp_art_sma_in[] = {
...
{ .name = "10Mhz", .value = 0x0008, .frequency = 1000000 },
ART pins advertise ptp_ocp_sma_freq (1PPS, 10MHz, IRIG-B, DCF77). So
dpll_pin_freq_set() accepts 10000000 and rejects 1000000.
A PIN_SET of 10000000 on an ART input passes the core check. It then
matches no entry in this loop and returns -EINVAL, so the corrected
tbl[i].value is never passed on. With this patch, it looks like PPS1 is
the only input function that can be programmed on ART through DPLL.
The same entry also affects ptp_ocp_dpll_frequency_get(). By default
ART SMA1 selects 0x08:
ptp_ocp_art_sma_init() {
...
bp->sma[0].default_fcn = 0x08; /* IN: 10Mhz */
For that pin, the getter reports 1000000 Hz, which is not in the
advertised frequency list.
The table entry predates this patch, but the ART fix depends on
tbl[i].frequency being correct. The later patch "ptp: ocp: correct the
DCF output frequency" fixes a similar table mismatch for DCF but leaves
this entry unchanged.
Should ptp_ocp_art_sma_in[] list the 10Mhz input as 10000000 as part of
this fix?
> return -EINVAL;
> }
>
> @@ -5918,6 +5919,7 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
> int i;
>
> val = bp->sma_op->get(bp, sma_nr + 1);
> + val &= SMA_SELECT_MASK;
> tbl = bp->sma_op->tbl[sma->mode];
> for (i = 0; tbl[i].name; i++)
> if (val == tbl[i].value) {
[Severity: High]
Does this still return -EINVAL for an enabled input that has more than
one destination?
The commit message says that without the mask "an enabled,
direction-configurable pin has no matching table entry and its DPLL get
or dump fails". The sysfs ABI allows several input destinations, and
sma_parse_inputs() ORs them into one selector:
sma_parse_inputs() {
...
ret |= ptp_ocp_select_val_from_name(tbl[dir], argv[idx]);
For example, writing "IN: TS1 TS2" to smaN gives 0x000C. After
ptp_ocp_sma_store_val() adds SMA_ENABLE, 0x800C is written to the GPIO
map.
On readback, sma_op->get() returns 0x800C, and the new mask turns it
into 0x000C. Each entry in ptp_ocp_sma_in[], ptp_ocp_adva_sma_in[] and
ptp_ocp_adva_x1_sma_in[] has a single bit set. Nothing matches
val == tbl[i].value, so the function returns -EINVAL.
The sysfs reader for the same register treats it as a bitmask:
ptp_ocp_show_inputs() {
...
if (val & tbl[i].value) {
The -EINVAL reaches the DPLL netlink code:
dpll_nl_pin_get_dumpit()
dpll_cmd_pin_get_one()
dpll_msg_add_pin_freq()
ptp_ocp_dpll_frequency_get() -> -EINVAL
dpll_nl_pin_get_dumpit() only skips -ENODEV and -EMSGSIZE, so this
error stops the global pin dump. Pins after this one, including pins
from other DPLL drivers, are not reported.
dpll_pin_freq_set() also calls frequency_get first and returns early
with "unable to get old frequency value". As a result, the pin cannot be
recovered through DPLL frequency_set.
The later patch "ptp: ocp: report disabled SMA inputs consistently over
DPLL" only adds the disabled-input override, so this remains at the end
of the series.
Should this lookup match selector bits the way ptp_ocp_show_inputs()
does, instead of requiring an exact match?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-timecard-common-301f823ddd-0-ahmadexp%40gmail.com
Technical Details
Message-ID:
<179538006772.3135.15875996486888374193@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368814-linux-kernel-netdev=dewy.ruReferences:
<20261118-timecard-common-301f823ddd-2-ahmadexp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368814-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations Date: Sun, 22 Nov 2026 20:41:07 +0000 Organization: Usenet Network Message-ID: <179538006772.3135.15875996486888374193@kernel.org> References: <20261118-timecard-common-301f823ddd-2-ahmadexp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3719826"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:RNj+kJetKzO43FlskVpMZhBDwjY= sha256:fA4Q3W42q7TRw2zyA8MgWg+IbWB+TqqTr5d05uO72nE= sha1:oazF7qv7bqnRX9XrkyT4szN0BMI= sha256:TuFwxCFtw7Tc0ihImV5M1uMvACYOoSsCClzjeRmSmgE= 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 61238125D84; Sun, 22 Nov 2026 23:41:35 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 mQw90mKKqJrS; Sun, 22 Nov 2026 23:41:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368814-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 86C7B125D83; Sun, 22 Nov 2026 23:41:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id B03242AFE4; Sun, 22 Nov 2026 20:41:16 +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=1795380075; b=5BxAsSYLH6rKDGTvRAy53iGYW2+hNhFTs54FeX4GlmoBoRR0u6BgfQTKPZacKAMEnpNQ 43/APQnPYMzGxj12nvqJuUKwbe6cL8hY0CSetZb39Es/FSoyez+f3Nr/JXSXnOhdHdstl k5cqbAq7vQTexmQAaTYodXha36sJ+4nGROuTqsFjhzv8Y/3bLYwiIYMQUwVX4bzesqYmV yAsXvNgKA1nOAGscQwkFKIfqSDirunXifUV3Wd08o5G/aUGKa2Ns+FZ4Ql6uIQkw4ivI5 XtdTc6D971y74Hagl03bgZUvdl34IpC7qpc6awz0zKF8BfnpWnOm91Jh5sNKEgGCpAQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795380075; 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=jY1YA6TtVOdv5RNG1Xq9oOiUJTyNDkuqwgtxjcAS01Q=; b=0LmTr+NzQMBIfX6g1q8zdw6jcqfpsReP0qDqb6433FmvFqfcrghMFdFhjIgEfAL2nhxZ 6kQwZaQsVjKDcpgQ0RV+D6jIzzR1hpWiHZrxNUTp+hC7VtFBJRngPeUkLKcxY/WaZj7d6 7ibqcm9J5e7mYCirR6DOLQUj2NvsgnNpUHFhs9p7z8TZDe39hn6bSXCPY7vPRVdcLbVUs Dk25B2sr5rKnfhP4NpFElMQ4VkQh3XT7YBR4vH8ofAoNMPfpuKxpS7zdDLbkIO4uLHMXf WeI2i7oVy10KuoXtw39JNa7uh7CNCSjOPNkKU68GyZSrUy7qQQhocx7ffPjr/GSygLw== 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=Nz+Ub0iR; 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 187DC606A320; Sun, 22 Nov 2026 20:41: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=Nz+Ub0iR 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=1795380069; b=yQv+c2wt4/Z8PD/WTAv44EBJR7Ud60g6me28IxZrsdYnXZZYW3Wxsm5GYItktjVH84uD T3D0738Fzr/9vbsx0zvyDdwi7YsTi9ZLOgXchU+4UN6ah76J8ptS1RPuIHoRa8wPc7ari affMEBqirieCmpi9HT3TuZbIguR2QmRTgS701zDB6qPJmR+cTycSDrusZ1H/8T7kXW93z GP5ghBeLXRqP/vrIx3qR7nLxmh5pZkT/pfKloS02/z3/KyYAKUYzYkuSA33QKy/uztLoW MVDot6aFUpwVGqh7kLTuTcq4o9JqsG7y1xG7EqNdyTjOxlGDhxfs++73wPqDKNgmIKw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795380069; 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=jY1YA6TtVOdv5RNG1Xq9oOiUJTyNDkuqwgtxjcAS01Q=; b=deXi4qSzWo3MMPyRaEEG3JechcRzEqaryca5ylehK+6vTphI3fO1cHWnVZPKpO47SBaW 1VTrXLIAO9OUSLNEUjqivuvJu9Tl5DlPL0kr6hRlXzQOk5kc+4dvx2Q3mtvQZNG7lJk7C B6MRQRkOLRgsVvoMQzXIZ+iHM7T1jjGYmEBTPVT5v8FnUJxo7YAbgBO6ytmhIVdk2fCp0 cRAmSz511Xqn+slQj/crk/nuRqZJQXw2vg3go+wLwxC3lPJIGgX914+G9d9aA3n3vGtn7 7Q4zH1PaALAJT1MWAUzKeM4JtcUCB9E3U9ZkXzhM2EVrZFmloZryozLIq9zcCxmgI8g== 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=Nz+Ub0iR; 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 386D3606A338; Sun, 22 Nov 2026 20:41:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2545E1F000CF; Sun, 22 Nov 2026 20:41:08 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795380068; bh=jY1YA6TtVOdv5RNG1Xq9oOiUJTyNDkuqwgtxjcAS01Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Nz+Ub0iRILd7o2nsmH6f5OVO0Zk+GpSx7+DjXGzhcLbHSkUh25D83ZqCRtoEht+B7 Mds0EhJnh876LezUiI0a1XTxOWTUrpDDx04C3yfNd+vnc5e2pWlS+i1WW4FHggNpbN upZPbys7m2sk/RJ6BIxcN1+/88YUPx/He5gP3FRdld6IJIb2LdM7aU7Tt62ce37lm4 MT41VTDzp/XH8DN8ScmrGH1EjnebBQPsgPgkEgE6vMemyTNVocWeV39+flAPYrojhG OiFfhHNnSWZtd6GbTbN2cLCs5H3owrlRgaS3d1HEnFbu4AkELaXRghBwK9umDSJiD6 rkFDGvOs74idQ== X-Cc: netdev@vger.kernel.org, vadim.fedorenko@linux.dev, richardcochran@gmail.com, andrew+netdev@lunn.ch, arkadiusz.kubalewski@intel.com, davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us, kuba@kernel.org, linux-kernel@vger.kernel.org, pabeni@redhat.com X-In-Reply-To: <20261118-timecard-common-301f823ddd-2-ahmadexp@gmail.com> X-sashiko-severity: High 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