diff options
author | Yogesh Lal <quic_ylal@quicinc.com> | 2022-11-02 18:12:09 +0100 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2023-02-14 18:04:29 +0100 |
commit | a376c10d45a8e6ee5ea55791193f90625b35e156 (patch) | |
tree | e0262e04217b44470f3f1531368661d873aa7561 /drivers/remoteproc/qcom_q6v5_pas.c | |
parent | remoteproc: qcom: fix sparse warnings (diff) | |
download | linux-a376c10d45a8e6ee5ea55791193f90625b35e156.tar.xz linux-a376c10d45a8e6ee5ea55791193f90625b35e156.zip |
remoteproc: qcom: pas: Adjust the phys addr wrt the mem region
The minidump table in the toc contains physical addresses that may lie
before the physical address of the first elf segment in relocatable
images. This change adds a custom dump function for minidumps which
calculates the offset into the carveout region using the start of
the physical address instead of the start of the first elf segment.
Signed-off-by: Yogesh Lal <quic_ylal@quicinc.com>
Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/1667409129-6254-1-git-send-email-quic_ylal@quicinc.com
Diffstat (limited to 'drivers/remoteproc/qcom_q6v5_pas.c')
-rw-r--r-- | drivers/remoteproc/qcom_q6v5_pas.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 4e1d9b08def4..7418f0e61943 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -105,6 +105,24 @@ struct qcom_adsp { struct qcom_scm_pas_metadata dtb_pas_metadata; }; +void adsp_segment_dump(struct rproc *rproc, struct rproc_dump_segment *segment, + void *dest, size_t offset, size_t size) +{ + struct qcom_adsp *adsp = rproc->priv; + int total_offset; + + total_offset = segment->da + segment->offset + offset - adsp->mem_phys; + if (total_offset < 0 || total_offset + size > adsp->mem_size) { + dev_err(adsp->dev, + "invalid copy request for segment %pad with offset %zu and size %zu)\n", + &segment->da, offset, size); + memset(dest, 0xff, size); + return; + } + + memcpy_fromio(dest, adsp->mem_region + total_offset, size); +} + static void adsp_minidump(struct rproc *rproc) { struct qcom_adsp *adsp = rproc->priv; @@ -112,7 +130,7 @@ static void adsp_minidump(struct rproc *rproc) if (rproc->dump_conf == RPROC_COREDUMP_DISABLED) return; - qcom_minidump(rproc, adsp->minidump_id); + qcom_minidump(rproc, adsp->minidump_id, adsp_segment_dump); } static int adsp_pds_enable(struct qcom_adsp *adsp, struct device **pds, |