[PATCH V5 2/8] remoteproc: add is_iomem to da_to_va

2020-12-28 Thread peng . fan
From: Peng Fan 

Introduce an extra parameter is_iomem to da_to_va, then the caller
could take the memory as normal memory or io mapped memory.

Reviewed-by: Bjorn Andersson 
Signed-off-by: Peng Fan 
---
 drivers/remoteproc/imx_rproc.c |  2 +-
 drivers/remoteproc/ingenic_rproc.c |  2 +-
 drivers/remoteproc/keystone_remoteproc.c   |  2 +-
 drivers/remoteproc/mtk_scp.c   |  6 +++---
 drivers/remoteproc/omap_remoteproc.c   |  2 +-
 drivers/remoteproc/pru_rproc.c |  2 +-
 drivers/remoteproc/qcom_q6v5_adsp.c|  2 +-
 drivers/remoteproc/qcom_q6v5_pas.c |  2 +-
 drivers/remoteproc/qcom_q6v5_wcss.c|  2 +-
 drivers/remoteproc/qcom_wcnss.c|  2 +-
 drivers/remoteproc/remoteproc_core.c   |  7 +--
 drivers/remoteproc/remoteproc_coredump.c   |  8 ++--
 drivers/remoteproc/remoteproc_debugfs.c|  2 +-
 drivers/remoteproc/remoteproc_elf_loader.c | 21 +++--
 drivers/remoteproc/remoteproc_internal.h   |  2 +-
 drivers/remoteproc/st_slim_rproc.c |  2 +-
 drivers/remoteproc/ti_k3_dsp_remoteproc.c  |  2 +-
 drivers/remoteproc/ti_k3_r5_remoteproc.c   |  2 +-
 drivers/remoteproc/wkup_m3_rproc.c |  2 +-
 include/linux/remoteproc.h |  2 +-
 20 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 8957ed271d20..6603e00bb6f4 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -208,7 +208,7 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 
da,
return -ENOENT;
 }
 
-static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
+static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool 
*is_iomem)
 {
struct imx_rproc *priv = rproc->priv;
void *va = NULL;
diff --git a/drivers/remoteproc/ingenic_rproc.c 
b/drivers/remoteproc/ingenic_rproc.c
index 26e19e6143b7..bb5049295576 100644
--- a/drivers/remoteproc/ingenic_rproc.c
+++ b/drivers/remoteproc/ingenic_rproc.c
@@ -116,7 +116,7 @@ static void ingenic_rproc_kick(struct rproc *rproc, int 
vqid)
writel(vqid, vpu->aux_base + REG_CORE_MSG);
 }
 
-static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
+static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, 
bool *is_iomem)
 {
struct vpu *vpu = rproc->priv;
void __iomem *va = NULL;
diff --git a/drivers/remoteproc/keystone_remoteproc.c 
b/drivers/remoteproc/keystone_remoteproc.c
index cd266163a65f..54781f553f4e 100644
--- a/drivers/remoteproc/keystone_remoteproc.c
+++ b/drivers/remoteproc/keystone_remoteproc.c
@@ -246,7 +246,7 @@ static void keystone_rproc_kick(struct rproc *rproc, int 
vqid)
  * can be used either by the remoteproc core for loading (when using kernel
  * remoteproc loader), or by any rpmsg bus drivers.
  */
-static void *keystone_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
+static void *keystone_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, 
bool *is_iomem)
 {
struct keystone_rproc *ksproc = rproc->priv;
void __iomem *va = NULL;
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index e0c235690361..535175f013e4 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -270,7 +270,7 @@ static int scp_elf_load_segments(struct rproc *rproc, const 
struct firmware *fw)
}
 
/* grab the kernel address for this device address */
-   ptr = (void __iomem *)rproc_da_to_va(rproc, da, memsz);
+   ptr = (void __iomem *)rproc_da_to_va(rproc, da, memsz, NULL);
if (!ptr) {
dev_err(dev, "bad phdr da 0x%x mem 0x%x\n", da, memsz);
ret = -EINVAL;
@@ -458,7 +458,7 @@ static int scp_start(struct rproc *rproc)
return ret;
 }
 
