Linux Remote Processor Subsystem development
 help / color / mirror / Atom feed
From: Arnaud POULIQUEN <arnaud.pouliquen@foss.st.com>
To: Ben Levinsky <ben.levinsky@amd.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	<linux-remoteproc@vger.kernel.org>
Cc: Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	<imx@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-renesas-soc@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>, <tanmay.shah@amd.com>
Subject: Re: [PATCH 1/4] remoteproc: add common wc-ioremap carveout callbacks
Date: Tue, 12 May 2026 11:44:46 +0200	[thread overview]
Message-ID: <bd083464-a5a2-4994-ad88-ddf42d2c765e@foss.st.com> (raw)
In-Reply-To: <20260511211841.284809-2-ben.levinsky@amd.com>



On 5/11/26 23:18, Ben Levinsky wrote:
> Several remoteproc drivers open-code the same ioremap_wc() and
> iounmap() callbacks for carveout mappings. Add subsystem-private
> helpers in remoteproc_internal.h so those drivers can share the same
> implementation.
> 
> Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
> ---
>   drivers/remoteproc/remoteproc_internal.h | 26 +++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index 0a5e15744b1d..3724a47a9748 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -12,8 +12,9 @@
>   #ifndef REMOTEPROC_INTERNAL_H
>   #define REMOTEPROC_INTERNAL_H
>   
> -#include <linux/irqreturn.h>
>   #include <linux/firmware.h>
> +#include <linux/io.h>
> +#include <linux/irqreturn.h>
>   
>   struct rproc;
>   
> @@ -122,6 +123,29 @@ rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...);
>   void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
>   void rproc_remove_rvdev(struct rproc_vdev *rvdev);
>   
> +static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
> +					     struct rproc_mem_entry *mem)
> +{
> +	void __iomem *va;
> +
> +	va = ioremap_wc(mem->dma, mem->len);
> +	if (!va)
> +		return -ENOMEM;

Could you add error message here to help for debug

+		dev_err(dev, "Unable to map memory region: %pa+%zx\n",
+			&mem->dma, mem->len);
> +
> +	mem->va = (__force void *)va;
> +	mem->is_iomem = true;

HHere, you set mem->is_iomem, but this is not done in platform drivers.

It seems better to add this in a separate commit after patch 2/4, with 
an explanation of why it needs to be set.

Regards,
Arnaud

> +
> +	return 0;
> +}
> +
> +static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
> +					  struct rproc_mem_entry *mem)
> +{
> +	iounmap((__force __iomem void *)mem->va);
> +
> +	return 0;
> +}
> +
>   static inline int rproc_prepare_device(struct rproc *rproc)
>   {
>   	if (rproc->ops->prepare)


  reply	other threads:[~2026-05-12  9:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 21:18 [PATCH 0/4] remoteproc: cleanup shared carveout and resource-table helpers Ben Levinsky
2026-05-11 21:18 ` [PATCH 1/4] remoteproc: add common wc-ioremap carveout callbacks Ben Levinsky
2026-05-12  9:44   ` Arnaud POULIQUEN [this message]
     [not found]     ` <DM4PR12MB64482037D67096393D4668CE83392@DM4PR12MB6448.namprd12.prod.outlook.com>
2026-05-12 17:15       ` Ben Levinsky
2026-05-11 21:18 ` [PATCH 2/4] remoteproc: switch exact-match drivers to wc-ioremap callbacks Ben Levinsky
2026-05-12  7:06   ` Geert Uytterhoeven
2026-05-11 21:18 ` [PATCH 3/4] remoteproc: add helper for optional ELF resource tables Ben Levinsky
2026-05-12  7:55   ` Daniel Baluta
2026-05-12  9:22     ` Arnaud POULIQUEN
2026-05-12 14:53     ` Shah, Tanmay
     [not found]       ` <DM4PR12MB6448B1E51D58F3F8B11171F683392@DM4PR12MB6448.namprd12.prod.outlook.com>
2026-05-12 17:19         ` Ben Levinsky
2026-05-11 21:18 ` [PATCH 4/4] remoteproc: switch drivers to optional resource-table helper Ben Levinsky
2026-05-12  7:07   ` Geert Uytterhoeven

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=bd083464-a5a2-4994-ad88-ddf42d2c765e@foss.st.com \
    --to=arnaud.pouliquen@foss.st.com \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=ben.levinsky@amd.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=magnus.damm@gmail.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=s.hauer@pengutronix.de \
    --cc=tanmay.shah@amd.com \
    /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