msm: adsprpc: enable ramdump collection for CMA persistent buffer
Ramdump collection is missing for peristent mappings. Added change to enable ramdump collection for CMA persistent buffer Change-Id: Ic8484c9d9f2814610de78fbafba9cdc65a75d862 Acked-by: DEEPAK SANNAPAREDDY <sdeeredd@qti.qualcomm.com> Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
This commit is contained in:
@@ -4884,7 +4884,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
{
|
||||
struct fastrpc_mmap *match = NULL, *map = NULL;
|
||||
struct hlist_node *n = NULL;
|
||||
int err = 0, ret = 0;
|
||||
int err = 0, ret = 0, lock = 0;
|
||||
struct fastrpc_apps *me = &gfa;
|
||||
struct qcom_dump_segment ramdump_segments_rh;
|
||||
struct list_head head;
|
||||
@@ -4898,10 +4898,13 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
do {
|
||||
match = NULL;
|
||||
spin_lock_irqsave(&me->hlock, irq_flags);
|
||||
lock = 1;
|
||||
hlist_for_each_entry_safe(map, n, &me->maps, hn) {
|
||||
if (!lock) {
|
||||
spin_lock_irqsave(&me->hlock, irq_flags);
|
||||
lock = 1;
|
||||
}
|
||||
/* In hibernation suspend case fl is NULL, check !fl to cleanup */
|
||||
if (!fl || (fl && map->servloc_name && fl->servloc_name
|
||||
&& !strcmp(map->servloc_name, fl->servloc_name))) {
|
||||
@@ -4911,7 +4914,10 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
uint64_t phys = map->phys;
|
||||
size_t size = map->size;
|
||||
|
||||
if (lock) {
|
||||
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||
lock = 0;
|
||||
}
|
||||
//scm assign it back to HLOS
|
||||
if (rhvm->vmid) {
|
||||
u64 src_perms = 0;
|
||||
@@ -4932,9 +4938,12 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
"rh hyp unassign failed with %d for phys 0x%llx, size %zu\n",
|
||||
err, phys, size);
|
||||
err = -EADDRNOTAVAIL;
|
||||
return err;
|
||||
goto bail;
|
||||
}
|
||||
if (!lock) {
|
||||
spin_lock_irqsave(&me->hlock, irq_flags);
|
||||
lock = 1;
|
||||
}
|
||||
map->in_use = false;
|
||||
/*
|
||||
* decrementing refcount for persistent mappings
|
||||
@@ -4942,17 +4951,16 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
*/
|
||||
map->refs--;
|
||||
}
|
||||
if (map->is_persistent) {
|
||||
match = NULL;
|
||||
continue;
|
||||
}
|
||||
if (!match->is_persistent)
|
||||
hlist_del_init(&map->hn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lock) {
|
||||
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||
lock = 0;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
if (!match->is_persistent) {
|
||||
if (match->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
|
||||
err = fastrpc_munmap_rh(match->phys,
|
||||
match->size, match->flags);
|
||||
@@ -4965,8 +4973,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
fastrpc_mmap_add(match);
|
||||
}
|
||||
}
|
||||
if (err)
|
||||
goto bail;
|
||||
}
|
||||
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);
|
||||
@@ -4979,14 +4986,20 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
||||
pr_err("adsprpc: %s: unable to dump heap (err %d)\n",
|
||||
__func__, ret);
|
||||
}
|
||||
if (!match->is_persistent) {
|
||||
if (!locked)
|
||||
mutex_lock(&fl->map_mutex);
|
||||
fastrpc_mmap_free(match, 0);
|
||||
if (!locked)
|
||||
mutex_unlock(&fl->map_mutex);
|
||||
}
|
||||
} while (match);
|
||||
}
|
||||
}
|
||||
bail:
|
||||
if (lock) {
|
||||
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||
lock = 0;
|
||||
}
|
||||
if (err && match) {
|
||||
if (!locked)
|
||||
mutex_lock(&fl->map_mutex);
|
||||
|
Reference in New Issue
Block a user