Lines Matching refs:cons
72 ivpu_ipc_tx_prepare(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, in ivpu_ipc_tx_prepare() argument
107 tx_buf->ipc.channel = cons->channel; in ivpu_ipc_tx_prepare()
117 cons->request_id = req->request_id; in ivpu_ipc_tx_prepare()
120 cons->tx_vpu_addr = tx_buf_vpu_addr; in ivpu_ipc_tx_prepare()
142 ivpu_ipc_consumer_add(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, u32 channel) in ivpu_ipc_consumer_add() argument
146 INIT_LIST_HEAD(&cons->link); in ivpu_ipc_consumer_add()
147 cons->channel = channel; in ivpu_ipc_consumer_add()
148 cons->tx_vpu_addr = 0; in ivpu_ipc_consumer_add()
149 cons->request_id = 0; in ivpu_ipc_consumer_add()
150 spin_lock_init(&cons->rx_msg_lock); in ivpu_ipc_consumer_add()
151 INIT_LIST_HEAD(&cons->rx_msg_list); in ivpu_ipc_consumer_add()
152 init_waitqueue_head(&cons->rx_msg_wq); in ivpu_ipc_consumer_add()
155 list_add_tail(&cons->link, &ipc->cons_list); in ivpu_ipc_consumer_add()
159 void ivpu_ipc_consumer_del(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons) in ivpu_ipc_consumer_del() argument
165 list_del(&cons->link); in ivpu_ipc_consumer_del()
168 spin_lock_irq(&cons->rx_msg_lock); in ivpu_ipc_consumer_del()
169 list_for_each_entry_safe(rx_msg, r, &cons->rx_msg_list, link) { in ivpu_ipc_consumer_del()
175 spin_unlock_irq(&cons->rx_msg_lock); in ivpu_ipc_consumer_del()
177 ivpu_ipc_tx_release(vdev, cons->tx_vpu_addr); in ivpu_ipc_consumer_del()
181 ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, struct vpu_jsm_msg *req) in ivpu_ipc_send() argument
193 ret = ivpu_ipc_tx_prepare(vdev, cons, req); in ivpu_ipc_send()
197 ivpu_ipc_tx(vdev, cons->tx_vpu_addr); in ivpu_ipc_send()
204 int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, in ivpu_ipc_receive() argument
212 wait_ret = wait_event_timeout(cons->rx_msg_wq, in ivpu_ipc_receive()
214 !list_empty(&cons->rx_msg_list), in ivpu_ipc_receive()
223 spin_lock_irq(&cons->rx_msg_lock); in ivpu_ipc_receive()
224 rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link); in ivpu_ipc_receive()
226 spin_unlock_irq(&cons->rx_msg_lock); in ivpu_ipc_receive()
230 spin_unlock_irq(&cons->rx_msg_lock); in ivpu_ipc_receive()
259 struct ivpu_ipc_consumer cons; in ivpu_ipc_send_receive_internal() local
262 ivpu_ipc_consumer_add(vdev, &cons, channel); in ivpu_ipc_send_receive_internal()
264 ret = ivpu_ipc_send(vdev, &cons, req); in ivpu_ipc_send_receive_internal()
270 ret = ivpu_ipc_receive(vdev, &cons, NULL, resp, timeout_ms); in ivpu_ipc_send_receive_internal()
282 ivpu_ipc_consumer_del(vdev, &cons); in ivpu_ipc_send_receive_internal()
318 ivpu_ipc_match_consumer(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, in ivpu_ipc_match_consumer() argument
321 if (cons->channel != ipc_hdr->channel) in ivpu_ipc_match_consumer()
324 if (!jsm_msg || jsm_msg->request_id == cons->request_id) in ivpu_ipc_match_consumer()
331 ivpu_ipc_dispatch(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, in ivpu_ipc_dispatch() argument
351 spin_lock_irqsave(&cons->rx_msg_lock, flags); in ivpu_ipc_dispatch()
352 list_add_tail(&rx_msg->link, &cons->rx_msg_list); in ivpu_ipc_dispatch()
353 spin_unlock_irqrestore(&cons->rx_msg_lock, flags); in ivpu_ipc_dispatch()
355 wake_up(&cons->rx_msg_wq); in ivpu_ipc_dispatch()
361 struct ivpu_ipc_consumer *cons; in ivpu_ipc_irq_handler() local
405 list_for_each_entry(cons, &ipc->cons_list, link) { in ivpu_ipc_irq_handler()
406 if (ivpu_ipc_match_consumer(vdev, cons, ipc_hdr, jsm_msg)) { in ivpu_ipc_irq_handler()
407 ivpu_ipc_dispatch(vdev, cons, ipc_hdr, jsm_msg); in ivpu_ipc_irq_handler()
481 struct ivpu_ipc_consumer *cons, *c; in ivpu_ipc_disable() local
489 list_for_each_entry_safe(cons, c, &ipc->cons_list, link) in ivpu_ipc_disable()
490 wake_up(&cons->rx_msg_wq); in ivpu_ipc_disable()