Lines Matching refs:drv_ctx

124 		ret = qman_enqueue(req->drv_ctx->req_fq, &fd);  in caam_qi_enqueue()
126 refcount_inc(&req->drv_ctx->refcnt); in caam_qi_enqueue()
158 refcount_dec(&drv_req->drv_ctx->refcnt); in caam_fq_ern_cb()
165 dma_unmap_single(drv_req->drv_ctx->qidev, qm_fd_addr(fd), in caam_fq_ern_cb()
292 static int empty_caam_fq(struct qman_fq *fq, struct caam_drv_ctx *drv_ctx) in empty_caam_fq() argument
312 if (refcount_read(&drv_ctx->refcnt) == 1) in empty_caam_fq()
319 dev_warn_once(drv_ctx->qidev, "%d frames from FQID %u still pending in CAAM\n", in empty_caam_fq()
320 refcount_read(&drv_ctx->refcnt), fq->fqid); in empty_caam_fq()
325 int caam_drv_ctx_update(struct caam_drv_ctx *drv_ctx, u32 *sh_desc) in caam_drv_ctx_update() argument
330 struct device *qidev = drv_ctx->qidev; in caam_drv_ctx_update()
339 old_fq = drv_ctx->req_fq; in caam_drv_ctx_update()
342 new_fq = create_caam_req_fq(drv_ctx->qidev, drv_ctx->rsp_fq, in caam_drv_ctx_update()
343 drv_ctx->context_a, 0); in caam_drv_ctx_update()
350 drv_ctx->req_fq = new_fq; in caam_drv_ctx_update()
353 ret = empty_caam_fq(old_fq, drv_ctx); in caam_drv_ctx_update()
358 drv_ctx->req_fq = old_fq; in caam_drv_ctx_update()
370 drv_ctx->prehdr[0] = cpu_to_caam32((1 << PREHDR_RSLS_SHIFT) | in caam_drv_ctx_update()
372 drv_ctx->prehdr[1] = cpu_to_caam32(PREHDR_ABS); in caam_drv_ctx_update()
373 memcpy(drv_ctx->sh_desc, sh_desc, desc_bytes(sh_desc)); in caam_drv_ctx_update()
374 dma_sync_single_for_device(qidev, drv_ctx->context_a, in caam_drv_ctx_update()
375 sizeof(drv_ctx->sh_desc) + in caam_drv_ctx_update()
376 sizeof(drv_ctx->prehdr), in caam_drv_ctx_update()
389 drv_ctx->req_fq = old_fq; in caam_drv_ctx_update()
408 struct caam_drv_ctx *drv_ctx; in caam_drv_ctx_init() local
418 drv_ctx = kzalloc(sizeof(*drv_ctx), GFP_ATOMIC); in caam_drv_ctx_init()
419 if (!drv_ctx) in caam_drv_ctx_init()
426 drv_ctx->prehdr[0] = cpu_to_caam32((1 << PREHDR_RSLS_SHIFT) | in caam_drv_ctx_init()
428 drv_ctx->prehdr[1] = cpu_to_caam32(PREHDR_ABS); in caam_drv_ctx_init()
429 memcpy(drv_ctx->sh_desc, sh_desc, desc_bytes(sh_desc)); in caam_drv_ctx_init()
430 size = sizeof(drv_ctx->prehdr) + sizeof(drv_ctx->sh_desc); in caam_drv_ctx_init()
431 hwdesc = dma_map_single(qidev, drv_ctx->prehdr, size, in caam_drv_ctx_init()
435 kfree(drv_ctx); in caam_drv_ctx_init()
438 drv_ctx->context_a = hwdesc; in caam_drv_ctx_init()
451 drv_ctx->cpu = *cpu; in caam_drv_ctx_init()
454 drv_ctx->rsp_fq = per_cpu(pcpu_qipriv.rsp_fq, drv_ctx->cpu); in caam_drv_ctx_init()
457 drv_ctx->req_fq = create_caam_req_fq(qidev, drv_ctx->rsp_fq, hwdesc, in caam_drv_ctx_init()
459 if (IS_ERR(drv_ctx->req_fq)) { in caam_drv_ctx_init()
462 kfree(drv_ctx); in caam_drv_ctx_init()
467 refcount_set(&drv_ctx->refcnt, 1); in caam_drv_ctx_init()
469 drv_ctx->qidev = qidev; in caam_drv_ctx_init()
470 return drv_ctx; in caam_drv_ctx_init()
500 void caam_drv_ctx_rel(struct caam_drv_ctx *drv_ctx) in caam_drv_ctx_rel() argument
502 if (IS_ERR_OR_NULL(drv_ctx)) in caam_drv_ctx_rel()
506 if (kill_fq(drv_ctx->qidev, drv_ctx->req_fq)) in caam_drv_ctx_rel()
507 dev_err(drv_ctx->qidev, "Crypto session req FQ kill failed\n"); in caam_drv_ctx_rel()
509 dma_unmap_single(drv_ctx->qidev, drv_ctx->context_a, in caam_drv_ctx_rel()
510 sizeof(drv_ctx->sh_desc) + sizeof(drv_ctx->prehdr), in caam_drv_ctx_rel()
512 kfree(drv_ctx); in caam_drv_ctx_rel()
591 refcount_dec(&drv_req->drv_ctx->refcnt); in caam_rsp_fq_dqrr_cb()
610 dma_unmap_single(drv_req->drv_ctx->qidev, qm_fd_addr(fd), in caam_rsp_fq_dqrr_cb()