Commit 7ac516d3 authored by Sibi Sankar's avatar Sibi Sankar Committed by Bjorn Andersson

remoteproc: qcom_q6v5_mss: Replace mask based tracking with size

In order to land inline coredump support for mss, the dump_segment
function would need to support granularities less than the segment
size. This is achieved by replacing mask based tracking with size.
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarSibi Sankar <sibis@codeaurora.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
Link: https://lore.kernel.org/r/1594938035-7327-3-git-send-email-rishabhb@codeaurora.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 2c010cc3
...@@ -180,8 +180,8 @@ struct q6v5 { ...@@ -180,8 +180,8 @@ struct q6v5 {
bool running; bool running;
bool dump_mba_loaded; bool dump_mba_loaded;
unsigned long dump_segment_mask; size_t current_dump_size;
unsigned long dump_complete_mask; size_t total_dump_size;
phys_addr_t mba_phys; phys_addr_t mba_phys;
void *mba_region; void *mba_region;
...@@ -1206,7 +1206,6 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, ...@@ -1206,7 +1206,6 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc,
{ {
int ret = 0; int ret = 0;
struct q6v5 *qproc = rproc->priv; struct q6v5 *qproc = rproc->priv;
unsigned long mask = BIT((unsigned long)segment->priv);
int offset = segment->da - qproc->mpss_reloc; int offset = segment->da - qproc->mpss_reloc;
void *ptr = NULL; void *ptr = NULL;
...@@ -1232,10 +1231,10 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, ...@@ -1232,10 +1231,10 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc,
memset(dest, 0xff, segment->size); memset(dest, 0xff, segment->size);
} }
qproc->dump_segment_mask |= mask; qproc->current_dump_size += segment->size;
/* Reclaim mba after copying segments */ /* Reclaim mba after copying segments */
if (qproc->dump_segment_mask == qproc->dump_complete_mask) { if (qproc->current_dump_size == qproc->total_dump_size) {
if (qproc->dump_mba_loaded) { if (qproc->dump_mba_loaded) {
/* Try to reset ownership back to Q6 */ /* Try to reset ownership back to Q6 */
q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm,
...@@ -1277,7 +1276,7 @@ static int q6v5_start(struct rproc *rproc) ...@@ -1277,7 +1276,7 @@ static int q6v5_start(struct rproc *rproc)
"Failed to reclaim mba buffer system may become unstable\n"); "Failed to reclaim mba buffer system may become unstable\n");
/* Reset Dump Segment Mask */ /* Reset Dump Segment Mask */
qproc->dump_segment_mask = 0; qproc->current_dump_size = 0;
qproc->running = true; qproc->running = true;
return 0; return 0;
...@@ -1326,7 +1325,7 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc, ...@@ -1326,7 +1325,7 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc,
ehdr = (struct elf32_hdr *)fw->data; ehdr = (struct elf32_hdr *)fw->data;
phdrs = (struct elf32_phdr *)(ehdr + 1); phdrs = (struct elf32_phdr *)(ehdr + 1);
qproc->dump_complete_mask = 0; qproc->total_dump_size = 0;
for (i = 0; i < ehdr->e_phnum; i++) { for (i = 0; i < ehdr->e_phnum; i++) {
phdr = &phdrs[i]; phdr = &phdrs[i];
...@@ -1337,11 +1336,11 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc, ...@@ -1337,11 +1336,11 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc,
ret = rproc_coredump_add_custom_segment(rproc, phdr->p_paddr, ret = rproc_coredump_add_custom_segment(rproc, phdr->p_paddr,
phdr->p_memsz, phdr->p_memsz,
qcom_q6v5_dump_segment, qcom_q6v5_dump_segment,
(void *)i); NULL);
if (ret) if (ret)
break; break;
qproc->dump_complete_mask |= BIT(i); qproc->total_dump_size += phdr->p_memsz;
} }
release_firmware(fw); release_firmware(fw);
......
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