Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Daniel Baluta <daniel.baluta@gmail.com>,
	"Rob Herring (Arm)" <robh@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	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>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Peng Fan <peng.fan@nxp.com>, <linux-remoteproc@vger.kernel.org>,
	<imx@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-renesas-soc@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	Iuliana Prodan <iuliana.prodan@nxp.com>,
	Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>,
	Aisheng Dong <aisheng.dong@nxp.com>
Subject: Re: [PATCH v5] remoteproc: Use of_reserved_mem_region_* functions for "memory-region"
Date: Wed, 20 Aug 2025 11:35:56 +0200	[thread overview]
Message-ID: <72c32584-26a8-41bc-9eb6-1b5c0b25a6b2@foss.st.com> (raw)
In-Reply-To: <CAEnQRZDga2cX=YPY5Z9NDyro94bxFjK9k5Xm5Vt2vVzf4ysKyA@mail.gmail.com>



On 8/20/25 10:21, Daniel Baluta wrote:
> Hi Rob,
> 
> This patch will break IMX RPROC support.
> <snip>
> 
>> --- a/drivers/remoteproc/imx_rproc.c
>> +++ b/drivers/remoteproc/imx_rproc.c
> 
> <snip>
>>  static int imx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
> <snip>
> 
>> -               priv->mem[b].cpu_addr = devm_ioremap_wc(&pdev->dev, res.start, resource_size(&res));
>> +               priv->mem[b].cpu_addr = devm_ioremap_resource_wc(&pdev->dev, &res);
> 
> devm_ioremap_resource_wc works only for IORESOURCE_MEM resources:
> 
> lib/devres.c:124
> static void __iomem *
> __devm_ioremap_resource(struct device *dev, const struct resource *res,
> 
> »       if (!res || resource_type(res) != IORESOURCE_MEM) {
> »       »       ret = dev_err_probe(dev, -EINVAL, "invalid resource
> %pR\n", res);
> »       »       return IOMEM_ERR_PTR(ret);
> »       }
> 
> while the devm_ioremap_wc doesn't care about this.
> 
Hi All,

> So we cannot use devm_ioremap_resource_wc here unless you add
> IORESOURCE_MEM flags
> to  of_reserved_mem_region_to_resource as discussed here:

Agree with Daniel, IORESOURCE_MEM flags should be set in of_reserved_mem_region_to_resource().

I got a similar issue since commit defe01abfb7f ("spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region")
resource flags is unset, which causing the following error:

[   11.455387] stm32-ospi 40430000.spi: error -EINVAL: invalid resource [??? 0x60000000-0x6fffffff flags 0x0]

Thanks
Patrice
> 
> https://lkml.org/lkml/2025/4/28/759
> 
> The same issue we are already experiencing with Sound Open Firmware
> where the change was already merged
> and we have a bug already reported.
> 
> How should we fix this:
> 
> 1) Add  res->flags = IORESOURCE_MEM; in  of_reserved_mem_region_to_resource
> 
> OR
> 
> 2) Use devm_ioremap_wc instead of devm_ioremap_resource_wc.
> 
> thanks,
> Daniel.
> 
> 
> 
> Daniel.


  reply	other threads:[~2025-08-20 10:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 21:38 [PATCH v5] remoteproc: Use of_reserved_mem_region_* functions for "memory-region" Rob Herring (Arm)
2025-08-20  0:50 ` Dmitry Baryshkov
2025-08-20  8:21 ` Daniel Baluta
2025-08-20  9:35   ` Patrice CHOTARD [this message]
2025-08-20 19:31   ` Rob Herring

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=72c32584-26a8-41bc-9eb6-1b5c0b25a6b2@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=aisheng.dong@nxp.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=daniel.baluta@gmail.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=imx@lists.linux.dev \
    --cc=iuliana.prodan@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=laurentiu.mihalcea@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.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=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