Lines Matching defs:nslabs
233 if (!mem->nslabs) {
239 (mem->nslabs << IO_TLB_SHIFT) >> 20);
263 if (!mem->nslabs || mem->late_alloc)
265 bytes = PAGE_ALIGN(mem->nslabs << IO_TLB_SHIFT);
270 unsigned long nslabs, bool late_alloc, unsigned int nareas)
273 unsigned long bytes = nslabs << IO_TLB_SHIFT, i;
275 mem->nslabs = nslabs;
280 mem->area_nslabs = nslabs / mem->nareas;
288 for (i = 0; i < mem->nslabs; i++) {
290 mem->nslabs - i);
311 mem->nslabs += pool->nslabs;
314 mem->nslabs = pool->nslabs;
318 static void __init *swiotlb_memblock_alloc(unsigned long nslabs,
320 int (*remap)(void *tlb, unsigned long nslabs))
322 size_t bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT);
341 if (remap && remap(tlb, nslabs) < 0) {
355 int (*remap)(void *tlb, unsigned long nslabs))
358 unsigned long nslabs;
383 nslabs = default_nslabs;
384 nareas = limit_nareas(default_nareas, nslabs);
385 while ((tlb = swiotlb_memblock_alloc(nslabs, flags, remap)) == NULL) {
386 if (nslabs <= IO_TLB_MIN_SLABS)
388 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE);
389 nareas = limit_nareas(nareas, nslabs);
392 if (default_nslabs != nslabs) {
394 default_nslabs, nslabs);
395 default_nslabs = nslabs;
398 alloc_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), nslabs));
413 swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false, nareas);
431 int (*remap)(void *tlb, unsigned long nslabs))
434 unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE);
441 if (io_tlb_default_mem.nslabs)
464 order = get_order(nslabs << IO_TLB_SHIFT);
465 nslabs = SLABS_PER_PAGE << order;
473 nslabs = SLABS_PER_PAGE << order;
481 rc = remap(vstart, nslabs);
485 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE);
486 if (nslabs < IO_TLB_MIN_SLABS)
497 nareas = limit_nareas(default_nareas, nslabs);
505 get_order(array_size(sizeof(*mem->slots), nslabs)));
510 (nslabs << IO_TLB_SHIFT) >> PAGE_SHIFT);
511 swiotlb_init_io_tlb_pool(mem, virt_to_phys(vstart), nslabs, true,
535 if (!mem->nslabs)
541 slots_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), mem->nslabs));
672 * @nslabs: Desired (maximum) number of slabs.
678 * slabs may be reduced if allocation of @nslabs fails. If even
684 unsigned long minslabs, unsigned long nslabs,
693 if (nslabs > SLABS_PER_PAGE << MAX_PAGE_ORDER) {
694 nslabs = SLABS_PER_PAGE << MAX_PAGE_ORDER;
695 nareas = limit_nareas(nareas, nslabs);
704 tlb_size = nslabs << IO_TLB_SHIFT;
706 if (nslabs <= minslabs)
708 nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE);
709 nareas = limit_nareas(nareas, nslabs);
710 tlb_size = nslabs << IO_TLB_SHIFT;
713 slot_order = get_order(array_size(sizeof(*pool->slots), nslabs));
719 swiotlb_init_io_tlb_pool(pool, page_to_phys(tlb), nslabs, true, nareas);
757 size_t slots_size = array_size(sizeof(*pool->slots), pool->nslabs);
1187 unsigned long nslabs;
1209 nslabs = nr_slots(alloc_size);
1211 pool = swiotlb_alloc_pool(dev, nslabs, nslabs, 1, phys_limit,
1227 inc_transient_used(mem, pool->nslabs);
1382 if (!mem || !mem->nslabs) {
1408 size, mem->nslabs, mem_used(mem));
1516 dec_used(dev->dma_io_tlb_mem, pool->nslabs);
1518 dec_transient_used(dev->dma_io_tlb_mem, pool->nslabs);
1626 return io_tlb_default_mem.nslabs;
1633 return mem && mem->nslabs;
1718 if (!mem->nslabs)
1721 debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs);
1796 unsigned long nslabs = rmem->size >> IO_TLB_SHIFT;
1819 pool->slots = kcalloc(nslabs, sizeof(*pool->slots), GFP_KERNEL);
1835 swiotlb_init_io_tlb_pool(pool, rmem->base, nslabs,