Merge "ADSPRPC: Enable ram dumps collection"

This commit is contained in:
qctecmdr 2020-12-08 19:20:03 -08:00 • committed by Gerrit - the friendly Code Review server
commit 46ce41b9e4

View file

@ -531,6 +531,8 @@ struct fastrpc_apps {
uint32_t duplicate_rsp_err_cnt;
struct qos_cores silvercores;
uint32_t max_size_limit;
void *ramdump_handle;
bool enable_ramdump;
};
struct fastrpc_mmap {
@ -4345,7 +4347,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl)
match->size, match->flags);
if (err)
goto bail;
if (me->channel[RH_CID].ramdumpenabled) {
if (me->ramdump_handle && me->enable_ramdump) {
ramdump_segments_rh = kcalloc(1,
sizeof(struct ramdump_segment), GFP_KERNEL);
if (ramdump_segments_rh) {
@ -4353,8 +4355,8 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl)
match->phys;
ramdump_segments_rh->size = match->size;
ret = do_elf_ramdump(
me->channel[RH_CID].rh_dump_dev,
ramdump_segments_rh, 1);
me->ramdump_handle,
ramdump_segments_rh, 1);
if (ret < 0)
pr_err("adsprpc: %s: unable to dump heap (err %d)\n",
__func__, ret);
@ -4364,6 +4366,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl)
fastrpc_mmap_free(match, 0);
}
} while (match);
me->enable_ramdump = false;
bail:
if (err && match)
fastrpc_mmap_add(match);
@ -5985,13 +5988,19 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
mutex_unlock(&me->channel[cid].smd_mutex);
} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
if (cid == RH_CID) {
if (me->channel[RH_CID].rh_dump_dev &&
notifdata->enable_ramdump) {
if (me->ramdump_handle)
me->channel[RH_CID].ramdumpenabled = 1;
}
}
pr_info("adsprpc: %s: received RAMDUMP notification for %s\n",
__func__, gcinfo[cid].subsys);
} else if (code == SUBSYS_BEFORE_POWERUP) {
if (cid == RH_CID && notifdata->enable_ramdump) {
if (me->ramdump_handle && me->channel[RH_CID]
.ramdumpenabled) {
me->enable_ramdump = true;
me->channel[RH_CID].ramdumpenabled = 0;
}
}
} else if (code == SUBSYS_AFTER_POWERUP) {
pr_info("adsprpc: %s: %s subsystem is up\n",
__func__, gcinfo[cid].subsys);
@ -6023,14 +6032,19 @@ static int fastrpc_pdr_notifier_cb(struct notifier_block *pdrnb,
fastrpc_notify_pdr_drivers(me, spd->servloc_name);
} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
if (spd->cid == RH_CID) {
if (me->channel[RH_CID].rh_dump_dev &&
notifdata->enable_ramdump) {
if (spd->cid == RH_CID && me->ramdump_handle)
me->channel[RH_CID].ramdumpenabled = 1;
}
}
pr_info("adsprpc: %s: received %s RAMDUMP notification for %s (%s)\n",
__func__, gcinfo[spd->cid].subsys,
spd->spdname, spd->servloc_name);
} else if (code == SUBSYS_BEFORE_POWERUP) {
if (spd->cid == RH_CID && notifdata->enable_ramdump) {
if (me->ramdump_handle && me->channel[RH_CID]
.ramdumpenabled)
me->enable_ramdump = true;
me->channel[RH_CID].ramdumpenabled = 0;
}
} else if (code == SERVREG_NOTIF_SERVICE_STATE_UP_V01) {
pr_info("adsprpc: %s: %s (%s) is up on %s\n",
__func__, spd->spdname, spd->servloc_name,
@ -6431,6 +6445,7 @@ static int fastrpc_probe(struct platform_device *pdev)
pr_warn("adsprpc: Error: %s: initialization of memory region adsp_mem failed with %d\n",
__func__, ret);
}
me->ramdump_handle = create_ramdump_device("adsp_rh", &pdev->dev);
goto bail;
}
me->legacy_remote_heap = of_property_read_bool(dev->of_node,