Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: ivecera@redhat.com
Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
	rdunlap@infradead.org, min.li@microchip.com,
	vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start
Date: Fri, 04 Dec 2026 18:55:00 +0000	[thread overview]
Message-ID: <179641050045.3146.1515029809826961628@kernel.org> (raw)
In-Reply-To: <20261203180627.215256-3-ivecera@redhat.com>

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] Regression: a devlink DRIVER_REINIT reload now throws away the
  cached NCO frequency offset (chan->df_offset) of any DPLL channel the…
- [Low] The commit message admits an existing defect ('The device CPU
  reset at the end of a flash update already allows the same.') and this…

--

dpll: zl3073x: always fetch device state on start

This commit removes the 'full' parameter from zl3073x_dev_start(). The
function now always fetches the device state and sets up the phase offset
measurement block. The devlink DRIVER_REINIT reload, which used to skip
both steps, now goes through them as well.

> The devlink FW_ACTIVATE reload, added later in this series, resets the
> device, which reloads the whole configuration from flash. If the
> restart after the reset fails, a following DRIVER_REINIT reload would
> register the DPLLs with cached state that predates the reset, and would
> not set up the phase offset measurement block again. The device CPU
> reset at the end of a flash update already allows the same.

[Severity: Low]
This describes an existing problem in the flash update path, and this patch
fixes it. Should the patch carry a Fixes: tag for that?

Before this patch, zl3073x_devlink_flash_finish() reset the device CPU
through zl3073x_flash_mode_leave() and then called
zl3073x_dev_start(zldev, true). If that start failed partway through
zl3073x_dev_state_fetch(), or returned early because the ready bit was not
yet set, a later DRIVER_REINIT reload called zl3073x_dev_start(zldev,
false). That path skipped both the state fetch and
zl3073x_dev_phase_meas_setup().

The patch is presented only as preparation for FW_ACTIVATE. Without a
Fixes: tag, it probably won't be picked up for stable trees.

> diff --git a/drivers/dpll/zl3073x/core.c b/drivers/dpll/zl3073x/core.c
> index 27a55d810d5b0..5495d2c67848a 100644
> --- a/drivers/dpll/zl3073x/core.c
> +++ b/drivers/dpll/zl3073x/core.c

[ ... ]

> @@ -895,19 +893,16 @@ int zl3073x_dev_start(struct zl3073x_dev *zldev, bool full)
>  		return 0;
>  	}
>  
> -	if (full) {
> -		/* Fetch device state */
> -		rc = zl3073x_dev_state_fetch(zldev);
> -		if (rc)
> -			return rc;
> +	/* Fetch device state */
> +	rc = zl3073x_dev_state_fetch(zldev);
> +	if (rc)
> +		return rc;

[Severity: Medium]
Does this lose the cached NCO frequency offset on a DRIVER_REINIT reload?

Before this patch, zl3073x_devlink_reload_up() called
zl3073x_dev_start(zldev, false), so zldev->chan[].df_offset was kept
across the reload. Now the path is:

zl3073x_devlink_reload_up()
  zl3073x_dev_start()
    zl3073x_dev_state_fetch()
      zl3073x_chan_state_fetch()

and zl3073x_chan_state_fetch() does this unconditionally:

drivers/dpll/zl3073x/chan.c:zl3073x_chan_state_fetch() {
    ...
	/* If firmware left the channel in NCO mode, mark df_offset as
	 * unknown - we cannot know whether the preconditions for a valid
	 * nco_auto_read capture were met.
	 */
	if (zl3073x_chan_mode_is_nco(chan))
		chan->df_offset = ZL_DPLL_DF_OFFSET_UNKNOWN;
    ...
}

On DRIVER_REINIT nothing resets the hardware. reload_down only runs
zl3073x_dev_stop(). If the driver itself put the channel into NCO mode,
the channel stays in NCO mode with a known offset. That offset came from
zl3073x_chan_nco_mode_set() or from adjfine.
zl3073x_chan_state_update() keeps df_offset in NCO mode on purpose.

After the reload, the cached value is ZL_DPLL_DF_OFFSET_UNKNOWN, and
zl3073x_dpll_nco_pin_ffo_get() returns -ENODATA:

	df_offset = zl3073x_chan_df_offset_get(chan);
	if (df_offset == ZL_DPLL_DF_OFFSET_UNKNOWN)
		return -ENODATA;

This lasts until user space calls adjfine again or leaves and re-enters
NCO mode. Re-entering means going through FREERUN, and
zl3073x_chan_nco_mode_set() from FREERUN also marks the offset unknown.

The commit message says "A DRIVER_REINIT reload is rare, so fetching the
state again there costs little", but it doesn't mention this lost state.
Should df_offset be preserved across a DRIVER_REINIT reload, or should the
NCO check in zl3073x_chan_state_fetch() apply only when the firmware set
NCO mode?

The code is the same at the end of the series: "dpll: zl3073x: add device
reset via devlink reload" calls zl3073x_dev_start() unconditionally from
reload_up for both actions and doesn't change chan.c.

>  
> -		/* Setup phase offset measurement block */
> -		rc = zl3073x_dev_phase_meas_setup(zldev);
> -		if (rc) {
> -			dev_err(zldev->dev,
> -				"Failed to setup phase measurement\n");
> -			return rc;
> -		}
> +	/* Setup phase offset measurement block */
> +	rc = zl3073x_dev_phase_meas_setup(zldev);
> +	if (rc) {
> +		dev_err(zldev->dev, "Failed to setup phase measurement\n");
> +		return rc;
>  	}

[ ... ]

> diff --git a/drivers/dpll/zl3073x/devlink.c b/drivers/dpll/zl3073x/devlink.c
> index 218b08fd8a306..10143ec81a116 100644
> --- a/drivers/dpll/zl3073x/devlink.c
> +++ b/drivers/dpll/zl3073x/devlink.c
> @@ -125,7 +125,7 @@ zl3073x_devlink_reload_up(struct devlink *devlink,
>  	}
>  
>  	/* Restart normal operation */
> -	rc = zl3073x_dev_start(zldev, false);
> +	rc = zl3073x_dev_start(zldev);
>  	if (rc)
>  		dev_warn(zldev->dev, "Failed to re-start normal operation\n");

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203180627.215256-1-ivecera%40redhat.com

  reply	other threads:[~2026-12-04 18:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 18:06 [PATCH net-next 0/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 1/3] dpll: zl3073x: factor device CPU reset into a helper Ivan Vecera
2026-12-03 18:06 ` [PATCH net-next 2/3] dpll: zl3073x: always fetch device state on start Ivan Vecera
2026-12-04 18:55   ` netdev-bot+sashiko [this message]
2026-12-03 18:06 ` [PATCH net-next 3/3] dpll: zl3073x: add device reset via devlink reload Ivan Vecera
2026-12-04 18:55   ` 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=179641050045.3146.1515029809826961628@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=min.li@microchip.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --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