Loading Documentation/devicetree/bindings/qdsp/msm-fastrpc.txt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,7 @@ Optional properties: - qcom,rpc-latency-us: FastRPC QoS latency vote - qcom,rpc-latency-us: FastRPC QoS latency vote - qcom,adsp-remoteheap-vmid: FastRPC remote heap VMID list - qcom,adsp-remoteheap-vmid: FastRPC remote heap VMID list - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,fastrpc-adsp-sensors-pdr: Flag to enable Sensors PDR Optional subnodes: Optional subnodes: - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context Loading @@ -25,12 +26,17 @@ Subnode Required properties: - iommus : A list of phandle and IOMMU specifier pairs that describe the - iommus : A list of phandle and IOMMU specifier pairs that describe the IOMMU master interfaces of the device IOMMU master interfaces of the device Subnode Optional properties: - shared-cb : Present if context bank need to be shared Example: Example: qcom,msm_fastrpc { qcom,msm_fastrpc { compatible = "qcom,msm-fastrpc-adsp"; compatible = "qcom,msm-fastrpc-adsp"; qcom,fastrpc-glink; qcom,fastrpc-glink; qcom,rpc-latency-us = <2343>; qcom,rpc-latency-us = <2343>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,fastrpc-adsp-sensors-pdr; qcom,msm_fastrpc_compute_cb_1 { qcom,msm_fastrpc_compute_cb_1 { compatible = "qcom,msm-fastrpc-compute-cb"; compatible = "qcom,msm-fastrpc-compute-cb"; Loading @@ -41,6 +47,7 @@ Example: compatible = "qcom,msm-fastrpc-compute-cb"; compatible = "qcom,msm-fastrpc-compute-cb"; label = "adsprpc-smd"; label = "adsprpc-smd"; iommus = <&lpass_q6_smmu 9>, iommus = <&lpass_q6_smmu 9>, shared-cb; }; }; }; }; Loading drivers/char/adsprpc.c +70 −21 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,9 @@ #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_ADSP_SERVICE_NAME "avs/audio" #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 RPC_TIMEOUT (5 * HZ) #define BALIGN 128 #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ Loading Loading @@ -120,7 +123,7 @@ static int fastrpc_glink_open(int cid); static int fastrpc_glink_open(int cid); static void fastrpc_glink_close(void *chan, int cid); static void fastrpc_glink_close(void *chan, int cid); static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *nb, static int fastrpc_pdr_notifier_cb(struct notifier_block *nb, unsigned long code, unsigned long code, void *data); void *data); static struct dentry *debugfs_root; static struct dentry *debugfs_root; Loading Loading @@ -230,6 +233,7 @@ struct fastrpc_smmu { int faults; int faults; int secure; int secure; int coherent; int coherent; int sharedcb; }; }; struct fastrpc_session_ctx { struct fastrpc_session_ctx { Loading Loading @@ -366,6 +370,7 @@ struct fastrpc_file { int pd; int pd; char *spdname; char *spdname; int file_close; int file_close; int sharedcb; struct fastrpc_apps *apps; struct fastrpc_apps *apps; struct hlist_head perf; struct hlist_head perf; struct dentry *debugfs_file; struct dentry *debugfs_file; Loading @@ -391,7 +396,13 @@ static struct fastrpc_channel_ctx gcinfo[NUM_CHANNELS] = { .spdname = .spdname = AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = .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 @@ -1760,7 +1771,7 @@ static void fastrpc_smd_read_handler(int cid) if (err) if (err) goto bail; 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)); me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) if (err) goto bail; goto bail; Loading Loading @@ -1956,7 +1967,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl, VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); if (err) if (err) goto bail; 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]; remote_arg_t ra[1]; int tgid = fl->tgid; int tgid = fl->tgid; Loading @@ -1968,7 +1980,12 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.fds = NULL; ioctl.fds = NULL; ioctl.attrs = NULL; ioctl.attrs = NULL; ioctl.crc = NULL; ioctl.crc = NULL; if (init->flags == FASTRPC_INIT_ATTACH) fl->pd = 0; 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, VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) if (err) Loading Loading @@ -2078,6 +2095,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, if (err) if (err) goto bail; goto bail; fl->pd = 1; inbuf.pgid = current->tgid; inbuf.pgid = current->tgid; inbuf.namelen = init->filelen; inbuf.namelen = init->filelen; inbuf.pageslen = 0; inbuf.pageslen = 0; Loading Loading @@ -2541,15 +2559,17 @@ static void fastrpc_channel_close(struct kref *kref) static void fastrpc_context_list_dtor(struct fastrpc_file *fl); static void fastrpc_context_list_dtor(struct fastrpc_file *fl); static int fastrpc_session_alloc_locked(struct fastrpc_channel_ctx *chan, static int fastrpc_session_alloc_locked(struct fastrpc_channel_ctx *chan, int secure, struct fastrpc_session_ctx **session) int secure, int sharedcb, struct fastrpc_session_ctx **session) { { struct fastrpc_apps *me = &gfa; struct fastrpc_apps *me = &gfa; int idx = 0, err = 0; int idx = 0, err = 0; if (chan->sesscount) { if (chan->sesscount) { for (idx = 0; idx < chan->sesscount; ++idx) { for (idx = 0; idx < chan->sesscount; ++idx) { if (!chan->session[idx].used && if ((sharedcb && chan->session[idx].smmu.sharedcb) || chan->session[idx].smmu.secure == secure) { (!chan->session[idx].used && chan->session[idx].smmu.secure == secure && !sharedcb)) { chan->session[idx].used = 1; chan->session[idx].used = 1; break; break; } } Loading Loading @@ -2605,7 +2625,7 @@ static void fastrpc_glink_notify_rx(void *handle, const void *priv, if (err) if (err) goto bail; 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)); me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) if (err) goto bail; goto bail; Loading Loading @@ -2650,7 +2670,7 @@ static int fastrpc_session_alloc(struct fastrpc_channel_ctx *chan, int secure, mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); if (!*session) if (!*session) err = fastrpc_session_alloc_locked(chan, secure, session); err = fastrpc_session_alloc_locked(chan, secure, 0, session); mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); return err; return err; } } Loading Loading @@ -3096,7 +3116,7 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info) fl->cid = cid; fl->cid = cid; fl->ssrcount = fl->apps->channel[cid].ssrcount; fl->ssrcount = fl->apps->channel[cid].ssrcount; VERIFY(err, !fastrpc_session_alloc_locked( VERIFY(err, !fastrpc_session_alloc_locked( &fl->apps->channel[cid], 0, &fl->sctx)); &fl->apps->channel[cid], 0, fl->sharedcb, &fl->sctx)); if (err) if (err) goto bail; goto bail; } } Loading Loading @@ -3135,6 +3155,9 @@ static int fastrpc_internal_control(struct fastrpc_file *fl, } else } else pm_qos_update_request(&fl->pm_qos_req, latency); pm_qos_update_request(&fl->pm_qos_req, latency); break; break; case FASTRPC_CONTROL_SMMU: fl->sharedcb = cp->smmu.sharedcb; break; default: default: err = -ENOTTY; err = -ENOTTY; break; break; Loading Loading @@ -3375,7 +3398,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, return NOTIFY_DONE; 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, unsigned long code, void *data) void *data) { { Loading Loading @@ -3412,7 +3435,7 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, { { struct fastrpc_static_pd *spd; struct fastrpc_static_pd *spd; struct pd_qmi_client_data *pdr = data; 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); spd = container_of(nb, struct fastrpc_static_pd, get_service_nb); if (opcode == LOCATOR_DOWN) { if (opcode == LOCATOR_DOWN) { Loading @@ -3420,15 +3443,21 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, return NOTIFY_DONE; return NOTIFY_DONE; } } if (pdr->total_domains == 1) { for (i = 0; i < pdr->total_domains; i++) { spd->pdrhandle = service_notif_register_notifier( if ((!strcmp(pdr->domain_list[i].name, pdr->domain_list[0].name, "msm/adsp/audio_pd")) || pdr->domain_list[0].instance_id, (!strcmp(pdr->domain_list[i].name, "msm/adsp/sensor_pd"))) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[i].name, pdr->domain_list[i].instance_id, &spd->pdrnb, &curr_state); &spd->pdrnb, &curr_state); if (IS_ERR(spd->pdrhandle)) if (IS_ERR(spd->pdrhandle)) pr_err("ADSPRPC: Unable to register notifier\n"); pr_err("ADSPRPC: Unable to register notifier\n"); } else break; pr_err("ADSPRPC: Service returned invalid domains\n"); } } return NOTIFY_DONE; return NOTIFY_DONE; } } Loading Loading @@ -3487,6 +3516,8 @@ static int fastrpc_cb_probe(struct device *dev) sess->used = 0; sess->used = 0; sess->smmu.coherent = of_property_read_bool(dev->of_node, sess->smmu.coherent = of_property_read_bool(dev->of_node, "dma-coherent"); "dma-coherent"); sess->smmu.sharedcb = of_property_read_bool(dev->of_node, "shared-cb"); sess->smmu.secure = of_property_read_bool(dev->of_node, sess->smmu.secure = of_property_read_bool(dev->of_node, "qcom,secure-context-bank"); "qcom,secure-context-bank"); if (sess->smmu.secure) if (sess->smmu.secure) Loading Loading @@ -3726,6 +3757,24 @@ static int fastrpc_probe(struct platform_device *pdev) pr_err("ADSPRPC: Get service location failed: %d\n", pr_err("ADSPRPC: Get service location failed: %d\n", ret); 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: spdbail: err = 0; err = 0; VERIFY(err, !of_platform_populate(pdev->dev.of_node, VERIFY(err, !of_platform_populate(pdev->dev.of_node, Loading drivers/char/adsprpc_shared.h +6 −1 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,7 @@ #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_ATTACH_SENSORS 3 /* Retrives number of input buffers from the scalars parameter */ /* Retrives number of input buffers from the scalars parameter */ #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) Loading Loading @@ -229,11 +230,15 @@ struct fastrpc_ctrl_latency { uint32_t enable; //!latency control enable uint32_t enable; //!latency control enable uint32_t level; //!level of control uint32_t level; //!level of control }; }; #define FASTRPC_CONTROL_SMMU (2) struct fastrpc_ctrl_smmu { uint32_t sharedcb; }; struct fastrpc_ioctl_control { struct fastrpc_ioctl_control { uint32_t req; uint32_t req; union { union { struct fastrpc_ctrl_latency lp; struct fastrpc_ctrl_latency lp; struct fastrpc_ctrl_smmu smmu; }; }; }; }; Loading Loading
Documentation/devicetree/bindings/qdsp/msm-fastrpc.txt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,7 @@ Optional properties: - qcom,rpc-latency-us: FastRPC QoS latency vote - qcom,rpc-latency-us: FastRPC QoS latency vote - qcom,adsp-remoteheap-vmid: FastRPC remote heap VMID list - qcom,adsp-remoteheap-vmid: FastRPC remote heap VMID list - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,fastrpc-adsp-audio-pdr: Flag to enable ADSP Audio PDR - qcom,fastrpc-adsp-sensors-pdr: Flag to enable Sensors PDR Optional subnodes: Optional subnodes: - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context - qcom,msm_fastrpc_compute_cb : Child nodes representing the compute context Loading @@ -25,12 +26,17 @@ Subnode Required properties: - iommus : A list of phandle and IOMMU specifier pairs that describe the - iommus : A list of phandle and IOMMU specifier pairs that describe the IOMMU master interfaces of the device IOMMU master interfaces of the device Subnode Optional properties: - shared-cb : Present if context bank need to be shared Example: Example: qcom,msm_fastrpc { qcom,msm_fastrpc { compatible = "qcom,msm-fastrpc-adsp"; compatible = "qcom,msm-fastrpc-adsp"; qcom,fastrpc-glink; qcom,fastrpc-glink; qcom,rpc-latency-us = <2343>; qcom,rpc-latency-us = <2343>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,adsp-remoteheap-vmid = <22 37>; qcom,fastrpc-adsp-sensors-pdr; qcom,msm_fastrpc_compute_cb_1 { qcom,msm_fastrpc_compute_cb_1 { compatible = "qcom,msm-fastrpc-compute-cb"; compatible = "qcom,msm-fastrpc-compute-cb"; Loading @@ -41,6 +47,7 @@ Example: compatible = "qcom,msm-fastrpc-compute-cb"; compatible = "qcom,msm-fastrpc-compute-cb"; label = "adsprpc-smd"; label = "adsprpc-smd"; iommus = <&lpass_q6_smmu 9>, iommus = <&lpass_q6_smmu 9>, shared-cb; }; }; }; }; Loading
drivers/char/adsprpc.c +70 −21 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,9 @@ #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsprpc" #define AUDIO_PDR_ADSP_SERVICE_NAME "avs/audio" #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 RPC_TIMEOUT (5 * HZ) #define BALIGN 128 #define BALIGN 128 #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ #define NUM_CHANNELS 4 /* adsp, mdsp, slpi, cdsp*/ Loading Loading @@ -120,7 +123,7 @@ static int fastrpc_glink_open(int cid); static int fastrpc_glink_open(int cid); static void fastrpc_glink_close(void *chan, int cid); static void fastrpc_glink_close(void *chan, int cid); static int fastrpc_audio_pdr_notifier_cb(struct notifier_block *nb, static int fastrpc_pdr_notifier_cb(struct notifier_block *nb, unsigned long code, unsigned long code, void *data); void *data); static struct dentry *debugfs_root; static struct dentry *debugfs_root; Loading Loading @@ -230,6 +233,7 @@ struct fastrpc_smmu { int faults; int faults; int secure; int secure; int coherent; int coherent; int sharedcb; }; }; struct fastrpc_session_ctx { struct fastrpc_session_ctx { Loading Loading @@ -366,6 +370,7 @@ struct fastrpc_file { int pd; int pd; char *spdname; char *spdname; int file_close; int file_close; int sharedcb; struct fastrpc_apps *apps; struct fastrpc_apps *apps; struct hlist_head perf; struct hlist_head perf; struct dentry *debugfs_file; struct dentry *debugfs_file; Loading @@ -391,7 +396,13 @@ static struct fastrpc_channel_ctx gcinfo[NUM_CHANNELS] = { .spdname = .spdname = AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, .pdrnb.notifier_call = .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 @@ -1760,7 +1771,7 @@ static void fastrpc_smd_read_handler(int cid) if (err) if (err) goto bail; 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)); me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) if (err) goto bail; goto bail; Loading Loading @@ -1956,7 +1967,8 @@ static int fastrpc_init_process(struct fastrpc_file *fl, VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); VERIFY(err, 0 == (err = fastrpc_channel_open(fl))); if (err) if (err) goto bail; 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]; remote_arg_t ra[1]; int tgid = fl->tgid; int tgid = fl->tgid; Loading @@ -1968,7 +1980,12 @@ static int fastrpc_init_process(struct fastrpc_file *fl, ioctl.fds = NULL; ioctl.fds = NULL; ioctl.attrs = NULL; ioctl.attrs = NULL; ioctl.crc = NULL; ioctl.crc = NULL; if (init->flags == FASTRPC_INIT_ATTACH) fl->pd = 0; 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, VERIFY(err, !(err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err) if (err) Loading Loading @@ -2078,6 +2095,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, if (err) if (err) goto bail; goto bail; fl->pd = 1; inbuf.pgid = current->tgid; inbuf.pgid = current->tgid; inbuf.namelen = init->filelen; inbuf.namelen = init->filelen; inbuf.pageslen = 0; inbuf.pageslen = 0; Loading Loading @@ -2541,15 +2559,17 @@ static void fastrpc_channel_close(struct kref *kref) static void fastrpc_context_list_dtor(struct fastrpc_file *fl); static void fastrpc_context_list_dtor(struct fastrpc_file *fl); static int fastrpc_session_alloc_locked(struct fastrpc_channel_ctx *chan, static int fastrpc_session_alloc_locked(struct fastrpc_channel_ctx *chan, int secure, struct fastrpc_session_ctx **session) int secure, int sharedcb, struct fastrpc_session_ctx **session) { { struct fastrpc_apps *me = &gfa; struct fastrpc_apps *me = &gfa; int idx = 0, err = 0; int idx = 0, err = 0; if (chan->sesscount) { if (chan->sesscount) { for (idx = 0; idx < chan->sesscount; ++idx) { for (idx = 0; idx < chan->sesscount; ++idx) { if (!chan->session[idx].used && if ((sharedcb && chan->session[idx].smmu.sharedcb) || chan->session[idx].smmu.secure == secure) { (!chan->session[idx].used && chan->session[idx].smmu.secure == secure && !sharedcb)) { chan->session[idx].used = 1; chan->session[idx].used = 1; break; break; } } Loading Loading @@ -2605,7 +2625,7 @@ static void fastrpc_glink_notify_rx(void *handle, const void *priv, if (err) if (err) goto bail; 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)); me->ctxtable[index]->magic == FASTRPC_CTX_MAGIC)); if (err) if (err) goto bail; goto bail; Loading Loading @@ -2650,7 +2670,7 @@ static int fastrpc_session_alloc(struct fastrpc_channel_ctx *chan, int secure, mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); if (!*session) if (!*session) err = fastrpc_session_alloc_locked(chan, secure, session); err = fastrpc_session_alloc_locked(chan, secure, 0, session); mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); return err; return err; } } Loading Loading @@ -3096,7 +3116,7 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info) fl->cid = cid; fl->cid = cid; fl->ssrcount = fl->apps->channel[cid].ssrcount; fl->ssrcount = fl->apps->channel[cid].ssrcount; VERIFY(err, !fastrpc_session_alloc_locked( VERIFY(err, !fastrpc_session_alloc_locked( &fl->apps->channel[cid], 0, &fl->sctx)); &fl->apps->channel[cid], 0, fl->sharedcb, &fl->sctx)); if (err) if (err) goto bail; goto bail; } } Loading Loading @@ -3135,6 +3155,9 @@ static int fastrpc_internal_control(struct fastrpc_file *fl, } else } else pm_qos_update_request(&fl->pm_qos_req, latency); pm_qos_update_request(&fl->pm_qos_req, latency); break; break; case FASTRPC_CONTROL_SMMU: fl->sharedcb = cp->smmu.sharedcb; break; default: default: err = -ENOTTY; err = -ENOTTY; break; break; Loading Loading @@ -3375,7 +3398,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb, return NOTIFY_DONE; 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, unsigned long code, void *data) void *data) { { Loading Loading @@ -3412,7 +3435,7 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, { { struct fastrpc_static_pd *spd; struct fastrpc_static_pd *spd; struct pd_qmi_client_data *pdr = data; 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); spd = container_of(nb, struct fastrpc_static_pd, get_service_nb); if (opcode == LOCATOR_DOWN) { if (opcode == LOCATOR_DOWN) { Loading @@ -3420,15 +3443,21 @@ static int fastrpc_get_service_location_notify(struct notifier_block *nb, return NOTIFY_DONE; return NOTIFY_DONE; } } if (pdr->total_domains == 1) { for (i = 0; i < pdr->total_domains; i++) { spd->pdrhandle = service_notif_register_notifier( if ((!strcmp(pdr->domain_list[i].name, pdr->domain_list[0].name, "msm/adsp/audio_pd")) || pdr->domain_list[0].instance_id, (!strcmp(pdr->domain_list[i].name, "msm/adsp/sensor_pd"))) { spd->pdrhandle = service_notif_register_notifier( pdr->domain_list[i].name, pdr->domain_list[i].instance_id, &spd->pdrnb, &curr_state); &spd->pdrnb, &curr_state); if (IS_ERR(spd->pdrhandle)) if (IS_ERR(spd->pdrhandle)) pr_err("ADSPRPC: Unable to register notifier\n"); pr_err("ADSPRPC: Unable to register notifier\n"); } else break; pr_err("ADSPRPC: Service returned invalid domains\n"); } } return NOTIFY_DONE; return NOTIFY_DONE; } } Loading Loading @@ -3487,6 +3516,8 @@ static int fastrpc_cb_probe(struct device *dev) sess->used = 0; sess->used = 0; sess->smmu.coherent = of_property_read_bool(dev->of_node, sess->smmu.coherent = of_property_read_bool(dev->of_node, "dma-coherent"); "dma-coherent"); sess->smmu.sharedcb = of_property_read_bool(dev->of_node, "shared-cb"); sess->smmu.secure = of_property_read_bool(dev->of_node, sess->smmu.secure = of_property_read_bool(dev->of_node, "qcom,secure-context-bank"); "qcom,secure-context-bank"); if (sess->smmu.secure) if (sess->smmu.secure) Loading Loading @@ -3726,6 +3757,24 @@ static int fastrpc_probe(struct platform_device *pdev) pr_err("ADSPRPC: Get service location failed: %d\n", pr_err("ADSPRPC: Get service location failed: %d\n", ret); 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: spdbail: err = 0; err = 0; VERIFY(err, !of_platform_populate(pdev->dev.of_node, VERIFY(err, !of_platform_populate(pdev->dev.of_node, Loading
drivers/char/adsprpc_shared.h +6 −1 Original line number Original line Diff line number Diff line Loading @@ -66,6 +66,7 @@ #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_ATTACH 0 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE 1 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_CREATE_STATIC 2 #define FASTRPC_INIT_ATTACH_SENSORS 3 /* Retrives number of input buffers from the scalars parameter */ /* Retrives number of input buffers from the scalars parameter */ #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) Loading Loading @@ -229,11 +230,15 @@ struct fastrpc_ctrl_latency { uint32_t enable; //!latency control enable uint32_t enable; //!latency control enable uint32_t level; //!level of control uint32_t level; //!level of control }; }; #define FASTRPC_CONTROL_SMMU (2) struct fastrpc_ctrl_smmu { uint32_t sharedcb; }; struct fastrpc_ioctl_control { struct fastrpc_ioctl_control { uint32_t req; uint32_t req; union { union { struct fastrpc_ctrl_latency lp; struct fastrpc_ctrl_latency lp; struct fastrpc_ctrl_smmu smmu; }; }; }; }; Loading