Lines Matching refs:kccb
201 return pvr_dev->kccb.slot_count - 1; in pvr_kccb_capacity()
216 struct pvr_ccb *pvr_ccb = &pvr_dev->kccb.ccb; in pvr_kccb_used_slot_count_locked()
227 used_count = wr_offset + pvr_dev->kccb.slot_count - rd_offset; in pvr_kccb_used_slot_count_locked()
244 struct pvr_ccb *pvr_ccb = &pvr_dev->kccb.ccb; in pvr_kccb_send_cmd_reserved_powered()
245 struct rogue_fwif_kccb_cmd *kccb = pvr_ccb->ccb; in pvr_kccb_send_cmd_reserved_powered() local
254 if (WARN_ON(!pvr_dev->kccb.reserved_count)) in pvr_kccb_send_cmd_reserved_powered()
263 memcpy(&kccb[old_write_offset], cmd, in pvr_kccb_send_cmd_reserved_powered()
268 WRITE_ONCE(pvr_dev->kccb.rtn[old_write_offset], in pvr_kccb_send_cmd_reserved_powered()
273 pvr_dev->kccb.reserved_count--; in pvr_kccb_send_cmd_reserved_powered()
296 mutex_lock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_try_reserve_slot()
299 if (pvr_dev->kccb.reserved_count < pvr_kccb_capacity(pvr_dev) - used_count) { in pvr_kccb_try_reserve_slot()
300 pvr_dev->kccb.reserved_count++; in pvr_kccb_try_reserve_slot()
304 mutex_unlock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_try_reserve_slot()
405 int ret = wait_event_timeout(pvr_dev->kccb.rtn_q, READ_ONCE(pvr_dev->kccb.rtn[slot_nr]) & in pvr_kccb_wait_for_completion()
409 *rtn_out = READ_ONCE(pvr_dev->kccb.rtn[slot_nr]); in pvr_kccb_wait_for_completion()
425 struct rogue_fwif_ccb_ctl *ctrl = pvr_dev->kccb.ccb.ctrl; in pvr_kccb_is_idle()
428 mutex_lock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_is_idle()
432 mutex_unlock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_is_idle()
477 wake_up_all(&pvr_dev->kccb.rtn_q); in pvr_kccb_wake_up_waiters()
480 mutex_lock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_wake_up_waiters()
483 if (WARN_ON(used_count + pvr_dev->kccb.reserved_count > pvr_kccb_capacity(pvr_dev))) in pvr_kccb_wake_up_waiters()
486 available_count = pvr_kccb_capacity(pvr_dev) - used_count - pvr_dev->kccb.reserved_count; in pvr_kccb_wake_up_waiters()
487 list_for_each_entry_safe(fence, tmp_fence, &pvr_dev->kccb.waiters, node) { in pvr_kccb_wake_up_waiters()
492 pvr_dev->kccb.reserved_count++; in pvr_kccb_wake_up_waiters()
499 mutex_unlock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_wake_up_waiters()
508 pvr_ccb_fini(&pvr_dev->kccb.ccb); in pvr_kccb_fini()
509 WARN_ON(!list_empty(&pvr_dev->kccb.waiters)); in pvr_kccb_fini()
510 WARN_ON(pvr_dev->kccb.reserved_count); in pvr_kccb_fini()
524 pvr_dev->kccb.slot_count = 1 << ROGUE_FWIF_KCCB_NUMCMDS_LOG2_DEFAULT; in pvr_kccb_init()
525 INIT_LIST_HEAD(&pvr_dev->kccb.waiters); in pvr_kccb_init()
526 pvr_dev->kccb.fence_ctx.id = dma_fence_context_alloc(1); in pvr_kccb_init()
527 spin_lock_init(&pvr_dev->kccb.fence_ctx.lock); in pvr_kccb_init()
529 return pvr_ccb_init(pvr_dev, &pvr_dev->kccb.ccb, in pvr_kccb_init()
594 mutex_lock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_reserve_slot()
597 if (pvr_dev->kccb.reserved_count >= pvr_kccb_capacity(pvr_dev) - used_count) { in pvr_kccb_reserve_slot()
599 &pvr_dev->kccb.fence_ctx.lock, in pvr_kccb_reserve_slot()
600 pvr_dev->kccb.fence_ctx.id, in pvr_kccb_reserve_slot()
601 atomic_inc_return(&pvr_dev->kccb.fence_ctx.seqno)); in pvr_kccb_reserve_slot()
603 list_add_tail(&fence->node, &pvr_dev->kccb.waiters); in pvr_kccb_reserve_slot()
606 pvr_dev->kccb.reserved_count++; in pvr_kccb_reserve_slot()
609 mutex_unlock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_reserve_slot()
625 mutex_lock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_release_slot()
626 if (!WARN_ON(!pvr_dev->kccb.reserved_count)) in pvr_kccb_release_slot()
627 pvr_dev->kccb.reserved_count--; in pvr_kccb_release_slot()
628 mutex_unlock(&pvr_dev->kccb.ccb.lock); in pvr_kccb_release_slot()