Commit 76abf9ce authored by Rishabh Bhatnagar's avatar Rishabh Bhatnagar Committed by Bjorn Andersson

remoteproc: Pass size and offset as arguments to segment dump function

Change the segment dump API signature to include size and offset
arguments. Refactor the qcom_q6v5_mss driver to use these
arguments while copying the segment. Doing this lays the ground
work for "inline" coredump functionality being added in the next
patch.
Tested-by: default avatarSibi Sankar <sibis@codeaurora.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarSibi Sankar <sibis@codeaurora.org>
Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
Link: https://lore.kernel.org/r/1594938035-7327-4-git-send-email-rishabhb@codeaurora.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 7ac516d3
...@@ -1202,7 +1202,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) ...@@ -1202,7 +1202,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc)
static void qcom_q6v5_dump_segment(struct rproc *rproc, static void qcom_q6v5_dump_segment(struct rproc *rproc,
struct rproc_dump_segment *segment, struct rproc_dump_segment *segment,
void *dest) void *dest, size_t cp_offset, size_t size)
{ {
int ret = 0; int ret = 0;
struct q6v5 *qproc = rproc->priv; struct q6v5 *qproc = rproc->priv;
...@@ -1222,16 +1222,16 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, ...@@ -1222,16 +1222,16 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc,
} }
if (!ret) if (!ret)
ptr = ioremap_wc(qproc->mpss_phys + offset, segment->size); ptr = ioremap_wc(qproc->mpss_phys + offset + cp_offset, size);
if (ptr) { if (ptr) {
memcpy(dest, ptr, segment->size); memcpy(dest, ptr, size);
iounmap(ptr); iounmap(ptr);
} else { } else {
memset(dest, 0xff, segment->size); memset(dest, 0xff, size);
} }
qproc->current_dump_size += segment->size; qproc->current_dump_size += size;
/* Reclaim mba after copying segments */ /* Reclaim mba after copying segments */
if (qproc->current_dump_size == qproc->total_dump_size) { if (qproc->current_dump_size == qproc->total_dump_size) {
......
...@@ -72,7 +72,8 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, ...@@ -72,7 +72,8 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc,
dma_addr_t da, size_t size, dma_addr_t da, size_t size,
void (*dumpfn)(struct rproc *rproc, void (*dumpfn)(struct rproc *rproc,
struct rproc_dump_segment *segment, struct rproc_dump_segment *segment,
void *dest), void *dest, size_t offset,
size_t size),
void *priv) void *priv)
{ {
struct rproc_dump_segment *segment; struct rproc_dump_segment *segment;
...@@ -183,7 +184,7 @@ void rproc_coredump(struct rproc *rproc) ...@@ -183,7 +184,7 @@ void rproc_coredump(struct rproc *rproc)
elf_phdr_set_p_align(class, phdr, 0); elf_phdr_set_p_align(class, phdr, 0);
if (segment->dump) { if (segment->dump) {
segment->dump(rproc, segment, data + offset); segment->dump(rproc, segment, data + offset, 0, segment->size);
} else { } else {
ptr = rproc_da_to_va(rproc, segment->da, segment->size); ptr = rproc_da_to_va(rproc, segment->da, segment->size);
if (!ptr) { if (!ptr) {
......
...@@ -456,7 +456,7 @@ struct rproc_dump_segment { ...@@ -456,7 +456,7 @@ struct rproc_dump_segment {
void *priv; void *priv;
void (*dump)(struct rproc *rproc, struct rproc_dump_segment *segment, void (*dump)(struct rproc *rproc, struct rproc_dump_segment *segment,
void *dest); void *dest, size_t offset, size_t size);
loff_t offset; loff_t offset;
}; };
...@@ -638,7 +638,8 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, ...@@ -638,7 +638,8 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc,
dma_addr_t da, size_t size, dma_addr_t da, size_t size,
void (*dumpfn)(struct rproc *rproc, void (*dumpfn)(struct rproc *rproc,
struct rproc_dump_segment *segment, struct rproc_dump_segment *segment,
void *dest), void *dest, size_t offset,
size_t size),
void *priv); void *priv);
int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine);
......
Markdown is supported
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