remoteproc: elf_loader: Fix loading segment when is_iomem true
authorPeng Fan <peng.fan@nxp.com>
Fri, 10 Sep 2021 09:06:16 +0000 (17:06 +0800)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 27 Sep 2021 23:37:01 +0000 (18:37 -0500)
It seems luckliy work on i.MX platform, but it is wrong.
Need use memcpy_toio, not memcpy_fromio.

Fixes: 40df0a91b2a5 ("remoteproc: add is_iomem to da_to_va")
Tested-by: Dong Aisheng <aisheng.dong@nxp.com> (i.MX8MQ)
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210910090621.3073540-2-peng.fan@oss.nxp.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_elf_loader.c

index 469c52e..44e7f93 100644 (file)
@@ -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);
                }