From: Frank Li <Frank.li@nxp.com>
To: Peng Fan <peng.fan@nxp.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] remoteproc: imx_rproc: Add runtime ops copy to support dynamic behavior
Date: Tue, 28 Oct 2025 11:58:07 -0400 [thread overview]
Message-ID: <aQDoD6xh454nzILm@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20251028-imx95-rproc-2025-10-28-v1-2-ce9e7db9edcb@nxp.com>
On Tue, Oct 28, 2025 at 04:18:02PM +0800, Peng Fan wrote:
> Structure imx_rproc_dcfg contains a const pointer to imx_rproc_plat_ops,
> which defines the start/stop/detect_mode operations for a remote processor.
> To preserve the const correctness of the static configuration while
> allowing runtime modification of ops behavior, this patch introduces a new
Needn't "this patch", just "introduce a new ..."
> imx_rproc_plat_ops member in struct imx_rproc named `ops`.
>
> During initialization, the contents of dcfg->ops are copied into priv->ops.
> This enables the driver to safely override or customize specific ops at
Nit: Enable the driver ..
> runtime without affecting the original const configuration.
>
> This change improves flexibility for platforms that require dynamic
Nit: Improve ...
Generally, needn't words like "This change[patch]" in commit message.
simple use impesative mode, like
Do foo for ...
Make foo to ...
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> operation switching (e.g. i.MX95 Logical Machine ops and CPU ops).
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/remoteproc/imx_rproc.c | 27 +++++++++++++--------------
> 1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 02e155e967942d745de4ccd96f9008e4211f9b36..4ffd2415295be5e60c8eb8ea5126b3562bf703fe 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -116,6 +116,7 @@ struct imx_rproc {
> u32 entry; /* cpu start address */
> u32 core_index;
> struct dev_pm_domain_list *pd_list;
> + struct imx_rproc_plat_ops ops;
> };
>
> static const struct imx_rproc_att imx_rproc_att_imx93[] = {
> @@ -315,7 +316,6 @@ static int imx_rproc_scu_api_start(struct rproc *rproc)
> static int imx_rproc_start(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> - const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct device *dev = priv->dev;
> int ret;
>
> @@ -323,10 +323,10 @@ static int imx_rproc_start(struct rproc *rproc)
> if (ret)
> return ret;
>
> - if (!dcfg->ops || !dcfg->ops->start)
> + if (!priv->ops.start)
> return -EOPNOTSUPP;
>
> - ret = dcfg->ops->start(rproc);
> + ret = priv->ops.start(rproc);
> if (ret)
> dev_err(dev, "Failed to enable remote core!\n");
>
> @@ -372,14 +372,13 @@ static int imx_rproc_scu_api_stop(struct rproc *rproc)
> static int imx_rproc_stop(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> - const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct device *dev = priv->dev;
> int ret;
>
> - if (!dcfg->ops || !dcfg->ops->stop)
> + if (!priv->ops.stop)
> return -EOPNOTSUPP;
>
> - ret = dcfg->ops->stop(rproc);
> + ret = priv->ops.stop(rproc);
> if (ret)
> dev_err(dev, "Failed to stop remote core\n");
> else
> @@ -590,12 +589,11 @@ static int imx_rproc_scu_api_detach(struct rproc *rproc)
> static int imx_rproc_detach(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> - const struct imx_rproc_dcfg *dcfg = priv->dcfg;
>
> - if (!dcfg->ops || !dcfg->ops->detach)
> + if (!priv->ops.detach)
> return -EOPNOTSUPP;
>
> - return dcfg->ops->detach(rproc);
> + return priv->ops.detach(rproc);
> }
>
> static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)
> @@ -995,18 +993,16 @@ static int imx_rproc_scu_api_detect_mode(struct rproc *rproc)
>
> static int imx_rproc_detect_mode(struct imx_rproc *priv)
> {
> - const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> -
> /*
> * To i.MX{7,8} ULP, Linux is under control of RTOS, no need
> - * dcfg->ops or dcfg->ops->detect_mode, it is state RPROC_DETACHED.
> + * priv->ops.detect_mode, it is state RPROC_DETACHED.
> */
> - if (!dcfg->ops || !dcfg->ops->detect_mode) {
> + if (!priv->ops.detect_mode) {
> priv->rproc->state = RPROC_DETACHED;
> return 0;
> }
>
> - return dcfg->ops->detect_mode(priv->rproc);
> + return priv->ops.detect_mode(priv->rproc);
> }
>
> static int imx_rproc_sys_off_handler(struct sys_off_data *data)
> @@ -1056,6 +1052,9 @@ static int imx_rproc_probe(struct platform_device *pdev)
> priv->dcfg = dcfg;
> priv->dev = dev;
>
> + if (dcfg->ops)
> + memcpy(&priv->ops, dcfg->ops, sizeof(struct imx_rproc_plat_ops));
> +
> dev_set_drvdata(dev, rproc);
> priv->workqueue = create_workqueue(dev_name(dev));
> if (!priv->workqueue) {
>
> --
> 2.37.1
>
next prev parent reply other threads:[~2025-10-28 15:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 8:18 [PATCH 0/4] remoteproc: imx_rproc: Support i.MX95 Peng Fan
2025-10-28 8:18 ` [PATCH 1/4] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan
2025-10-28 8:18 ` [PATCH 2/4] remoteproc: imx_rproc: Add runtime ops copy to support dynamic behavior Peng Fan
2025-10-28 15:58 ` Frank Li [this message]
2025-10-29 9:34 ` Daniel Baluta
2025-10-30 11:12 ` Peng Fan
2025-10-28 8:18 ` [PATCH 3/4] remoteproc: imx_rproc: Add support for System Manager API Peng Fan
2025-10-28 16:16 ` Frank Li
2025-10-29 3:52 ` Peng Fan
2025-10-28 8:18 ` [PATCH 4/4] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan
2025-10-28 16:22 ` Frank Li
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=aQDoD6xh454nzILm@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=peng.fan@nxp.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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