Skip to content

Commit

Permalink
remoteproc: Introduce custom dump function for each remoteproc segment
Browse files Browse the repository at this point in the history
Introduce custom dump function and private data per remoteproc dump
segment. The dump function is responsible for filling the device memory
segment associated with coredump

Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
Sibi Sankar authored and Bjorn Andersson committed Oct 19, 2018
1 parent c6aed23 commit 3952105
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 11 additions & 7 deletions drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1508,14 +1508,18 @@ static void rproc_coredump(struct rproc *rproc)
phdr->p_flags = PF_R | PF_W | PF_X;
phdr->p_align = 0;

ptr = rproc_da_to_va(rproc, segment->da, segment->size);
if (!ptr) {
dev_err(&rproc->dev,
"invalid coredump segment (%pad, %zu)\n",
&segment->da, segment->size);
memset(data + offset, 0xff, segment->size);
if (segment->dump) {
segment->dump(rproc, segment, data + offset);
} else {
memcpy(data + offset, ptr, segment->size);
ptr = rproc_da_to_va(rproc, segment->da, segment->size);
if (!ptr) {
dev_err(&rproc->dev,
"invalid coredump segment (%pad, %zu)\n",
&segment->da, segment->size);
memset(data + offset, 0xff, segment->size);
} else {
memcpy(data + offset, ptr, segment->size);
}
}

offset += phdr->p_filesz;
Expand Down
6 changes: 6 additions & 0 deletions include/linux/remoteproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,19 @@ enum rproc_crash_type {
* @node: list node related to the rproc segment list
* @da: device address of the segment
* @size: size of the segment
* @priv: private data associated with the dump_segment
* @dump: custom dump function to fill device memory segment associated
* with coredump
*/
struct rproc_dump_segment {
struct list_head node;

dma_addr_t da;
size_t size;

void *priv;
void (*dump)(struct rproc *rproc, struct rproc_dump_segment *segment,
void *dest);
loff_t offset;
};

Expand Down

0 comments on commit 3952105

Please sign in to comment.