From: netdev-bot+sashiko@kernel.org
To: ahmadexp@gmail.com
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
Subject: Re: [PATCH net 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations
Date: Sun, 22 Nov 2026 20:41:07 +0000 [thread overview]
Message-ID: <179538006772.3135.15875996486888374193@kernel.org> (raw)
In-Reply-To: <20261118-timecard-common-301f823ddd-2-ahmadexp@gmail.com>
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
next prev parent reply other threads:[~2026-11-22 20:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 20:05 [PATCH net 0/4] ptp: ocp: fix timestamp teardown and DPLL routing Ahmad Byagowi
2026-11-18 20:05 ` [PATCH net 1/4] ptp: ocp: prevent timestamp rearming during detach Ahmad Byagowi
2026-11-19 18:24 ` Vadim Fedorenko
2026-11-19 21:19 ` Ahmad Byagowi
2026-11-22 20:41 ` netdev-bot+sashiko
2026-11-18 20:05 ` [PATCH net 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations Ahmad Byagowi
2026-11-22 20:41 ` netdev-bot+sashiko [this message]
2026-11-18 20:05 ` [PATCH net 3/4] ptp: ocp: report disabled SMA inputs consistently over DPLL Ahmad Byagowi
2026-11-22 20:41 ` netdev-bot+sashiko
2026-11-18 20:05 ` [PATCH net 4/4] ptp: ocp: correct the DCF output frequency Ahmad Byagowi
2026-11-22 20:41 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179538006772.3135.15875996486888374193@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=ahmadexp@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=arkadiusz.kubalewski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®