Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70413124 authored by Jeya R's avatar Jeya R Committed by Vamsi krishna Gattupalli
Browse files

ADSPRPC: Enable ram dumps collection



Enabled ram dump collection for CMA memory
that is used for remote heap and dynamic loading memory.

Change-Id: I07fe071ee90b39204822aee368b52b7e63b5600d
Acked-by: default avatarKrishnaiah Tadakamalla <ktadakam@qti.qualcomm.com>
Signed-off-by: default avatarJeya R <jeyr@codeaurora.org>
Signed-off-by: default avatarVamsi krishna Gattupalli <vgattupa@codeaurora.org>
parent d1d92738
Loading
Loading
Loading
Loading
+24 −9
Original line number Diff line number Diff line
@@ -500,6 +500,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 {
@@ -4270,7 +4272,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) {
@@ -4278,7 +4280,7 @@ 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,
						 me->ramdump_handle,
							 ramdump_segments_rh, 1);
					if (ret < 0)
						pr_err("adsprpc: %s: unable to dump heap (err %d)\n",
@@ -4289,6 +4291,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);
@@ -5976,13 +5979,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);
@@ -6014,14 +6023,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,
@@ -6422,6 +6436,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,