[PATCH V3] remoteproc: imx_rproc: iterate all notifiyids in rx callback

Peng Fan (OSS) posted 1 patch 2 years, 7 months ago
drivers/remoteproc/imx_rproc.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
[PATCH V3] remoteproc: imx_rproc: iterate all notifiyids in rx callback
Posted by Peng Fan (OSS) 2 years, 7 months ago
From: Peng Fan <peng.fan@nxp.com>

The current code only supports one vdev and a single callback,
but there are cases need more vdevs. So iterate all notifyids to
support more vdevs with the single callback.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V3:
 Drop debug message in callback

V2:
 Update commit log

 drivers/remoteproc/imx_rproc.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index f9874fc5a80f..986d3db81596 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -725,13 +725,22 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
 	return 0;
 }
 
+static int imx_rproc_notified_idr_cb(int id, void *ptr, void *data)
+{
+	struct rproc *rproc = data;
+
+	rproc_vq_interrupt(rproc, id);
+
+	return 0;
+}
+
 static void imx_rproc_vq_work(struct work_struct *work)
 {
 	struct imx_rproc *priv = container_of(work, struct imx_rproc,
 					      rproc_work);
+	struct rproc *rproc = priv->rproc;
 
-	rproc_vq_interrupt(priv->rproc, 0);
-	rproc_vq_interrupt(priv->rproc, 1);
+	idr_for_each(&rproc->notifyids, imx_rproc_notified_idr_cb, rproc);
 }
 
 static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg)
-- 
2.37.1
Re: [PATCH V3] remoteproc: imx_rproc: iterate all notifiyids in rx callback
Posted by Mathieu Poirier 2 years, 7 months ago
On Thu, 29 Jun 2023 at 03:28, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> The current code only supports one vdev and a single callback,
> but there are cases need more vdevs. So iterate all notifyids to
> support more vdevs with the single callback.
>

Much better - I'll pick this up when rc2 comes out.

Thanks,
Mathieu

> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>
> V3:
>  Drop debug message in callback
>
> V2:
>  Update commit log
>
>  drivers/remoteproc/imx_rproc.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index f9874fc5a80f..986d3db81596 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -725,13 +725,22 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
>         return 0;
>  }
>
> +static int imx_rproc_notified_idr_cb(int id, void *ptr, void *data)
> +{
> +       struct rproc *rproc = data;
> +
> +       rproc_vq_interrupt(rproc, id);
> +
> +       return 0;
> +}
> +
>  static void imx_rproc_vq_work(struct work_struct *work)
>  {
>         struct imx_rproc *priv = container_of(work, struct imx_rproc,
>                                               rproc_work);
> +       struct rproc *rproc = priv->rproc;
>
> -       rproc_vq_interrupt(priv->rproc, 0);
> -       rproc_vq_interrupt(priv->rproc, 1);
> +       idr_for_each(&rproc->notifyids, imx_rproc_notified_idr_cb, rproc);
>  }
>
>  static void imx_rproc_rx_callback(struct mbox_client *cl, void *msg)
> --
> 2.37.1
>
Re: [PATCH V3] remoteproc: imx_rproc: iterate all notifiyids in rx callback
Posted by Bjorn Andersson 2 years, 6 months ago
On Thu, 29 Jun 2023 17:33:27 +0800, Peng Fan (OSS) wrote:
> The current code only supports one vdev and a single callback,
> but there are cases need more vdevs. So iterate all notifyids to
> support more vdevs with the single callback.
> 
> 

Applied, thanks!

[1/1] remoteproc: imx_rproc: iterate all notifiyids in rx callback
      commit: 0b6c3bc88bd920d2e89921cd308a0276f05ad8c7

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>