Loading Documentation/devicetree/bindings/qdsp/msm-fastrpc.txt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ Optional properties: - qcom,fastrpc-legacy-remote-heap : Bool indicating hypervisor is not supported. - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,secure-domains: FastRPC secure domain configuration - qcom,fastrpc-adsp-sensors-pdr: Flag to enable Sensors PDR Optional subnodes: - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context Loading @@ -38,6 +39,7 @@ Example: qcom,fastrpc-rpmsg; qcom,rpc-latency-us = <2343>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,fastrpc-adsp-sensors-pdr; qcom,msm_fastrpc_rpmsg { compatible = "qcom,msm-fastrpc-rpmsg"; Loading drivers/char/adsprpc.c +73 −17 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_ADSP_SERVICE_NAME "avs/audio" #define SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME "sensors_pdr_adsprpc" #define SENSORS_PDR_ADSP_SERVICE_NAME "tms/servreg" #define RPC_TIMEOUT (5 * HZ) #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ Loading Loading @@ -122,7 +125,7 @@ (int64_t *)(perf_ptr + offset)\ : (int64_t *)NULL) : (int64_t *)NULL) static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *nb, static int fastrpc_pdr_notifier_cb(struct notifier_block *nb, unsigned long code, void *data); static struct dentry *debugfs_root; Loading Loading @@ -382,7 +385,13 @@ static struct fastrpc_channel_ctx gcinfo[NUM_CHANNELS] = { .spdname = AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = fastrpc_audio_pdr_notifier_cb, fastrpc_pdr_notifier_cb, }, { .spdname = SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = fastrpc_pdr_notifier_cb, } }, }, Loading Loading @@ -1848,7 +1857,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl, VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); if (err) goto bail; if (init->flags == FASTRPC_INIT_ATTACH) { if (init->flags == FASTRPC_INIT_ATTACH || init->flags == FASTRPC_INIT_ATTACH_SENSORS) { remote_arg_t ra[1]; int tgid = fl->tgid; Loading @@ -1860,7 +1870,12 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.fds = NULL; ioctl.attrs = NULL; ioctl.crc = NULL; if (init->flags == FASTRPC_INIT_ATTACH) fl->pd = 0; else if (init->flags == FASTRPC_INIT_ATTACH_SENSORS) { fl->spdname = SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME; fl->pd = 2; } VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) Loading Loading @@ -1970,6 +1985,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, if (err) goto bail; fl->pd = 1; inbuf.pgid = current->tgid; inbuf.namelen = init->filelen; inbuf.pageslen = 0; Loading Loading @@ -2547,7 +2563,7 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data, if (err) goto bail; VERIFY(err, ((me->ctxtable[index]->ctxid == (rsp->ctx & ~1)) && VERIFY(err, ((me->ctxtable[index]->ctxid == (rsp->ctx & ~3)) && me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) goto bail; Loading Loading @@ -3199,7 +3215,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, return NOTIFY_DONE; } static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *pdrnb, static int fastrpc_pdr_notifier_cb(struct notifier_block *pdrnb, unsigned long code, void *data) { Loading Loading @@ -3236,24 +3252,46 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, { struct fastrpc_static_pd *spd; struct pd_qmi_client_data *pdr = data; int curr_state = 0; int curr_state = 0, i = 0; spd = container_of(nb, struct fastrpc_static_pd, get_service_nb); if (opcode == LOCATOR_DOWN) { pr_err("ADSPRPC: Audio PD restart notifier locator down\n"); return NOTIFY_DONE; } for (i = 0; i < pdr->total_domains; i++) { if ((!strcmp(spd->spdname, "audio_pdr_adsprpc")) && (!strcmp(pdr->domain_list[i].name, "msm/adsp/audio_pd"))) { goto pdr_register; } else if ((!strcmp(spd->spdname, "sensors_pdr_adsprpc")) && (!strcmp(pdr->domain_list[i].name, "msm/adsp/sensor_pd"))) { goto pdr_register; } } return NOTIFY_DONE; if (pdr->total_domains == 1) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[0].name, pdr->domain_list[0].instance_id, pdr_register: if (!spd->pdrhandle) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[i].name, pdr->domain_list[i].instance_id, &spd->pdrnb, &curr_state); } else { pr_err("ADSPRPC: %s is already registered\n", spd->spdname); } if (IS_ERR(spd->pdrhandle)) pr_err("ADSPRPC: Unable to register notifier\n"); } else pr_err("ADSPRPC: Service returned invalid domains\n"); if (curr_state == SERVREG_NOTIF_SERVICE_STATE_UP_V01) { pr_info("ADSPRPC: %s is up\n", spd->spdname); spd->ispdup = 1; } else if (curr_state == SERVREG_NOTIF_SERVICE_STATE_UNINIT_V01) { pr_info("ADSPRPC: %s is uninitialzed\n", spd->spdname); } return NOTIFY_DONE; } Loading Loading @@ -3530,6 +3568,24 @@ static int fastrpc_probe(struct platform_device *pdev) pr_err("ADSPRPC: Get service location failed: %d\n", ret); } if (of_property_read_bool(dev->of_node, "qcom,fastrpc-adsp-sensors-pdr")) { int session; VERIFY(err, !fastrpc_get_adsp_session( SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, &session)); if (err) goto spdbail; me->channel[0].spd[session].get_service_nb.notifier_call = fastrpc_get_service_location_notify; ret = get_service_location( SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, SENSORS_PDR_ADSP_SERVICE_NAME, &me->channel[0].spd[session].get_service_nb); if (ret) pr_err("ADSPRPC: Get service location failed: %d\n", ret); } spdbail: err = 0; VERIFY(err, !of_platform_populate(pdev->dev.of_node, Loading drivers/char/adsprpc_shared.h +2 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_ATTACH_SENSORS 3 /* Retrives number of input buffers from the scalars parameter */ #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) Loading Loading @@ -245,7 +246,7 @@ struct fastrpc_ctrl_latency { uint32_t enable; //!latency control enable uint32_t level; //!level of control }; /* FASTRPC_CONTROL value 2 is reserved in user space */ struct fastrpc_ioctl_control { uint32_t req; union { Loading Loading
Documentation/devicetree/bindings/qdsp/msm-fastrpc.txt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ Optional properties: - qcom,fastrpc-legacy-remote-heap : Bool indicating hypervisor is not supported. - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,secure-domains: FastRPC secure domain configuration - qcom,fastrpc-adsp-sensors-pdr: Flag to enable Sensors PDR Optional subnodes: - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context Loading @@ -38,6 +39,7 @@ Example: qcom,fastrpc-rpmsg; qcom,rpc-latency-us = <2343>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,fastrpc-adsp-sensors-pdr; qcom,msm_fastrpc_rpmsg { compatible = "qcom,msm-fastrpc-rpmsg"; Loading
drivers/char/adsprpc.c +73 −17 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_ADSP_SERVICE_NAME "avs/audio" #define SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME "sensors_pdr_adsprpc" #define SENSORS_PDR_ADSP_SERVICE_NAME "tms/servreg" #define RPC_TIMEOUT (5 * HZ) #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ Loading Loading @@ -122,7 +125,7 @@ (int64_t *)(perf_ptr + offset)\ : (int64_t *)NULL) : (int64_t *)NULL) static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *nb, static int fastrpc_pdr_notifier_cb(struct notifier_block *nb, unsigned long code, void *data); static struct dentry *debugfs_root; Loading Loading @@ -382,7 +385,13 @@ static struct fastrpc_channel_ctx gcinfo[NUM_CHANNELS] = { .spdname = AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = fastrpc_audio_pdr_notifier_cb, fastrpc_pdr_notifier_cb, }, { .spdname = SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = fastrpc_pdr_notifier_cb, } }, }, Loading Loading @@ -1848,7 +1857,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl, VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); if (err) goto bail; if (init->flags == FASTRPC_INIT_ATTACH) { if (init->flags == FASTRPC_INIT_ATTACH || init->flags == FASTRPC_INIT_ATTACH_SENSORS) { remote_arg_t ra[1]; int tgid = fl->tgid; Loading @@ -1860,7 +1870,12 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.fds = NULL; ioctl.attrs = NULL; ioctl.crc = NULL; if (init->flags == FASTRPC_INIT_ATTACH) fl->pd = 0; else if (init->flags == FASTRPC_INIT_ATTACH_SENSORS) { fl->spdname = SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME; fl->pd = 2; } VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) Loading Loading @@ -1970,6 +1985,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, if (err) goto bail; fl->pd = 1; inbuf.pgid = current->tgid; inbuf.namelen = init->filelen; inbuf.pageslen = 0; Loading Loading @@ -2547,7 +2563,7 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data, if (err) goto bail; VERIFY(err, ((me->ctxtable[index]->ctxid == (rsp->ctx & ~1)) && VERIFY(err, ((me->ctxtable[index]->ctxid == (rsp->ctx & ~3)) && me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) goto bail; Loading Loading @@ -3199,7 +3215,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, return NOTIFY_DONE; } static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *pdrnb, static int fastrpc_pdr_notifier_cb(struct notifier_block *pdrnb, unsigned long code, void *data) { Loading Loading @@ -3236,24 +3252,46 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, { struct fastrpc_static_pd *spd; struct pd_qmi_client_data *pdr = data; int curr_state = 0; int curr_state = 0, i = 0; spd = container_of(nb, struct fastrpc_static_pd, get_service_nb); if (opcode == LOCATOR_DOWN) { pr_err("ADSPRPC: Audio PD restart notifier locator down\n"); return NOTIFY_DONE; } for (i = 0; i < pdr->total_domains; i++) { if ((!strcmp(spd->spdname, "audio_pdr_adsprpc")) && (!strcmp(pdr->domain_list[i].name, "msm/adsp/audio_pd"))) { goto pdr_register; } else if ((!strcmp(spd->spdname, "sensors_pdr_adsprpc")) && (!strcmp(pdr->domain_list[i].name, "msm/adsp/sensor_pd"))) { goto pdr_register; } } return NOTIFY_DONE; if (pdr->total_domains == 1) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[0].name, pdr->domain_list[0].instance_id, pdr_register: if (!spd->pdrhandle) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[i].name, pdr->domain_list[i].instance_id, &spd->pdrnb, &curr_state); } else { pr_err("ADSPRPC: %s is already registered\n", spd->spdname); } if (IS_ERR(spd->pdrhandle)) pr_err("ADSPRPC: Unable to register notifier\n"); } else pr_err("ADSPRPC: Service returned invalid domains\n"); if (curr_state == SERVREG_NOTIF_SERVICE_STATE_UP_V01) { pr_info("ADSPRPC: %s is up\n", spd->spdname); spd->ispdup = 1; } else if (curr_state == SERVREG_NOTIF_SERVICE_STATE_UNINIT_V01) { pr_info("ADSPRPC: %s is uninitialzed\n", spd->spdname); } return NOTIFY_DONE; } Loading Loading @@ -3530,6 +3568,24 @@ static int fastrpc_probe(struct platform_device *pdev) pr_err("ADSPRPC: Get service location failed: %d\n", ret); } if (of_property_read_bool(dev->of_node, "qcom,fastrpc-adsp-sensors-pdr")) { int session; VERIFY(err, !fastrpc_get_adsp_session( SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, &session)); if (err) goto spdbail; me->channel[0].spd[session].get_service_nb.notifier_call = fastrpc_get_service_location_notify; ret = get_service_location( SENSORS_PDR_SERVICE_LOCATION_CLIENT_NAME, SENSORS_PDR_ADSP_SERVICE_NAME, &me->channel[0].spd[session].get_service_nb); if (ret) pr_err("ADSPRPC: Get service location failed: %d\n", ret); } spdbail: err = 0; VERIFY(err, !of_platform_populate(pdev->dev.of_node, Loading
drivers/char/adsprpc_shared.h +2 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_ATTACH_SENSORS 3 /* Retrives number of input buffers from the scalars parameter */ #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) Loading Loading @@ -245,7 +246,7 @@ struct fastrpc_ctrl_latency { uint32_t enable; //!latency control enable uint32_t level; //!level of control }; /* FASTRPC_CONTROL value 2 is reserved in user space */ struct fastrpc_ioctl_control { uint32_t req; union { Loading