/openbmc/linux/lib/ |
H A D | sg_pool.c | 40 static inline unsigned int sg_pool_index(unsigned short nents) in sg_pool_index() argument 44 BUG_ON(nents > SG_CHUNK_SIZE); in sg_pool_index() 46 if (nents <= 8) in sg_pool_index() 49 index = get_count_order(nents) - 3; in sg_pool_index() 54 static void sg_pool_free(struct scatterlist *sgl, unsigned int nents) in sg_pool_free() argument 58 sgp = sg_pools + sg_pool_index(nents); in sg_pool_free() 62 static struct scatterlist *sg_pool_alloc(unsigned int nents, gfp_t gfp_mask) in sg_pool_alloc() argument 66 sgp = sg_pools + sg_pool_index(nents); in sg_pool_alloc() 112 int sg_alloc_table_chained(struct sg_table *table, int nents, in sg_alloc_table_chained() argument 117 BUG_ON(!nents); in sg_alloc_table_chained() [all …]
|
H A D | scatterlist.c | 49 int nents; in sg_nents() local 50 for (nents = 0; sg; sg = sg_next(sg)) in sg_nents() 51 nents++; in sg_nents() 52 return nents; in sg_nents() 72 int nents; in sg_nents_for_len() local 78 for (nents = 0, total = 0; sg; sg = sg_next(sg)) { in sg_nents_for_len() 79 nents++; in sg_nents_for_len() 82 return nents; in sg_nents_for_len() 103 struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents) in sg_last() argument 108 for_each_sg(sgl, sg, nents, i) in sg_last() [all …]
|
H A D | sg_split.c | 13 int nents; member 20 static int sg_calculate_split(struct scatterlist *in, int nents, int nb_splits, in sg_calculate_split() argument 32 splitters[i].nents = 0; in sg_calculate_split() 35 for_each_sg(in, sg, nents, i) { in sg_calculate_split() 48 curr->nents++; in sg_calculate_split() 59 curr->nents = 1; in sg_calculate_split() 86 for (j = 0; j < split->nents; j++, out_sg++) { in sg_split_phys() 112 for (j = 0; j < split->nents; j++, out_sg++) { in sg_split_mapped() 168 splitters[i].out_sg = kmalloc_array(splitters[i].nents, in sg_split() 190 out_mapped_nents[i] = splitters[i].nents; in sg_split()
|
H A D | kfifo.c | 296 int nents, unsigned int len) in setup_sgl_buf() argument 303 if (!nents) in setup_sgl_buf() 323 if (++n == nents || sgl == NULL) in setup_sgl_buf() 335 int nents, unsigned int len, unsigned int off) in setup_sgl() argument 350 n = setup_sgl_buf(sgl, fifo->data + off, nents, l); in setup_sgl() 351 n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); in setup_sgl() 357 struct scatterlist *sgl, int nents, unsigned int len) in __kfifo_dma_in_prepare() argument 365 return setup_sgl(fifo, sgl, nents, len, fifo->in); in __kfifo_dma_in_prepare() 370 struct scatterlist *sgl, int nents, unsigned int len) in __kfifo_dma_out_prepare() argument 378 return setup_sgl(fifo, sgl, nents, len, fifo->out); in __kfifo_dma_out_prepare() [all …]
|
/openbmc/linux/drivers/gpu/drm/virtio/ |
H A D | virtgpu_gem.c | 164 struct virtio_gpu_object_array *virtio_gpu_array_alloc(u32 nents) in virtio_gpu_array_alloc() argument 168 objs = kmalloc(struct_size(objs, objs, nents), GFP_KERNEL); in virtio_gpu_array_alloc() 172 objs->nents = 0; in virtio_gpu_array_alloc() 173 objs->total = nents; in virtio_gpu_array_alloc() 183 virtio_gpu_array_from_handles(struct drm_file *drm_file, u32 *handles, u32 nents) in virtio_gpu_array_from_handles() argument 188 objs = virtio_gpu_array_alloc(nents); in virtio_gpu_array_from_handles() 192 for (i = 0; i < nents; i++) { in virtio_gpu_array_from_handles() 195 objs->nents = i; in virtio_gpu_array_from_handles() 200 objs->nents = i; in virtio_gpu_array_from_handles() 207 if (WARN_ON_ONCE(objs->nents == objs->total)) in virtio_gpu_array_add_obj() [all …]
|
H A D | virtgpu_object.c | 138 unsigned int *nents) in virtio_gpu_object_shmem_init() argument 150 *nents = pages->nents; in virtio_gpu_object_shmem_init() 152 *nents = pages->orig_nents; in virtio_gpu_object_shmem_init() 154 *ents = kvmalloc_array(*nents, in virtio_gpu_object_shmem_init() 188 unsigned int nents; in virtio_gpu_object_create() local 205 ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents); in virtio_gpu_object_create() 226 ents, nents); in virtio_gpu_object_create() 230 virtio_gpu_object_attach(vgdev, bo, ents, nents); in virtio_gpu_object_create() 234 virtio_gpu_object_attach(vgdev, bo, ents, nents); in virtio_gpu_object_create()
|
/openbmc/linux/samples/kfifo/ |
H A D | dma-example.c | 25 unsigned int nents; in example_init() local 63 nents = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE); in example_init() 64 printk(KERN_INFO "DMA sgl entries: %d\n", nents); in example_init() 65 if (!nents) { in example_init() 73 for (i = 0; i < nents; i++) { in example_init() 93 nents = kfifo_dma_out_prepare(&fifo, sg, ARRAY_SIZE(sg), 8); in example_init() 94 printk(KERN_INFO "DMA sgl entries: %d\n", nents); in example_init() 95 if (!nents) { in example_init() 102 for (i = 0; i < nents; i++) { in example_init()
|
/openbmc/linux/include/linux/ |
H A D | scatterlist.h | 41 unsigned int nents; /* number of mapped entries */ member 210 for_each_sg((sgt)->sgl, sg, (sgt)->nents, i) 414 unsigned int nents) in sg_init_marker() argument 416 sg_mark_end(&sgl[nents - 1]); in sg_init_marker() 487 void sgl_free_n_order(struct scatterlist *sgl, int nents, int order); 492 size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, 495 size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, 497 size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, 500 size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, 502 size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents, [all …]
|
/openbmc/linux/drivers/gpu/drm/i915/ |
H A D | i915_scatterlist.c | 21 if (orig_st->nents == orig_st->orig_nents) in i915_sg_trim() 24 if (sg_alloc_table(&new_st, orig_st->nents, GFP_KERNEL | __GFP_NOWARN)) in i915_sg_trim() 28 for_each_sg(orig_st->sgl, sg, orig_st->nents, i) { in i915_sg_trim() 113 st->nents = 0; in i915_rsgt_from_mm_node() 122 if (st->nents) in i915_rsgt_from_mm_node() 130 st->nents++; in i915_rsgt_from_mm_node() 199 st->nents = 0; in i915_rsgt_from_buddy_resource() 212 if (st->nents) in i915_rsgt_from_buddy_resource() 220 st->nents++; in i915_rsgt_from_buddy_resource()
|
/openbmc/linux/drivers/hwtracing/intel_th/ |
H A D | msu-sink.c | 54 unsigned int nents; in msu_sink_alloc_window() local 62 nents = DIV_ROUND_UP(size, PAGE_SIZE); in msu_sink_alloc_window() 64 ret = sg_alloc_table(*sgt, nents, GFP_KERNEL); in msu_sink_alloc_window() 70 for_each_sg((*sgt)->sgl, sg_ptr, nents, i) { in msu_sink_alloc_window() 80 return nents; in msu_sink_alloc_window() 90 for_each_sg(sgt->sgl, sg_ptr, sgt->nents, i) { in msu_sink_free_window()
|
/openbmc/linux/drivers/crypto/ccree/ |
H A D | cc_buffer_mgr.c | 25 int nents[MAX_NUM_OF_BUFFERS_IN_MLLI]; member 77 unsigned int nents = 0; in cc_get_sgl_nents() local 82 nents++; in cc_get_sgl_nents() 90 dev_dbg(dev, "nents %d last bytes %d\n", nents, *lbytes); in cc_get_sgl_nents() 91 return nents; in cc_get_sgl_nents() 109 u32 nents; in cc_copy_sg_portion() local 111 nents = sg_nents_for_len(sg, end); in cc_copy_sg_portion() 112 sg_copy_buffer(sg, nents, dest, (end - to_skip + 1), to_skip, in cc_copy_sg_portion() 236 unsigned int nents, struct scatterlist *sgl, in cc_add_sg_entry() argument 243 index, nents, sgl, data_len, is_last_table); in cc_add_sg_entry() [all …]
|
/openbmc/linux/drivers/spi/ |
H A D | spi-dw-dma.c | 292 u32 nents; in dw_spi_dma_wait_tx_done() local 294 nents = dw_readl(dws, DW_SPI_TXFLR); in dw_spi_dma_wait_tx_done() 296 delay.value = nents * dws->n_bytes * BITS_PER_BYTE; in dw_spi_dma_wait_tx_done() 340 unsigned int nents) in dw_spi_dma_submit_tx() argument 346 txdesc = dmaengine_prep_slave_sg(dws->txchan, sgl, nents, in dw_spi_dma_submit_tx() 377 u32 nents; in dw_spi_dma_wait_rx_done() local 388 nents = dw_readl(dws, DW_SPI_RXFLR); in dw_spi_dma_wait_rx_done() 389 ns = 4U * NSEC_PER_SEC / dws->max_freq * nents; in dw_spi_dma_wait_rx_done() 441 unsigned int nents) in dw_spi_dma_submit_rx() argument 447 rxdesc = dmaengine_prep_slave_sg(dws->rxchan, sgl, nents, in dw_spi_dma_submit_rx() [all …]
|
H A D | spi-ep93xx.c | 285 int i, ret, nents; in ep93xx_spi_dma_prepare() local 325 nents = DIV_ROUND_UP(len, PAGE_SIZE); in ep93xx_spi_dma_prepare() 326 if (nents != sgt->nents) { in ep93xx_spi_dma_prepare() 329 ret = sg_alloc_table(sgt, nents, GFP_KERNEL); in ep93xx_spi_dma_prepare() 335 for_each_sg(sgt->sgl, sg, sgt->nents, i) { in ep93xx_spi_dma_prepare() 355 nents = dma_map_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); in ep93xx_spi_dma_prepare() 356 if (!nents) in ep93xx_spi_dma_prepare() 359 txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, conf.direction, in ep93xx_spi_dma_prepare() 362 dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); in ep93xx_spi_dma_prepare() 391 dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); in ep93xx_spi_dma_finish()
|
/openbmc/linux/kernel/dma/ |
H A D | direct.h | 21 int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents, 28 int nents, enum dma_data_direction dir); 31 struct scatterlist *sgl, int nents, enum dma_data_direction dir) in dma_direct_sync_sg_for_device() argument 40 int nents, enum dma_data_direction dir, unsigned long attrs); 42 struct scatterlist *sgl, int nents, enum dma_data_direction dir); 45 struct scatterlist *sgl, int nents, enum dma_data_direction dir, in dma_direct_unmap_sg() argument 50 struct scatterlist *sgl, int nents, enum dma_data_direction dir) in dma_direct_sync_sg_for_cpu() argument
|
H A D | mapping.c | 187 int nents, enum dma_data_direction dir, unsigned long attrs) in __dma_map_sg_attrs() argument 198 arch_dma_map_sg_direct(dev, sg, nents)) in __dma_map_sg_attrs() 199 ents = dma_direct_map_sg(dev, sg, nents, dir, attrs); in __dma_map_sg_attrs() 201 ents = ops->map_sg(dev, sg, nents, dir, attrs); in __dma_map_sg_attrs() 204 kmsan_handle_dma_sg(sg, nents, dir); in __dma_map_sg_attrs() 205 debug_dma_map_sg(dev, sg, nents, ents, dir, attrs); in __dma_map_sg_attrs() 232 int nents, enum dma_data_direction dir, unsigned long attrs) in dma_map_sg_attrs() argument 236 ret = __dma_map_sg_attrs(dev, sg, nents, dir, attrs); in dma_map_sg_attrs() 273 int nents; in dma_map_sgtable() local 275 nents = __dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs); in dma_map_sgtable() [all …]
|
/openbmc/linux/drivers/parisc/ |
H A D | iommu-helpers.h | 15 iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, in iommu_fill_pdir() argument 30 while (nents-- > 0) { in iommu_fill_pdir() 34 DBG_RUN_SG(" %d : %08lx %p/%05x\n", nents, in iommu_fill_pdir() 102 struct scatterlist *startsg, int nents, in iommu_coalesce_chunks() argument 114 while (nents > 0) { in iommu_coalesce_chunks() 131 while(--nents > 0) { in iommu_coalesce_chunks()
|
/openbmc/linux/drivers/target/iscsi/cxgbit/ |
H A D | cxgbit_ddp.c | 153 unsigned int nents) in cxgbit_ddp_sgl_check() argument 155 unsigned int last_sgidx = nents - 1; in cxgbit_ddp_sgl_check() 158 for (i = 0; i < nents; i++, sg = sg_next(sg)) { in cxgbit_ddp_sgl_check() 177 unsigned int sgcnt = ttinfo->nents; in cxgbit_ddp_reserve() 184 xferlen, ttinfo->nents); in cxgbit_ddp_reserve() 246 ttinfo->nents = cmd->se_cmd.t_data_nents; in cxgbit_get_r2t_ttt() 251 csk, cmd, cmd->se_cmd.data_length, ttinfo->nents); in cxgbit_get_r2t_ttt() 254 ttinfo->nents = 0; in cxgbit_get_r2t_ttt() 286 ttinfo->nents, DMA_FROM_DEVICE); in cxgbit_unmap_cmd() 287 ttinfo->nents = 0; in cxgbit_unmap_cmd()
|
/openbmc/linux/drivers/crypto/cavium/nitrox/ |
H A D | nitrox_req.h | 555 static inline void *alloc_req_buf(int nents, int extralen, gfp_t gfp) in alloc_req_buf() argument 559 size = sizeof(struct scatterlist) * nents; in alloc_req_buf() 621 int nents, int ivsize) in alloc_src_req_buf() argument 625 nkreq->src = alloc_req_buf(nents, ivsize, creq->gfp); in alloc_src_req_buf() 643 int nents, int ivsize, in nitrox_creq_set_src_sg() argument 652 sg_init_table(sg, nents); in nitrox_creq_set_src_sg() 667 int nents) in alloc_dst_req_buf() argument 672 nkreq->dst = alloc_req_buf(nents, extralen, creq->gfp); in alloc_dst_req_buf() 701 int nents, int ivsize, in nitrox_creq_set_dst_sg() argument 710 sg_init_table(sg, nents); in nitrox_creq_set_dst_sg()
|
H A D | nitrox_aead.c | 97 int nents = sg_nents_for_len(src, buflen); in alloc_src_sglist() local 100 if (nents < 0) in alloc_src_sglist() 101 return nents; in alloc_src_sglist() 104 nents += 1; in alloc_src_sglist() 106 ret = alloc_src_req_buf(nkreq, nents, ivsize); in alloc_src_sglist() 111 nitrox_creq_set_src_sg(nkreq, nents, ivsize, src, buflen); in alloc_src_sglist() 119 int nents = sg_nents_for_len(dst, buflen); in alloc_dst_sglist() local 122 if (nents < 0) in alloc_dst_sglist() 123 return nents; in alloc_dst_sglist() 126 nents += 3; in alloc_dst_sglist() [all …]
|
/openbmc/linux/drivers/mmc/core/ |
H A D | sdio_ops.c | 122 unsigned int nents, left_size, i; in mmc_io_rw_extended() local 152 nents = DIV_ROUND_UP(left_size, seg_size); in mmc_io_rw_extended() 153 if (nents > 1) { in mmc_io_rw_extended() 154 if (sg_alloc_table(&sgtable, nents, GFP_KERNEL)) in mmc_io_rw_extended() 158 data.sg_len = nents; in mmc_io_rw_extended() 196 if (nents > 1) in mmc_io_rw_extended()
|
/openbmc/linux/arch/ia64/hp/common/ |
H A D | sba_iommu.c | 387 sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents) in sba_dump_sg() argument 389 while (nents-- > 0) { in sba_dump_sg() 390 printk(KERN_DEBUG " %d : DMA %08lx/%05x CPU %p\n", nents, in sba_dump_sg() 398 sba_check_sg( struct ioc *ioc, struct scatterlist *startsg, int nents) in sba_check_sg() argument 401 int the_nents = nents; in sba_check_sg() 405 sba_dump_sg(NULL, startsg, nents); in sba_check_sg() 1208 int nents) in sba_fill_pdir() argument 1215 while (nents-- > 0) { in sba_fill_pdir() 1222 nents, startsg->dma_address, cnt, in sba_fill_pdir() 1226 nents, startsg->dma_address, cnt, in sba_fill_pdir() [all …]
|
/openbmc/linux/arch/sparc/mm/ |
H A D | iommu.c | 250 int nents, enum dma_data_direction dir, unsigned long attrs, in __sbus_iommu_map_sg() argument 256 for_each_sg(sgl, sg, nents, j) { in __sbus_iommu_map_sg() 264 return nents; in __sbus_iommu_map_sg() 268 int nents, enum dma_data_direction dir, unsigned long attrs) in sbus_iommu_map_sg_gflush() argument 271 return __sbus_iommu_map_sg(dev, sgl, nents, dir, attrs, false); in sbus_iommu_map_sg_gflush() 275 int nents, enum dma_data_direction dir, unsigned long attrs) in sbus_iommu_map_sg_pflush() argument 277 return __sbus_iommu_map_sg(dev, sgl, nents, dir, attrs, true); in sbus_iommu_map_sg_pflush() 300 int nents, enum dma_data_direction dir, unsigned long attrs) in sbus_iommu_unmap_sg() argument 305 for_each_sg(sgl, sg, nents, i) { in sbus_iommu_unmap_sg()
|
/openbmc/linux/arch/mips/jazz/ |
H A D | jazzdma.c | 544 int nents, enum dma_data_direction dir, unsigned long attrs) in jazz_dma_map_sg() argument 549 for_each_sg(sglist, sg, nents, i) { in jazz_dma_map_sg() 559 return nents; in jazz_dma_map_sg() 563 int nents, enum dma_data_direction dir, unsigned long attrs) in jazz_dma_unmap_sg() argument 568 for_each_sg(sglist, sg, nents, i) { in jazz_dma_unmap_sg() 588 struct scatterlist *sgl, int nents, enum dma_data_direction dir) in jazz_dma_sync_sg_for_device() argument 593 for_each_sg(sgl, sg, nents, i) in jazz_dma_sync_sg_for_device() 598 struct scatterlist *sgl, int nents, enum dma_data_direction dir) in jazz_dma_sync_sg_for_cpu() argument 603 for_each_sg(sgl, sg, nents, i) in jazz_dma_sync_sg_for_cpu()
|
/openbmc/linux/arch/x86/kernel/ |
H A D | amd_gart_64.c | 276 static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, in gart_unmap_sg() argument 282 for_each_sg(sg, s, nents, i) { in gart_unmap_sg() 291 int nents, int dir) in dma_map_sg_nonforce() argument 300 for_each_sg(sg, s, nents, i) { in dma_map_sg_nonforce() 308 nents = 0; in dma_map_sg_nonforce() 318 return nents; in dma_map_sg_nonforce() 377 static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, in gart_map_sg() argument 386 if (nents == 0) in gart_map_sg() 397 for_each_sg(sg, s, nents, i) { in gart_map_sg() 439 if (out < nents) { in gart_map_sg() [all …]
|
/openbmc/linux/drivers/iommu/ |
H A D | dma-iommu.c | 533 int nents, enum dma_data_direction dir) in dev_use_sg_swiotlb() argument 550 for_each_sg(sg, s, nents, i) in dev_use_sg_swiotlb() 1113 static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, in __finalise_sg() argument 1121 for_each_sg(sg, s, nents, i) { in __finalise_sg() 1181 static void __invalidate_sg(struct scatterlist *sg, int nents) in __invalidate_sg() argument 1186 for_each_sg(sg, s, nents, i) { in __invalidate_sg() 1201 int nents, enum dma_data_direction dir, unsigned long attrs) in iommu_dma_unmap_sg_swiotlb() argument 1206 for_each_sg(sg, s, nents, i) in iommu_dma_unmap_sg_swiotlb() 1212 int nents, enum dma_data_direction dir, unsigned long attrs) in iommu_dma_map_sg_swiotlb() argument 1219 for_each_sg(sg, s, nents, i) { in iommu_dma_map_sg_swiotlb() [all …]
|