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 fastrpc_mmap *match = NULL, *map = NULL;
|
||||||
struct hlist_node *n = NULL;
|
struct hlist_node *n = NULL;
|
||||||
int err = 0, ret = 0;
|
int err = 0, ret = 0, lock = 0;
|
||||||
struct fastrpc_apps *me = &gfa;
|
struct fastrpc_apps *me = &gfa;
|
||||||
struct qcom_dump_segment ramdump_segments_rh;
|
struct qcom_dump_segment ramdump_segments_rh;
|
||||||
struct list_head head;
|
struct list_head head;
|
||||||
@@ -4898,10 +4898,13 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do {
|
|
||||||
match = NULL;
|
|
||||||
spin_lock_irqsave(&me->hlock, irq_flags);
|
spin_lock_irqsave(&me->hlock, irq_flags);
|
||||||
|
lock = 1;
|
||||||
hlist_for_each_entry_safe(map, n, &me->maps, hn) {
|
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 */
|
/* In hibernation suspend case fl is NULL, check !fl to cleanup */
|
||||||
if (!fl || (fl && map->servloc_name && fl->servloc_name
|
if (!fl || (fl && map->servloc_name && fl->servloc_name
|
||||||
&& !strcmp(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;
|
uint64_t phys = map->phys;
|
||||||
size_t size = map->size;
|
size_t size = map->size;
|
||||||
|
|
||||||
|
if (lock) {
|
||||||
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||||
|
lock = 0;
|
||||||
|
}
|
||||||
//scm assign it back to HLOS
|
//scm assign it back to HLOS
|
||||||
if (rhvm->vmid) {
|
if (rhvm->vmid) {
|
||||||
u64 src_perms = 0;
|
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",
|
"rh hyp unassign failed with %d for phys 0x%llx, size %zu\n",
|
||||||
err, phys, size);
|
err, phys, size);
|
||||||
err = -EADDRNOTAVAIL;
|
err = -EADDRNOTAVAIL;
|
||||||
return err;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
if (!lock) {
|
||||||
spin_lock_irqsave(&me->hlock, irq_flags);
|
spin_lock_irqsave(&me->hlock, irq_flags);
|
||||||
|
lock = 1;
|
||||||
|
}
|
||||||
map->in_use = false;
|
map->in_use = false;
|
||||||
/*
|
/*
|
||||||
* decrementing refcount for persistent mappings
|
* decrementing refcount for persistent mappings
|
||||||
@@ -4942,17 +4951,16 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
|||||||
*/
|
*/
|
||||||
map->refs--;
|
map->refs--;
|
||||||
}
|
}
|
||||||
if (map->is_persistent) {
|
if (!match->is_persistent)
|
||||||
match = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
hlist_del_init(&map->hn);
|
hlist_del_init(&map->hn);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (lock) {
|
||||||
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||||
|
lock = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
|
if (!match->is_persistent) {
|
||||||
if (match->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
|
if (match->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
|
||||||
err = fastrpc_munmap_rh(match->phys,
|
err = fastrpc_munmap_rh(match->phys,
|
||||||
match->size, match->flags);
|
match->size, match->flags);
|
||||||
@@ -4965,8 +4973,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
|
|||||||
fastrpc_mmap_add(match);
|
fastrpc_mmap_add(match);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (err)
|
}
|
||||||
goto bail;
|
|
||||||
memset(&ramdump_segments_rh, 0, sizeof(ramdump_segments_rh));
|
memset(&ramdump_segments_rh, 0, sizeof(ramdump_segments_rh));
|
||||||
ramdump_segments_rh.da = match->phys;
|
ramdump_segments_rh.da = match->phys;
|
||||||
ramdump_segments_rh.va = (void *)page_address((struct page *)match->va);
|
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",
|
pr_err("adsprpc: %s: unable to dump heap (err %d)\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
}
|
}
|
||||||
|
if (!match->is_persistent) {
|
||||||
if (!locked)
|
if (!locked)
|
||||||
mutex_lock(&fl->map_mutex);
|
mutex_lock(&fl->map_mutex);
|
||||||
fastrpc_mmap_free(match, 0);
|
fastrpc_mmap_free(match, 0);
|
||||||
if (!locked)
|
if (!locked)
|
||||||
mutex_unlock(&fl->map_mutex);
|
mutex_unlock(&fl->map_mutex);
|
||||||
}
|
}
|
||||||
} while (match);
|
}
|
||||||
|
}
|
||||||
bail:
|
bail:
|
||||||
|
if (lock) {
|
||||||
|
spin_unlock_irqrestore(&me->hlock, irq_flags);
|
||||||
|
lock = 0;
|
||||||
|
}
|
||||||
if (err && match) {
|
if (err && match) {
|
||||||
if (!locked)
|
if (!locked)
|
||||||
mutex_lock(&fl->map_mutex);
|
mutex_lock(&fl->map_mutex);
|
||||||
|
Reference in New Issue
Block a user