-static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
+static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool 
*is_iomem)
 {
struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
int offset;
@@ -587,7 +587,7 @@ void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 mem_addr)
 {
void *ptr;
 
-   ptr = scp_da_to_va(scp->rproc, mem_addr, 0);
+   ptr = scp_da_to_va(scp->rproc, mem_addr, 0, NULL);
if (!ptr)
return ERR_PTR(-EINVAL);
 
diff --git a/drivers/remoteproc/omap_remoteproc.c 
b/drivers/remoteproc/omap_remoteproc.c
index d94b7391bf9d..43531caa1959 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -728,7 +728,7 @@ static int omap_rproc_stop(struct rproc *rproc)
  * Return: translated virtual address in kernel memory space on success,
  * or NULL on failure.
  */
-static void *omap_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
+static void *omap_rproc_da_to_va(struct rproc *rproc, u64 da, size_t

Re: [PATCH V5 2/8] remoteproc: add is_iomem to da_to_va

2021-01-11 Thread Mathieu Poirier
On Tue, Dec 29, 2020 at 11:30:13AM +0800, peng@nxp.com wrote:
> From: Peng Fan 
> 
> Introduce an extra parameter is_iomem to da_to_va, then the caller
> could take the memory as normal memory or io mapped memory.
> 
> Reviewed-by: Bjorn Andersson 
> Signed-off-by: Peng Fan 
> ---
>  drivers/remoteproc/imx_rproc.c |  2 +-
>  drivers/remoteproc/ingenic_rproc.c |  2 +-
>  drivers/remoteproc/keystone_remoteproc.c   |  2 +-
>  drivers/remoteproc/mtk_scp.c   |  6 +++---
>  drivers/remoteproc/omap_remoteproc.c   |  2 +-
>  drivers/remoteproc/pru_rproc.c |  2 +-
>  drivers/remoteproc/qcom_q6v5_adsp.c|  2 +-
>  drivers/remoteproc/qcom_q6v5_pas.c |  2 +-
>  drivers/remoteproc/qcom_q6v5_wcss.c|  2 +-
>  drivers/remoteproc/qcom_wcnss.c|  2 +-
>  drivers/remoteproc/remoteproc_core.c   |  7 +--
>  drivers/remoteproc/remoteproc_coredump.c   |  8 ++--
>  drivers/remoteproc/remoteproc_debugfs.c|  2 +-
>  drivers/remoteproc/remoteproc_elf_loader.c | 21 +++--
>  drivers/remoteproc/remoteproc_internal.h   |  2 +-
>  drivers/remoteproc/st_slim_rproc.c |  2 +-
>  drivers/remoteproc/ti_k3_dsp_remoteproc.c  |  2 +-
>  drivers/remoteproc/ti_k3_r5_remoteproc.c   |  2 +-
>  drivers/remoteproc/wkup_m3_rproc.c |  2 +-
>  include/linux/remoteproc.h |  2 +-
>  20 files changed, 45 insertions(+), 29 deletions(-)

Reviewed-by: Mathieu Poirier 

> 
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 8957ed271d20..6603e00bb6f4 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -208,7 +208,7 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, 
> u64 da,
>   return -ENOENT;
>  }
>  
> -static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
> +static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, 
> bool *is_iomem)
>  {
>   struct imx_rproc *priv = rproc->priv;
>   void *va = NULL;
> diff --git a/drivers/remoteproc/ingenic_rproc.c 
> b/drivers/remoteproc/ingenic_rproc.c
> index 26e19e6143b7..bb5049295576 100644
> --- a/drivers/remoteproc/ingenic_rproc.c
> +++ b/drivers/remoteproc/ingenic_rproc.c
> @@ -116,7 +116,7 @@ static void ingenic_rproc_kick(struct rproc *rproc, int 
> vqid)
>   writel(vqid, vpu->aux_base + REG_CORE_MSG);
>  }
>  
> -static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
> +static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, 
> bool *is_iomem)
>  {
>   struct vpu *vpu = rproc->priv;
>   void __iomem *va = NULL;
> diff --git a/drivers/remoteproc/keystone_remoteproc.c 
> b/drivers/remoteproc/keystone_remoteproc.c
> index cd266163a65f..54781f553f4e 100644
> --- a/drivers/remoteproc/keystone_remoteproc.c
> +++ b/drivers/remoteproc/keystone_remoteproc.c
> @@ -246,7 +246,7 @@ static void keystone_rproc_kick(struct rproc *rproc, int 
> vqid)
>   * can be used either by the remoteproc core for loading (when using kernel
>   * remoteproc loader), or by any rpmsg bus drivers.
>   */
> -static void *keystone_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
> +static void *keystone_rproc_da_to_va(struct rproc *rproc, u64 da, size_t 
> len, bool *is_iomem)
>  {
>   struct keystone_rproc *ksproc = rproc->priv;
>   void __iomem *va = NULL;
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index e0c235690361..535175f013e4 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -270,7 +270,7 @@ static int scp_elf_load_segments(struct rproc *rproc, 
> const struct firmware *fw)
>   }
>  
>   /* grab the kernel address for this device address */
> - ptr = (void __iomem *)rproc_da_to_va(rproc, da, memsz);
> + ptr = (void __iomem *)rproc_da_to_va(rproc, da, memsz, NULL);
>   if (!ptr) {
>   dev_err(dev, "bad phdr da 0x%x mem 0x%x\n", da, memsz);
>   ret = -EINVAL;
> @@ -458,7 +458,7 @@ static int scp_start(struct rproc *rproc)
>   return ret;
>  }
>  
> -static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
> +static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len, bool 
> *is_iomem)
>  {
>   struct mtk_scp *scp = (struct mtk_scp *)rproc->priv;
>   int offset;
> @@ -587,7 +587,7 @@ void *scp_mapping_dm_addr(struct mtk_scp *scp, u32 
> mem_addr)
>  {
>   void *ptr;
>  
> - ptr = scp_da_to_va(scp->rproc, mem_addr, 0);
> + ptr = scp_da_to_va(scp->rproc, mem_addr, 0, NULL);
>   if (!ptr)
>   return ERR_PTR(-EINVAL);
>  
> diff --git a/drivers/remoteproc/omap_remoteproc.c 
> b/drivers/remoteproc/omap_remoteproc.c
> index d94b7391bf9d..43531caa1959 100644
> --- a/drivers/remoteproc/omap_remoteproc.c
> +++ b/drivers/remoteproc/omap_remoteproc.c
> @@ -728,7 +728,7 @@ static int omap_