Lines Matching refs:length

78 	size_t length;  member
136 priv->dmabuf.buf.length = 0; in try_allocate_dmabuf()
185 sgtdata->length = 0; in add_sgtdata_entry()
189 sgtdata->length = dma->length; in add_sgtdata_entry()
193 obj->sgtbuf.length += dma->length; in add_sgtdata_entry()
213 orig->length); in dmalist_add_entry_head()
237 orig->length); in dmalist_add_entry()
266 new->length); in dmalist_insert_before_entry()
295 new->length); in dmalist_insert_after_entry()
311 if (!obj->sgtbuf.length) in dmaobj_cache_operation()
315 caam_sgt_cache_op(op, &obj->sgtbuf, obj->sgtbuf.length); in dmaobj_cache_operation()
317 cache_operation(op, obj->sgtbuf.buf->data, obj->sgtbuf.length); in dmaobj_cache_operation()
326 static inline void add_dma_require(struct priv_dmaobj *priv, size_t length) in add_dma_require() argument
330 if (ADD_OVERFLOW(priv->dmabuf.require, length, &tmp)) in add_dma_require()
363 entry->origbuf.data, entry->origbuf.length, acclen, in check_buffer_alignment()
370 acclen += entry->origbuf.length; in check_buffer_alignment()
375 if (entry->origbuf.length < cacheline_size) { in check_buffer_alignment()
381 entry->origbuf.length, cacheline_size); in check_buffer_alignment()
384 add_dma_require(priv, entry->origbuf.length); in check_buffer_alignment()
395 remlen = entry->origbuf.length - in check_buffer_alignment()
407 add_dma_require(priv, entry->origbuf.length); in check_buffer_alignment()
415 newbuf.length = va_start_align - va_start; in check_buffer_alignment()
419 add_dma_require(priv, newbuf.length); in check_buffer_alignment()
432 entry->origbuf.length -= newbuf.length; in check_buffer_alignment()
433 entry->origbuf.paddr += newbuf.length; in check_buffer_alignment()
441 acclen -= entry->origbuf.length; in check_buffer_alignment()
445 va_end = (vaddr_t)entry->origbuf.data + entry->origbuf.length; in check_buffer_alignment()
453 remlen = entry->origbuf.length - va_end_align; in check_buffer_alignment()
465 add_dma_require(priv, entry->origbuf.length); in check_buffer_alignment()
473 newbuf.length = va_end - va_end_align; in check_buffer_alignment()
474 newbuf.paddr = entry->origbuf.paddr + newbuf.length; in check_buffer_alignment()
477 add_dma_require(priv, newbuf.length); in check_buffer_alignment()
487 entry->origbuf.length -= newbuf.length; in check_buffer_alignment()
495 acclen -= newbuf.length; in check_buffer_alignment()
540 if (ADD_OVERFLOW(pabufs[idx].paddr, pabufs[idx].length, in check_buffer_boundary()
545 pabufs[idx].paddr, pabufs[idx].length); in check_buffer_boundary()
554 pabufs[idx].length, &tmp)) in check_buffer_boundary()
560 if (remlen > pabufs[idx].length) in check_buffer_boundary()
561 remlen -= pabufs[idx].length; in check_buffer_boundary()
576 orig->length = maxlen; in check_buffer_boundary()
606 sgtbuf->data = dmabuf->buf.data + dmabuf->buf.length; in entry_sgtbuf_dmabuf()
607 sgtbuf->length = MIN(dmabuf->remind, entry->origbuf.length - off); in entry_sgtbuf_dmabuf()
608 sgtbuf->paddr = dmabuf->buf.paddr + dmabuf->buf.length; in entry_sgtbuf_dmabuf()
610 dmabuf->remind -= sgtbuf->length; in entry_sgtbuf_dmabuf()
611 dmabuf->buf.length += sgtbuf->length; in entry_sgtbuf_dmabuf()
614 memcpy(sgtbuf->data, &entry->origbuf.data[off], sgtbuf->length); in entry_sgtbuf_dmabuf()
644 sgtbuf->length -= off; in entry_sgtbuf()
646 DMAOBJ_TRACE("DMA buffer %p - %zu", sgtbuf->data, sgtbuf->length); in entry_sgtbuf()
653 size_t length) in caam_dmaobj_init_input() argument
657 DMAOBJ_TRACE("Input object with data @%p of %zu bytes", data, length); in caam_dmaobj_init_input()
659 if (!data || !length || !obj) { in caam_dmaobj_init_input()
672 obj->orig.length = length; in caam_dmaobj_init_input()
673 if (!caam_mem_is_cached_buf((void *)data, length)) in caam_dmaobj_init_input()
678 ret = check_buffer_boundary(obj, &obj->orig, obj->orig.length); in caam_dmaobj_init_input()
686 size_t length) in caam_dmaobj_input_sgtbuf() argument
689 size_t size_done = length; in caam_dmaobj_input_sgtbuf()
691 ret = caam_dmaobj_init_input(obj, data, length); in caam_dmaobj_input_sgtbuf()
695 ret = caam_dmaobj_prepare(obj, NULL, length); in caam_dmaobj_input_sgtbuf()
699 ret = caam_dmaobj_sgtbuf_build(obj, &size_done, 0, length); in caam_dmaobj_input_sgtbuf()
703 if (size_done != length) in caam_dmaobj_input_sgtbuf()
710 size_t length, size_t min_length) in caam_dmaobj_init_output() argument
717 length, min_length); in caam_dmaobj_init_output()
737 obj->orig.length = length; in caam_dmaobj_init_output()
738 if (!caam_mem_is_cached_buf((void *)data, length)) in caam_dmaobj_init_output()
742 MIN(min_length, obj->orig.length)); in caam_dmaobj_init_output()
747 if (length < min_length || !data) { in caam_dmaobj_init_output()
749 min_length, min_length - length); in caam_dmaobj_init_output()
750 newbuf.length = min_length - length; in caam_dmaobj_init_output()
759 add_dma_require(obj->priv, newbuf.length); in caam_dmaobj_init_output()
773 size_t length, size_t min_length) in caam_dmaobj_output_sgtbuf() argument
781 if (!data && !length && min_length) { in caam_dmaobj_output_sgtbuf()
800 ret = caam_dmaobj_init_output(obj, buf.data, buf.length, size); in caam_dmaobj_output_sgtbuf()
805 obj->orig.length = min_length; in caam_dmaobj_output_sgtbuf()
811 ret = caam_dmaobj_init_output(obj, data, length, min_length); in caam_dmaobj_output_sgtbuf()
850 size_t length = 0; in caam_dmaobj_copy_to_orig() local
866 dst_rlen = MIN(obj->orig.length, obj->sgtbuf.length); in caam_dmaobj_copy_to_orig()
876 copy_size = MIN(dst_rlen, sgtdata->length); in caam_dmaobj_copy_to_orig()
878 copy_size = MIN(dst_rlen, sgtdata->length); in caam_dmaobj_copy_to_orig()
882 length += copy_size; in caam_dmaobj_copy_to_orig()
886 return length; in caam_dmaobj_copy_to_orig()
898 size_t length = 0; in caam_dmaobj_copy_ltrim_to_orig() local
917 for (offset = 0; offset < sgtdata->length; off++, offset++) { in caam_dmaobj_copy_ltrim_to_orig()
924 if (off < obj->orig.length) in caam_dmaobj_copy_ltrim_to_orig()
925 dst_rlen = obj->orig.length - off; in caam_dmaobj_copy_ltrim_to_orig()
952 copy_size = MIN(dst_rlen, sgtdata->length - offset); in caam_dmaobj_copy_ltrim_to_orig()
956 copy_size = MIN(dst_rlen, sgtdata->length); in caam_dmaobj_copy_ltrim_to_orig()
963 length += copy_size; in caam_dmaobj_copy_ltrim_to_orig()
966 return length; in caam_dmaobj_copy_ltrim_to_orig()
986 obj->orig.data, obj->orig.length); in caam_dmaobj_free()
1044 newbuf.length = block->filled; in caam_dmaobj_add_first_block()
1065 size_t offset, size_t length) in caam_dmaobj_derive_sgtbuf() argument
1072 offset, length); in caam_dmaobj_derive_sgtbuf()
1074 if (!obj || !from || !length || !from->priv) { in caam_dmaobj_derive_sgtbuf()
1079 if (!from->orig.data || !from->orig.length) { in caam_dmaobj_derive_sgtbuf()
1093 length); in caam_dmaobj_derive_sgtbuf()
1216 size_t *length, size_t off, in caam_dmaobj_sgtbuf_inout_build() argument
1223 input, output, *length, off, align); in caam_dmaobj_sgtbuf_inout_build()
1225 if (!input || !output || !length || !input->priv || !output->priv || in caam_dmaobj_sgtbuf_inout_build()
1226 !*length) { in caam_dmaobj_sgtbuf_inout_build()
1234 ret = caam_dmaobj_sgtbuf_build(input, length, off, align); in caam_dmaobj_sgtbuf_inout_build()
1243 len = *length; in caam_dmaobj_sgtbuf_inout_build()
1244 ret = caam_dmaobj_sgtbuf_build(output, &len, off, *length); in caam_dmaobj_sgtbuf_inout_build()
1248 if (len != *length) { in caam_dmaobj_sgtbuf_inout_build()
1249 DMAOBJ_TRACE("Retry In %zu bytes vs Out %zu bytes", *length, in caam_dmaobj_sgtbuf_inout_build()
1253 *length = len; in caam_dmaobj_sgtbuf_inout_build()
1254 ret = caam_dmaobj_sgtbuf_build(input, length, off, len); in caam_dmaobj_sgtbuf_inout_build()
1255 if (!ret && *length != len) { in caam_dmaobj_sgtbuf_inout_build()
1257 *length, len); in caam_dmaobj_sgtbuf_inout_build()
1268 TEE_Result caam_dmaobj_sgtbuf_build(struct caamdmaobj *obj, size_t *length, in caam_dmaobj_sgtbuf_build() argument
1283 *length, off, align); in caam_dmaobj_sgtbuf_build()
1285 if (!obj || !obj->priv || !length || !*length) { in caam_dmaobj_sgtbuf_build()
1292 max_length = *length; in caam_dmaobj_sgtbuf_build()
1298 *length); in caam_dmaobj_sgtbuf_build()
1302 if (offset < entry->origbuf.length) in caam_dmaobj_sgtbuf_build()
1305 offset -= entry->origbuf.length; in caam_dmaobj_sgtbuf_build()
1318 acc_length = entry->origbuf.length - offset; in caam_dmaobj_sgtbuf_build()
1324 acc_length += entry->origbuf.length; in caam_dmaobj_sgtbuf_build()
1367 priv->dmabuf.buf.length = 0; in caam_dmaobj_sgtbuf_build()
1370 obj->sgtbuf.length = 0; in caam_dmaobj_sgtbuf_build()
1389 if (obj->sgtbuf.length >= max_length) { in caam_dmaobj_sgtbuf_build()
1391 obj->sgtbuf.length = max_length; in caam_dmaobj_sgtbuf_build()
1406 *length = obj->sgtbuf.length; in caam_dmaobj_sgtbuf_build()
1409 DMAOBJ_TRACE("SGTBUF (%zu) returns 0x%" PRIx32, *length, ret); in caam_dmaobj_sgtbuf_build()