diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c index 3edb6d2753..b8bfabcf11 100644 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -3983,7 +3983,7 @@ bail: static int fastrpc_mmap_remove_pdr(struct fastrpc_file *fl); static int fastrpc_channel_open(struct fastrpc_file *fl, uint32_t flags); -static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked); +static int fastrpc_dsp_restart_handler(struct fastrpc_file *fl, int locked, bool dump_req); /* * This function makes a call to create a thread group in the root @@ -5189,7 +5189,7 @@ bail: return err; } -static int fastrpc_mmap_dump(struct fastrpc_mmap *map, struct fastrpc_file *fl, int locked) +static int fastrpc_mmap_dump(struct fastrpc_mmap *map, struct fastrpc_file *fl, int locked, bool dump_req) { struct fastrpc_mmap *match = map; int err = 0, ret = 0; @@ -5250,17 +5250,19 @@ static int fastrpc_mmap_dump(struct fastrpc_mmap *map, struct fastrpc_file *fl, if (err) return err; } - memset(&ramdump_segments_rh, 0, sizeof(ramdump_segments_rh)); - ramdump_segments_rh.da = match->phys; - ramdump_segments_rh.va = (void *)page_address((struct page *)match->va); - ramdump_segments_rh.size = match->size; - INIT_LIST_HEAD(&head); - list_add(&ramdump_segments_rh.node, &head); - if (me->dev && dump_enabled()) { - ret = qcom_elf_dump(&head, me->dev, ELF_CLASS); - if (ret < 0) - pr_err("adsprpc: %s: unable to dump heap (err %d)\n", - __func__, ret); + if (dump_req) { + memset(&ramdump_segments_rh, 0, sizeof(ramdump_segments_rh)); + ramdump_segments_rh.da = match->phys; + ramdump_segments_rh.va = (void *)page_address((struct page *)match->va); + ramdump_segments_rh.size = match->size; + INIT_LIST_HEAD(&head); + list_add(&ramdump_segments_rh.node, &head); + if (me->dev && dump_enabled()) { + ret = qcom_elf_dump(&head, me->dev, ELF_CLASS); + if (ret < 0) + pr_err("adsprpc: %s: unable to dump heap (err %d)\n", + __func__, ret); + } } if (!match->is_persistent) { if (!locked && fl) @@ -5272,7 +5274,7 @@ static int fastrpc_mmap_dump(struct fastrpc_mmap *map, struct fastrpc_file *fl, return 0; } -static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked) +static int fastrpc_dsp_restart_handler(struct fastrpc_file *fl, int locked, bool dump_req) { struct fastrpc_mmap *match = NULL, *map = NULL; struct hlist_node *n = NULL; @@ -5307,7 +5309,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked) } spin_unlock_irqrestore(&me->hlock, irq_flags); if (match) - err = fastrpc_mmap_dump(match, fl, locked); + err = fastrpc_mmap_dump(match, fl, locked, dump_req); } while (match && !err); bail: @@ -5353,7 +5355,7 @@ static int fastrpc_mmap_remove_pdr(struct fastrpc_file *fl) } if (me->channel[cid].spd[session].pdrcount != me->channel[cid].spd[session].prevpdrcount) { - err = fastrpc_mmap_remove_ssr(fl, 0); + err = fastrpc_dsp_restart_handler(fl, 0, false); if (err) ADSPRPC_WARN("failed to unmap remote heap (err %d)\n", err); @@ -6393,7 +6395,7 @@ static int fastrpc_channel_open(struct fastrpc_file *fl, uint32_t flags) me->channel[cid].prevssrcount) { mutex_unlock(&me->channel[cid].smd_mutex); mutex_lock(&fl->map_mutex); - err = fastrpc_mmap_remove_ssr(fl, 1); + err = fastrpc_dsp_restart_handler(fl, 1, true); mutex_unlock(&fl->map_mutex); if (err) ADSPRPC_WARN( @@ -8544,7 +8546,7 @@ static int fastrpc_hibernation_suspend(struct device *dev) if (of_device_is_compatible(dev->of_node, "qcom,msm-fastrpc-compute")) { - err = fastrpc_mmap_remove_ssr(NULL, 0); + err = fastrpc_dsp_restart_handler(NULL, 0, true); if (err) ADSPRPC_WARN("failed to unmap remote heap (err %d)\n", err);