Loading drivers/char/adsprpc.c +34 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <linux/msm_ion.h> #include <soc/qcom/smd.h> #include <soc/qcom/subsystem_notif.h> #include <soc/qcom/subsystem_restart.h> #include <linux/scatterlist.h> #include <linux/fs.h> #include <linux/uaccess.h> Loading @@ -44,6 +45,7 @@ #include <soc/qcom/scm.h> #include "adsprpc_compat.h" #include "adsprpc_shared.h" #include <soc/qcom/ramdump.h> #define TZ_PIL_PROTECT_MEM_SUBSYS_ID 0x0C #define TZ_PIL_CLEAR_PROTECT_MEM_SUBSYS_ID 0x0D Loading Loading @@ -153,6 +155,8 @@ struct fastrpc_channel_ctx { int sesscount; int ssrcount; void *handle; int ramdumpenabled; void *remoteheap_ramdump_dev; }; struct fastrpc_apps { Loading Loading @@ -1455,8 +1459,9 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl) { struct fastrpc_mmap *match = 0, *map = NULL; struct hlist_node *n = NULL; int err = 0; int err = 0, ret = 0; struct fastrpc_apps *me = &gfa; struct ramdump_segment *ramdump_segments_rh = NULL; spin_lock(&me->hlock); hlist_for_each_entry_safe(map, n, &me->maps, hn) { Loading @@ -1470,6 +1475,20 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl) VERIFY(err, !fastrpc_munmap_on_dsp_rh(fl, match)); if (err) goto bail; if (me->channel[0].ramdumpenabled) { ramdump_segments_rh = kcalloc(1, sizeof(struct ramdump_segment), GFP_KERNEL); if (ramdump_segments_rh) { ramdump_segments_rh->address = match->phys; ramdump_segments_rh->size = match->size; ret = do_elf_ramdump( me->channel[0].remoteheap_ramdump_dev, ramdump_segments_rh, 1); if (ret < 0) pr_err("ADSPRPC: unable to dump heap"); kfree(ramdump_segments_rh); } } fastrpc_mmap_free(match); } bail: Loading Loading @@ -1755,6 +1774,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, { struct fastrpc_apps *me = &gfa; struct fastrpc_channel_ctx *ctx; struct notif_data *notifdata = data; int cid; ctx = container_of(nb, struct fastrpc_channel_ctx, nb); Loading @@ -1770,6 +1790,11 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, } mutex_unlock(&me->smd_mutex); fastrpc_notify_drivers(me, cid); } else if (code == SUBSYS_RAMDUMP_NOTIFICATION) { if (me->channel[0].remoteheap_ramdump_dev && notifdata->enable_ramdump) { me->channel[0].ramdumpenabled = 1; } } return NOTIFY_DONE; Loading Loading @@ -1941,6 +1966,12 @@ static int fastrpc_probe(struct platform_device *pdev) if (of_device_is_compatible(dev->of_node, "qcom,msm-adsprpc-mem-region")) { me->adsp_mem_device = dev; me->channel[0].remoteheap_ramdump_dev = create_ramdump_device("adsp_rh", dev); if (IS_ERR_OR_NULL(me->channel[0].remoteheap_ramdump_dev)) { pr_err("ADSPRPC: Unable to create adsp-remoteheap ramdump device.\n"); me->channel[0].remoteheap_ramdump_dev = NULL; } return 0; } Loading Loading @@ -2025,6 +2056,8 @@ static int __init fastrpc_device_init(void) if (err) goto device_create_bail; me->channel[i].ssrcount = 0; me->channel[i].ramdumpenabled = 0; me->channel[i].remoteheap_ramdump_dev = 0; me->channel[i].nb.notifier_call = fastrpc_restart_notifier_cb; me->channel[i].handle = subsys_notif_register_notifier( gcinfo[i].subsys, Loading Loading
drivers/char/adsprpc.c +34 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <linux/msm_ion.h> #include <soc/qcom/smd.h> #include <soc/qcom/subsystem_notif.h> #include <soc/qcom/subsystem_restart.h> #include <linux/scatterlist.h> #include <linux/fs.h> #include <linux/uaccess.h> Loading @@ -44,6 +45,7 @@ #include <soc/qcom/scm.h> #include "adsprpc_compat.h" #include "adsprpc_shared.h" #include <soc/qcom/ramdump.h> #define TZ_PIL_PROTECT_MEM_SUBSYS_ID 0x0C #define TZ_PIL_CLEAR_PROTECT_MEM_SUBSYS_ID 0x0D Loading Loading @@ -153,6 +155,8 @@ struct fastrpc_channel_ctx { int sesscount; int ssrcount; void *handle; int ramdumpenabled; void *remoteheap_ramdump_dev; }; struct fastrpc_apps { Loading Loading @@ -1455,8 +1459,9 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl) { struct fastrpc_mmap *match = 0, *map = NULL; struct hlist_node *n = NULL; int err = 0; int err = 0, ret = 0; struct fastrpc_apps *me = &gfa; struct ramdump_segment *ramdump_segments_rh = NULL; spin_lock(&me->hlock); hlist_for_each_entry_safe(map, n, &me->maps, hn) { Loading @@ -1470,6 +1475,20 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl) VERIFY(err, !fastrpc_munmap_on_dsp_rh(fl, match)); if (err) goto bail; if (me->channel[0].ramdumpenabled) { ramdump_segments_rh = kcalloc(1, sizeof(struct ramdump_segment), GFP_KERNEL); if (ramdump_segments_rh) { ramdump_segments_rh->address = match->phys; ramdump_segments_rh->size = match->size; ret = do_elf_ramdump( me->channel[0].remoteheap_ramdump_dev, ramdump_segments_rh, 1); if (ret < 0) pr_err("ADSPRPC: unable to dump heap"); kfree(ramdump_segments_rh); } } fastrpc_mmap_free(match); } bail: Loading Loading @@ -1755,6 +1774,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, { struct fastrpc_apps *me = &gfa; struct fastrpc_channel_ctx *ctx; struct notif_data *notifdata = data; int cid; ctx = container_of(nb, struct fastrpc_channel_ctx, nb); Loading @@ -1770,6 +1790,11 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, } mutex_unlock(&me->smd_mutex); fastrpc_notify_drivers(me, cid); } else if (code == SUBSYS_RAMDUMP_NOTIFICATION) { if (me->channel[0].remoteheap_ramdump_dev && notifdata->enable_ramdump) { me->channel[0].ramdumpenabled = 1; } } return NOTIFY_DONE; Loading Loading @@ -1941,6 +1966,12 @@ static int fastrpc_probe(struct platform_device *pdev) if (of_device_is_compatible(dev->of_node, "qcom,msm-adsprpc-mem-region")) { me->adsp_mem_device = dev; me->channel[0].remoteheap_ramdump_dev = create_ramdump_device("adsp_rh", dev); if (IS_ERR_OR_NULL(me->channel[0].remoteheap_ramdump_dev)) { pr_err("ADSPRPC: Unable to create adsp-remoteheap ramdump device.\n"); me->channel[0].remoteheap_ramdump_dev = NULL; } return 0; } Loading Loading @@ -2025,6 +2056,8 @@ static int __init fastrpc_device_init(void) if (err) goto device_create_bail; me->channel[i].ssrcount = 0; me->channel[i].ramdumpenabled = 0; me->channel[i].remoteheap_ramdump_dev = 0; me->channel[i].nb.notifier_call = fastrpc_restart_notifier_cb; me->channel[i].handle = subsys_notif_register_notifier( gcinfo[i].subsys, Loading