2021-09-10 09:11:08

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V4 0/6] remoteproc: elf_loader and imx fix

From: Peng Fan <[email protected]>

V4:
Add coverletter
Spin R-b/T-b tags
Because the v3 patchset depends on the other patch, so
include in the patchset now: https://patchwork.kernel.org/project/linux-remoteproc/patch/[email protected]/

Dong Aisheng (5):
remoteproc: fix the wrong default value of is_iomem
remoteproc: imx_rproc: fix TCM io memory type
remoteproc: imx_rproc: fix ignoring mapping vdev regions
remoteproc: imx_rproc: fix rsc-table name
remoteproc: imx_rproc: change to ioremap_wc for dram

Peng Fan (1):
remoteproc: elf_loader: fix loading segment when is_iomem true

drivers/remoteproc/imx_rproc.c | 43 +++++++++++++---------
drivers/remoteproc/remoteproc_coredump.c | 2 +-
drivers/remoteproc/remoteproc_elf_loader.c | 4 +-
3 files changed, 28 insertions(+), 21 deletions(-)

--
2.25.1


2021-09-10 09:11:19

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V4 1/6] remoteproc: elf_loader: fix loading segment when is_iomem true

From: Peng Fan <[email protected]>

It seems luckliy work on i.MX platform, but it is wrong.
Need use memcpy_toio, not memcpy_fromio.

Fixes: 40df0a91b2a52 ("remoteproc: add is_iomem to da_to_va")
Tested-by: Dong Aisheng <[email protected]> (i.MX8MQ)
Reported-by: kernel test robot <[email protected]>
Reported-by: Dong Aisheng <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
---
drivers/remoteproc/remoteproc_elf_loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
index 469c52e62faff..44e7f9308f4bc 100644
--- a/drivers/remoteproc/remoteproc_elf_loader.c
+++ b/drivers/remoteproc/remoteproc_elf_loader.c
@@ -220,7 +220,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
/* put the segment where the remote processor expects it */
if (filesz) {
if (is_iomem)
- memcpy_fromio(ptr, (void __iomem *)(elf_data + offset), filesz);
+ memcpy_toio((void __iomem *)ptr, elf_data + offset, filesz);
else
memcpy(ptr, elf_data + offset, filesz);
}
--
2.25.1

2021-09-10 09:12:23

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V4 5/6] remoteproc: imx_rproc: fix rsc-table name

From: Dong Aisheng <[email protected]>

Usually the dash '-' is preferred in node name.
So far, not dts in upstream kernel, so we just update node name
in driver.

Cc: Bjorn Andersson <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Fixes: 5e4c1243071d ("remoteproc: imx_rproc: support remote cores booted before Linux Kernel")
Reviewed-and-tested-by: Peng Fan <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
---
drivers/remoteproc/imx_rproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index abfeac0b1738d..ff620688fad94 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -604,7 +604,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
}
priv->mem[b].sys_addr = res.start;
priv->mem[b].size = resource_size(&res);
- if (!strcmp(node->name, "rsc_table"))
+ if (!strcmp(node->name, "rsc-table"))
priv->rsc_table = priv->mem[b].cpu_addr;
b++;
}
--
2.25.1

2021-09-10 09:12:53

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V4 6/6] remoteproc: imx_rproc: change to ioremap_wc for dram

From: Dong Aisheng <[email protected]>

DRAM is not io memory, so changed to ioremap_wc. This is also
aligned with core io accessories. e.g. memcpy/memset and cpu direct
access.

Cc: Bjorn Andersson <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Peng Fan <[email protected]>
Reviewed-and-tested-by: Peng Fan <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
---
drivers/remoteproc/imx_rproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index ff620688fad94..4ae416ba50807 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -597,7 +597,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
break;

/* Not use resource version, because we might share region */
- priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
+ priv->mem[b].cpu_addr = devm_ioremap_wc(&pdev->dev, res.start, resource_size(&res));
if (!priv->mem[b].cpu_addr) {
dev_err(dev, "failed to remap %pr\n", &res);
return -ENOMEM;
--
2.25.1

2021-09-21 01:41:11

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH V4 1/6] remoteproc: elf_loader: fix loading segment when is_iomem true

On Fri, Sep 10, 2021 at 05:06:16PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <[email protected]>
>
> It seems luckliy work on i.MX platform, but it is wrong.
> Need use memcpy_toio, not memcpy_fromio.
>

Lucky or not I just can't understand how this worked in the first place.

> Fixes: 40df0a91b2a52 ("remoteproc: add is_iomem to da_to_va")

SHA tag should be 12 characters.

> Tested-by: Dong Aisheng <[email protected]> (i.MX8MQ)
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dong Aisheng <[email protected]>
> Signed-off-by: Peng Fan <[email protected]>

I will add a CC:stable, fix the title, fix the SHA and pick this patch.

> ---
> drivers/remoteproc/remoteproc_elf_loader.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
> index 469c52e62faff..44e7f9308f4bc 100644
> --- a/drivers/remoteproc/remoteproc_elf_loader.c
> +++ b/drivers/remoteproc/remoteproc_elf_loader.c
> @@ -220,7 +220,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
> /* put the segment where the remote processor expects it */
> if (filesz) {
> if (is_iomem)
> - memcpy_fromio(ptr, (void __iomem *)(elf_data + offset), filesz);
> + memcpy_toio((void __iomem *)ptr, elf_data + offset, filesz);
> else
> memcpy(ptr, elf_data + offset, filesz);
> }
> --
> 2.25.1
>

2021-09-21 02:47:24

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH V4 6/6] remoteproc: imx_rproc: change to ioremap_wc for dram

On Fri, Sep 10, 2021 at 05:06:21PM +0800, Peng Fan (OSS) wrote:
> From: Dong Aisheng <[email protected]>
>
> DRAM is not io memory, so changed to ioremap_wc. This is also
> aligned with core io accessories. e.g. memcpy/memset and cpu direct
> access.
>
> Cc: Bjorn Andersson <[email protected]>
> Cc: Mathieu Poirier <[email protected]>
> Cc: Peng Fan <[email protected]>
> Reviewed-and-tested-by: Peng Fan <[email protected]>
> Signed-off-by: Dong Aisheng <[email protected]>
> Signed-off-by: Peng Fan <[email protected]>
> ---
> drivers/remoteproc/imx_rproc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I have applied patches 4, 5 and 6 of this set.

>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index ff620688fad94..4ae416ba50807 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -597,7 +597,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
> break;
>
> /* Not use resource version, because we might share region */
> - priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
> + priv->mem[b].cpu_addr = devm_ioremap_wc(&pdev->dev, res.start, resource_size(&res));
> if (!priv->mem[b].cpu_addr) {
> dev_err(dev, "failed to remap %pr\n", &res);
> return -ENOMEM;
> --
> 2.25.1
>