Article View: linux.kernel.netdev
Article #22152Re: [PATCH net v3 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 22:10
Date: Tue, 24 Nov 2026 22:10
145 lines
13048 bytes
13048 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท 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] The fix keys only on the software flag `sma->disabled`, and
nothing rebuilds that flag from hardware at probe.
- [Low] The testing and provenance paragraphs of the changelog are the
same text used in the other patches of the series.
--
ptp: ocp: report disabled SMA inputs consistently over DPLL
This commit changes ptp_ocp_dpll_frequency_get() so that a disabled SMA
input uses SMA_DISABLE before the selector table lookup, which is what
the sysfs show path already does. Before this, a disabled input read
back as 10 MHz, and the DPLL core skipped a later 10 MHz set as
unchanged.
Link: https://lore.kernel.org/r/179502617840.3136.12704245716223038161@kernel.org
> Reported by the netdev Sashiko AI review and confirmed by code
> inspection. Source-derived C regression tests pass with ASan/UBSan;
> restoring the faulty selector, mask, disabled-state or DCF value makes
> the corresponding regression fail. Tests use stubbed MMIO, not hardware.
[ ... ]
> Codex prepared the fix, tests and changelog from the review and upstream
> source, at the request to separate common-driver fixes from WiWi support
> and validate removal ordering.
[Severity: Low]
Do these paragraphs describe this commit? They look like the same
testing and provenance text used in the other patches of the series.
This patch only adds the disabled-state substitution in
ptp_ocp_dpll_frequency_get().
It doesn't change the selector handling or SMA_SELECT_MASK. That work
is in the earlier patch "ptp: ocp: use hardware selectors in DPLL
frequency operations".
It also has nothing to do with removal ordering. That is in "ptp:
disable all timestamp channels after removing the user interfaces".
At this commit the DCF output entry still has the old value:
drivers/ptp/ptp_ocp.c:ptp_ocp_sma_out[] {
...
{ .name = "DCF", .value = 0x0020, .frequency = 77000 },
...
}
The following patch, "ptp: ocp: correct the DCF output frequency",
fixes that value. So a DCF regression test would fail on this tree by
itself.
Could the changelog describe only the testing that applies to this
change?
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 95a4df468e793..653c3b1ca0668 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -5889,6 +5889,8 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
>
> val = bp->sma_op->get(bp, sma_nr + 1);
> val &= SMA_SELECT_MASK;
> + if (sma->mode == SMA_MODE_IN && sma->disabled)
> + val = SMA_DISABLE;
[Severity: Medium]
Can a disabled input still be reported as 10 MHz after the driver is
unbound and rebound?
The new check looks only at the software flag sma->disabled. Disabling
an input in ptp_ocp_sma_store_val() writes 0 to the whole input field,
and that also clears SMA_ENABLE:
drivers/ptp/ptp_ocp.c:ptp_ocp_sma_store_val() {
...
if (!sma->fixed_dir)
val |= SMA_ENABLE; /* add enable bit */
if (sma->disabled)
val = 0;
...
}
On rebind, bp is allocated zeroed, so disabled starts out false.
ptp_ocp_sma_fb_init() uses bit 15 of the gpio registers only to pick
the direction:
drivers/ptp/ptp_ocp.c:ptp_ocp_sma_fb_init() {
...
reg = ioread32(&bp->sma_map1->gpio2);
bp->sma[2].mode = reg & BIT(15) ? SMA_MODE_OUT : SMA_MODE_IN;
bp->sma[3].mode = reg & BIT(31) ? SMA_MODE_OUT : SMA_MODE_IN;
...
}
Take SMA3 or SMA4 on a board where the direction can be changed.
Switch it to input, disable it, then rebind the driver. The pin comes
back as SMA_MODE_IN with disabled == false.
In ptp_ocp_dpll_frequency_get(), the line "val &= SMA_SELECT_MASK"
drops bit 15. In hardware, that bit is the only thing that tells
disabled (0x0000) apart from enabled 10 MHz (0x8000).
The new check doesn't fire, and the lookup matches the "10Mhz" entry.
A DPLL request for 10 MHz then returns early here:
drivers/dpll/dpll_netlink.c:dpll_pin_freq_set() {
...
if (freq == old_freq)
return 0;
...
}
The input stays disabled, which is the failure the changelog says this
patch fixes.
This assumes the FPGA mux registers keep their value across
unbind/rebind. Probe doesn't seem to reset them, but this hasn't been
confirmed on hardware.
Would it work to check the raw SMA_ENABLE bit for !sma->fixed_dir pins
before masking? Another option is to set sma->disabled from that bit in
ptp_ocp_sma_fb_init().
> tbl = bp->sma_op->tbl[sma->mode];
> for (i = 0; tbl[i].name; i++)
> if (val == tbl[i].value) {
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-timecard-common-v3-33316bf475-0-ahmadexp%40gmail.com
Technical Details
Message-ID:
<179555822748.3135.10487682659847621386@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370831-linux-kernel-netdev=dewy.ruReferences:
<20261120-timecard-common-v3-33316bf475-3-ahmadexp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370831-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL Date: Tue, 24 Nov 2026 22:10:27 +0000 Organization: Usenet Network Message-ID: <179555822748.3135.10487682659847621386@kernel.org> References: <20261120-timecard-common-v3-33316bf475-3-ahmadexp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="51516"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KIBvHrzCr3ubTrtzQAhBOGuk/ng= sha256:gTece9hPzhFzgAv5fr7ZIr0we2VGs1711mEJM+ThB7U= sha1:Vvf1VEGAz+j/UpewgP/YnIyQz20= sha256:NxnzpvtmlwrCZy29PTd9moTizKTBz0Ao73/3zh+4Ry8= 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 78612125E36; Wed, 25 Nov 2026 01:12:27 +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 dCYp458HzTdA; Wed, 25 Nov 2026 01:12:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370831-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 75144125E2F; Wed, 25 Nov 2026 01:12:15 +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 24D894161A; Tue, 24 Nov 2026 22:10:52 +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=1795558229; b=lyCvphInuhWSESehD4zYa53KdInGi9BL6wwhNPZCItNUE7TFEHUaLfas22XcsEEjTGqY yYcVVmR6bbagj/lNrIKLhk2S1XipY4BIGUDvGe6DA6QUC4pzYE5Rw29SZnSiaXDk9x/r/ Kvl24ZrlzWsanxM75gSBamcPzGrYnddxVw80AK2bbxVh5KT1+tWkmmFWLeA+afNaIBOOg 2XcvCmBcIlq5Q9tjXULn3tNCIMAqoP9uIXAR+7mg+RUFXdJuuQIU6YKi8SN5jXhcYVNFG /uc8dKNGRGZH2HiLMOyZNz0XIanMJPl1jQH/nELvwy2OFLgsMhhm+kLPZdC8eEZJtkw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795558229; 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=xleNooB4+khmhvkX52menMQ5KHxben7USrPvrFmefK8=; b=nygsg3SAQgggN4401wRCPZR8SgI4nGhsBlLtPswcaWkqI86cU1fUTklePxhvbv0flc6U TPnh3tlgtiMM3BhixB5JcmQL3Ys4xB3nOikHD9gVNg/1Be6RJ1m03MkqLJr4EJM9C8MEh A3MYEH+7MwGv4GIPIjNr8ErhQXi74SOPyl1wcWnDZiV9CAi1GY3+tpbC5TXySnZ8rtZsp +U84o10bZD63cV6vl0HLZXag1lU9IkELwMcw3WaKk4SwIHcNf7m+lq+5Xbqr2bW2+kxM+ z0ml8TXw408MdTyDLyBKN5SHbgRsP7+mcg87E2txetEyMbkzghU/bx0CgcK8XghYWhA== 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=JXpizG0z; 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 9C669606A6AB; Tue, 24 Nov 2026 22:10:29 +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=JXpizG0z 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=1795558228; b=XIMKEe+1PsJiqhyKwp8mGt9vZ4h4k5nDsMfD+cM8YnocurBmYmjW/9D6K5bnzxItiWxn GXH8y0ZU9nqdtkeOxcGxnoWVdmCDPRo9CIs5oqtdWmPx3UGMtvRIxqzsWC3UX9Lc7fHgN auXi4TewfXdMvYnX/gumdTIe37gnvYPji8y8B4fsPEnwZ3cmFlTuZSbzi54ZL9IQf/HxQ l8VJdm2fcFsaKt2fJVcfwHh9nB8irO7BVpZUUMkdi2rk09Rlq+h+hyLWZWnJogJdON7Nc zTwcAxyJUo2LE09yrFVC856VJOw2xE7y/KgZcrvHa43Ji5AA2PiSDrJMj+XRKCE8arA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795558228; 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=xleNooB4+khmhvkX52menMQ5KHxben7USrPvrFmefK8=; b=djL7ObzfAy+7hlsAPEefh++c4DbpQFQ8Xu8s/QfFhj8QY1e4fazUlmtwPMI+4KyYt9xl +CaCj69GamRRstY9gSAQSxXRe91Cbig+LFIxQJGYFHCl06OXSPIYwwqbpezPbtWulAVTT 73LwLpyGFMSLZNFK27LePkp/s/bu2A/b4S3UK/M9fxYoM2wrx/iE0EiGWFGiRzfVDkuIE LOWl4MMrSgAtaKrGLAONMstQdWQInqNEbCGE4u3ixuCNp8vqa+ZovaEYxrhHn3CaiMRqp o9GkTyLfogSV/mMSTZlDpKV027PMConviOyhuB+oFPxk5BW30n6TwnL6PVjVvpErj4w== 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=JXpizG0z; 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 C0FEF60A6F5E for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 22:10:28 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E26B31F02834; Tue, 24 Nov 2026 22:10:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795558228; bh=xleNooB4+khmhvkX52menMQ5KHxben7USrPvrFmefK8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JXpizG0zQS+B23laoF8O+h5czPjMVk9xMdjcmvJab/QckI3uA1pUqVcp3TCCc5q7g Xvdb3myqCp8MC0jUtkOPztmcNL5YKkuJ58v3Id2SJ/qnwftZj/pMEpX0wnnH9vjHl8 fbdT0uPfx63bk04+SFGoMSLQXZyj/lvj9VuDhCUNrw6+hsRmDXheU6F6YhT5YjedTi EIYQZ6FmsfNuQcs+ygslW3rDSDeKhlPU5HVSvJCNniipkTt9sEk44QqxnvhDKG+H4m S1evIZga273qAOpGQvfnt3wYW33O+Jbc0dFgUJa7iuQNHjKi1RHGb6wWtxBkPziUPj HnNbeFn1Urwfw== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, arkadiusz.kubalewski@intel.com, davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, rmk+kernel@armlinux.org.uk, vadim.fedorenko@linux.dev, vladimir.oltean@nxp.com X-In-Reply-To: <20261120-timecard-common-v3-33316bf475-3-ahmadexp@gmail.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