Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Commit "net: ethernet: ti: am65-cpts: wait after each event FIFO
pop" fixes a CPTS TRM timing violation that has been in the driver…
--
net: ethernet: ti: am65-cpts: wait after each event FIFO pop
This commit adds a register read-back and a 100 ns delay after each
EVENT_POP write in am65_cpts_fifo_pop_event(). The TRM says TS_PEND is
not valid until four CPTS_RFT_CLK periods plus four CPPI_ICLK periods
have passed after a pop, and the delay is there to meet that rule.
> The TRM's procedure for reading the CPTS event FIFO says that after a
> write to EVENT_POP, TS_PEND is not valid until four CPTS_RFT_CLK periods
> plus four CPPI_ICLK periods have passed. am65_cpts_fifo_pop_event() does
> not wait, so the next read of TS_PEND in __am65_cpts_fifo_read() can
> come before it is valid.
[ ... ]
> Signed-off-by: James Clark <j…@jclark.com>
[Severity: Low]
Should this have a Fixes: tag? The EVENT_POP write with no wait after it
in am65_cpts_fifo_pop_event() has not changed since the driver was added:
Fixes: f6bd59526ca5 ("net: ethernet: ti: introduce am654 common platform time sync driver")
Could the commit message also say what goes wrong when TS_PEND is read
too early, and whether anyone has seen it happen?
__am65_cpts_fifo_read() calls am65_cpts_fifo_pop_event() back to back:
drivers/net/ethernet/ti/am65-cpts.c:__am65_cpts_fifo_read() {
...
if (am65_cpts_fifo_pop_event(cpts, event))
break;
...
}
The TS_PEND value read at the start of each call decides whether the
event registers are read and passed to the type switch. Reading it too
early could give:
- a duplicate or garbage event
- a repeated ptp_clock_event() for EXTTS/PPS
- the "cpts: unknown event type" error from the default branch
- a drain that stops early
These effects are inferred from the TRM rule. They have not been
reproduced.
Without a description of the symptoms, it is hard to tell whether this
patch belongs in net with a Fixes: tag for stable, or is only hardening
to match the TRM.
The patch also seems to sit inside a net-next feature series. The last
patch in that series ("net: ethernet: ti: am65-cpts: implement
PTP_SYS_OFFSET_PRECISE") depends on it, because am65_cpts_gtc_push_arm()
calls __am65_cpts_fifo_read() and then reads TS_PEND straight away to
decide whether the FIFO is empty.
If this is a fix, would it be better sent to net on its own?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cove…%40jclark.com