Lines Matching refs:slice

155 	struct bo_slice *slice = container_of(kref, struct bo_slice, ref_count);  in free_slice()  local
157 list_del(&slice->slice); in free_slice()
158 drm_gem_object_put(&slice->bo->base); in free_slice()
159 sg_free_table(slice->sgt); in free_slice()
160 kfree(slice->sgt); in free_slice()
161 kfree(slice->reqs); in free_slice()
162 kfree(slice); in free_slice()
245 static int encode_reqs(struct qaic_device *qdev, struct bo_slice *slice, in encode_reqs() argument
257 if (!slice->no_xfer) in encode_reqs()
258 cmd |= (slice->dir == DMA_TO_DEVICE ? INBOUND_XFER : OUTBOUND_XFER); in encode_reqs()
297 for_each_sgtable_sg(slice->sgt, sg, i) { in encode_reqs()
298 slice->reqs[i].cmd = cmd; in encode_reqs()
299 slice->reqs[i].src_addr = cpu_to_le64(slice->dir == DMA_TO_DEVICE ? in encode_reqs()
301 slice->reqs[i].dest_addr = cpu_to_le64(slice->dir == DMA_TO_DEVICE ? in encode_reqs()
309 slice->reqs[i].len = cpu_to_le32((u32)sg_dma_len(sg)); in encode_reqs()
312 slice->reqs[i].sem_cmd0 = cpu_to_le32(ENCODE_SEM(req->sem0.val, in encode_reqs()
319 slice->reqs[i].sem_cmd1 = cpu_to_le32(ENCODE_SEM(req->sem1.val, in encode_reqs()
326 slice->reqs[i].sem_cmd2 = cpu_to_le32(ENCODE_SEM(req->sem2.val, in encode_reqs()
333 slice->reqs[i].sem_cmd3 = cpu_to_le32(ENCODE_SEM(req->sem3.val, in encode_reqs()
344 slice->reqs[i].cmd |= GEN_COMPLETION; in encode_reqs()
345 slice->reqs[i].db_addr = db_addr; in encode_reqs()
346 slice->reqs[i].db_len = db_len; in encode_reqs()
347 slice->reqs[i].db_data = db_data; in encode_reqs()
362 req->sem0.flags |= (slice->dir == DMA_TO_DEVICE ? in encode_reqs()
364 slice->reqs[i].sem_cmd0 = cpu_to_le32(ENCODE_SEM(req->sem0.val, req->sem0.index, in encode_reqs()
367 slice->reqs[i].sem_cmd1 = cpu_to_le32(ENCODE_SEM(req->sem1.val, req->sem1.index, in encode_reqs()
370 slice->reqs[i].sem_cmd2 = cpu_to_le32(ENCODE_SEM(req->sem2.val, req->sem2.index, in encode_reqs()
373 slice->reqs[i].sem_cmd3 = cpu_to_le32(ENCODE_SEM(req->sem3.val, req->sem3.index, in encode_reqs()
384 struct bo_slice *slice; in qaic_map_one_slice() local
391 slice = kmalloc(sizeof(*slice), GFP_KERNEL); in qaic_map_one_slice()
392 if (!slice) { in qaic_map_one_slice()
397 slice->reqs = kcalloc(sgt->nents, sizeof(*slice->reqs), GFP_KERNEL); in qaic_map_one_slice()
398 if (!slice->reqs) { in qaic_map_one_slice()
403 slice->no_xfer = !slice_ent->size; in qaic_map_one_slice()
404 slice->sgt = sgt; in qaic_map_one_slice()
405 slice->nents = sgt->nents; in qaic_map_one_slice()
406 slice->dir = bo->dir; in qaic_map_one_slice()
407 slice->bo = bo; in qaic_map_one_slice()
408 slice->size = slice_ent->size; in qaic_map_one_slice()
409 slice->offset = slice_ent->offset; in qaic_map_one_slice()
411 ret = encode_reqs(qdev, slice, slice_ent); in qaic_map_one_slice()
416 kref_init(&slice->ref_count); in qaic_map_one_slice()
418 list_add_tail(&slice->slice, &bo->slices); in qaic_map_one_slice()
423 kfree(slice->reqs); in qaic_map_one_slice()
425 kfree(slice); in qaic_map_one_slice()
889 struct bo_slice *slice, *temp; in qaic_free_slices_bo() local
891 list_for_each_entry_safe(slice, temp, &bo->slices, slice) in qaic_free_slices_bo()
892 kref_put(&slice->ref_count, free_slice); in qaic_free_slices_bo()
1043 static inline int copy_exec_reqs(struct qaic_device *qdev, struct bo_slice *slice, u32 dbc_id, in copy_exec_reqs() argument
1047 struct dbc_req *reqs = slice->reqs; in copy_exec_reqs()
1057 if (avail < slice->nents) in copy_exec_reqs()
1060 if (tail + slice->nents > dbc->nelem) { in copy_exec_reqs()
1062 avail = min_t(u32, avail, slice->nents); in copy_exec_reqs()
1066 avail = slice->nents - avail; in copy_exec_reqs()
1071 sizeof(*reqs) * slice->nents); in copy_exec_reqs()
1074 *ptail = (tail + slice->nents) % dbc->nelem; in copy_exec_reqs()
1084 static inline int copy_partial_exec_reqs(struct qaic_device *qdev, struct bo_slice *slice, in copy_partial_exec_reqs() argument
1088 struct dbc_req *reqs = slice->reqs; in copy_partial_exec_reqs()
1105 for (i = 0; i < slice->nents; i++) { in copy_partial_exec_reqs()
1143 memcpy(last_req, reqs + slice->nents - 1, sizeof(*reqs)); in copy_partial_exec_reqs()
1166 struct bo_slice *slice; in send_bo_list_to_device() local
1208 list_for_each_entry(slice, &bo->slices, slice) { in send_bo_list_to_device()
1213 if (is_partial && pexec[i].resize && pexec[i].resize <= slice->offset) in send_bo_list_to_device()
1216 for (j = 0; j < slice->nents; j++) in send_bo_list_to_device()
1217 slice->reqs[j].req_id = cpu_to_le16(bo->req_id); in send_bo_list_to_device()
1225 pexec[i].resize < slice->offset + slice->size) in send_bo_list_to_device()
1226 ret = copy_partial_exec_reqs(qdev, slice, in send_bo_list_to_device()
1227 pexec[i].resize - slice->offset, in send_bo_list_to_device()
1230 ret = copy_exec_reqs(qdev, slice, dbc->id, head, tail); in send_bo_list_to_device()
1858 struct bo_slice *slice, *slice_temp; in release_dbc() local
1876 list_for_each_entry_safe(slice, slice_temp, &bo->slices, slice) in release_dbc()
1877 kref_put(&slice->ref_count, free_slice); in release_dbc()