From 9f2a4342a8bf24c644204311f0cf154f78489b53 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Mon, 6 Nov 2017 22:26:41 -0800 Subject: [PATCH] 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: 6c5a9dc2481b ("remoteproc: qcom: Make secure world call for mem ownership switch") Reported-by: Arnd Bergmann Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_q6v5_pil.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 5460f61ee21c..a019796c363a 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -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);