Lines Matching refs:nslabs

230 	if (!mem->nslabs) {  in swiotlb_print_info()
236 (mem->nslabs << IO_TLB_SHIFT) >> 20); in swiotlb_print_info()
260 if (!mem->nslabs || mem->late_alloc) in swiotlb_update_mem_attributes()
262 bytes = PAGE_ALIGN(mem->nslabs << IO_TLB_SHIFT); in swiotlb_update_mem_attributes()
267 unsigned long nslabs, bool late_alloc, unsigned int nareas) in swiotlb_init_io_tlb_pool() argument
270 unsigned long bytes = nslabs << IO_TLB_SHIFT, i; in swiotlb_init_io_tlb_pool()
272 mem->nslabs = nslabs; in swiotlb_init_io_tlb_pool()
277 mem->area_nslabs = nslabs / mem->nareas; in swiotlb_init_io_tlb_pool()
285 for (i = 0; i < mem->nslabs; i++) { in swiotlb_init_io_tlb_pool()
287 mem->nslabs - i); in swiotlb_init_io_tlb_pool()
307 mem->nslabs += pool->nslabs; in add_mem_pool()
310 mem->nslabs = pool->nslabs; in add_mem_pool()
314 static void __init *swiotlb_memblock_alloc(unsigned long nslabs, in swiotlb_memblock_alloc() argument
316 int (*remap)(void *tlb, unsigned long nslabs)) in swiotlb_memblock_alloc()
318 size_t bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT); in swiotlb_memblock_alloc()
337 if (remap && remap(tlb, nslabs) < 0) { in swiotlb_memblock_alloc()
351 int (*remap)(void *tlb, unsigned long nslabs)) in swiotlb_init_remap() argument
354 unsigned long nslabs; in swiotlb_init_remap() local
379 nslabs = default_nslabs; in swiotlb_init_remap()
380 nareas = limit_nareas(default_nareas, nslabs); in swiotlb_init_remap()
381 while ((tlb = swiotlb_memblock_alloc(nslabs, flags, remap)) == NULL) { in swiotlb_init_remap()
382 if (nslabs <= IO_TLB_MIN_SLABS) in swiotlb_init_remap()
384 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE); in swiotlb_init_remap()
385 nareas = limit_nareas(nareas, nslabs); in swiotlb_init_remap()
388 if (default_nslabs != nslabs) { in swiotlb_init_remap()
390 default_nslabs, nslabs); in swiotlb_init_remap()
391 default_nslabs = nslabs; in swiotlb_init_remap()
394 alloc_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), nslabs)); in swiotlb_init_remap()
409 swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false, nareas); in swiotlb_init_remap()
427 int (*remap)(void *tlb, unsigned long nslabs)) in swiotlb_init_late() argument
430 unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE); in swiotlb_init_late() local
437 if (io_tlb_default_mem.nslabs) in swiotlb_init_late()
460 order = get_order(nslabs << IO_TLB_SHIFT); in swiotlb_init_late()
461 nslabs = SLABS_PER_PAGE << order; in swiotlb_init_late()
469 nslabs = SLABS_PER_PAGE << order; in swiotlb_init_late()
477 rc = remap(vstart, nslabs); in swiotlb_init_late()
481 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE); in swiotlb_init_late()
482 if (nslabs < IO_TLB_MIN_SLABS) in swiotlb_init_late()
493 nareas = limit_nareas(default_nareas, nslabs); in swiotlb_init_late()
501 get_order(array_size(sizeof(*mem->slots), nslabs))); in swiotlb_init_late()
506 (nslabs << IO_TLB_SHIFT) >> PAGE_SHIFT); in swiotlb_init_late()
507 swiotlb_init_io_tlb_pool(mem, virt_to_phys(vstart), nslabs, true, in swiotlb_init_late()
531 if (!mem->nslabs) in swiotlb_exit()
537 slots_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), mem->nslabs)); in swiotlb_exit()
680 unsigned long minslabs, unsigned long nslabs, in swiotlb_alloc_pool() argument
689 if (nslabs > SLABS_PER_PAGE << MAX_ORDER) { in swiotlb_alloc_pool()
690 nslabs = SLABS_PER_PAGE << MAX_ORDER; in swiotlb_alloc_pool()
691 nareas = limit_nareas(nareas, nslabs); in swiotlb_alloc_pool()
700 tlb_size = nslabs << IO_TLB_SHIFT; in swiotlb_alloc_pool()
702 if (nslabs <= minslabs) in swiotlb_alloc_pool()
704 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE); in swiotlb_alloc_pool()
705 nareas = limit_nareas(nareas, nslabs); in swiotlb_alloc_pool()
706 tlb_size = nslabs << IO_TLB_SHIFT; in swiotlb_alloc_pool()
709 slot_order = get_order(array_size(sizeof(*pool->slots), nslabs)); in swiotlb_alloc_pool()
715 swiotlb_init_io_tlb_pool(pool, page_to_phys(tlb), nslabs, true, nareas); in swiotlb_alloc_pool()
753 size_t slots_size = array_size(sizeof(*pool->slots), pool->nslabs); in swiotlb_dyn_free()
1124 unsigned long nslabs; in swiotlb_find_slots() local
1144 nslabs = nr_slots(alloc_size); in swiotlb_find_slots()
1146 pool = swiotlb_alloc_pool(dev, nslabs, nslabs, 1, phys_limit, in swiotlb_find_slots()
1278 if (!mem || !mem->nslabs) { in swiotlb_tbl_map_single()
1299 alloc_size, mem->nslabs, mem_used(mem)); in swiotlb_tbl_map_single()
1391 dec_used(dev->dma_io_tlb_mem, pool->nslabs); in swiotlb_del_transient()
1497 return io_tlb_default_mem.nslabs; in is_swiotlb_allocated()
1504 return mem && mem->nslabs; in is_swiotlb_active()
1575 if (!mem->nslabs) in swiotlb_create_debugfs_files()
1578 debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs); in swiotlb_create_debugfs_files()
1639 unsigned long nslabs = rmem->size >> IO_TLB_SHIFT; in rmem_swiotlb_device_init() local
1662 pool->slots = kcalloc(nslabs, sizeof(*pool->slots), GFP_KERNEL); in rmem_swiotlb_device_init()
1678 swiotlb_init_io_tlb_pool(pool, rmem->base, nslabs, in rmem_swiotlb_device_init()