Commit 9f2a4342 authored by Bjorn Andersson's avatar Bjorn Andersson
Browse files

remoteproc: qcom: Drop pr_err in q6v5_xfer_mem_ownership()

The pr_err() in q6v5_xfer_mem_ownership() prints, upon failure, the
memory range that failed to be transitioned. But on 32-bit architectures
with CONFIG_PHYS_ADDR_T_64BIT set we cannot cast the phys_addr_t
variable to a pointer, per below build error. Instead these should be
formatted with %pap.

In file included from include/linux/kernel.h:14:0,
                 from include/linux/clk.h:16,
                 from drivers/remoteproc/qcom_q6v5_pil.c:18:
drivers/remoteproc/qcom_q6v5_pil.c: In function 'q6v5_xfer_mem_ownership':
drivers/remoteproc/qcom_q6v5_pil.c:337:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
          (void *)addr, (void *)(addr + size),
          ^

Most callers will upon failure print a specific error message describing
which memory region that we failed to pass ownership of, so rather than
fixing the format string this patch fixes up the last callers and drop
the print from this function, saving us from spamming the log in most of
these error cases.

Fixes: 6c5a9dc2

 ("remoteproc: qcom: Make secure world call for mem ownership switch")
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent b8918839
......@@ -318,7 +318,6 @@ static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, int *current_perm,
size_t size)
{
struct qcom_scm_vmperm next;
int ret;
if (!qproc->need_mem_protection)
return 0;
......@@ -330,16 +329,8 @@ static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, int *current_perm,
next.vmid = remote_owner ? QCOM_SCM_VMID_MSS_MSA : QCOM_SCM_VMID_HLOS;
next.perm = remote_owner ? QCOM_SCM_PERM_RW : QCOM_SCM_PERM_RWX;
ret = qcom_scm_assign_mem(addr, ALIGN(size, SZ_4K),
current_perm, &next, 1);
if (ret < 0) {
pr_err("Failed to assign memory access in range %p to %p to %s ret = %d\n",
(void *)addr, (void *)(addr + size),
remote_owner ? "mss" : "hlos", ret);
return ret;
}
return 0;
return qcom_scm_assign_mem(addr, ALIGN(size, SZ_4K),
current_perm, &next, 1);
}
static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
......@@ -586,8 +577,11 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw)
mdata_perm = BIT(QCOM_SCM_VMID_HLOS);
ret = q6v5_xfer_mem_ownership(qproc, &mdata_perm,
true, phys, fw->size);
if (ret)
if (ret) {
dev_err(qproc->dev,
"assigning Q6 access to metadata failed: %d\n", ret);
return -EAGAIN;
}
writel(phys, qproc->rmb_base + RMB_PMI_META_DATA_REG);
writel(RMB_CMD_META_DATA_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
......@@ -715,8 +709,11 @@ static int q6v5_mpss_load(struct q6v5 *qproc)
/* Transfer ownership of modem ddr region to q6 */
ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, true,
qproc->mpss_phys, qproc->mpss_size);
if (ret)
if (ret) {
dev_err(qproc->dev,
"assigning Q6 access to mpss memory failed: %d\n", ret);
return -EAGAIN;
}
boot_addr = relocate ? qproc->mpss_phys : min_addr;
writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG);
......@@ -778,8 +775,12 @@ static int q6v5_start(struct rproc *rproc)
xfermemop_ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm, true,
qproc->mba_phys,
qproc->mba_size);
if (xfermemop_ret)
if (xfermemop_ret) {
dev_err(qproc->dev,
"assigning Q6 access to mba memory failed: %d\n",
xfermemop_ret);
goto disable_active_clks;
}
writel(qproc->mba_phys, qproc->rmb_base + RMB_MBA_IMAGE_REG);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment