Lines Matching refs:mag
602 struct iova_magazine *mag; in iova_magazine_alloc() local
604 mag = kmem_cache_alloc(iova_magazine_cache, flags); in iova_magazine_alloc()
605 if (mag) in iova_magazine_alloc()
606 mag->size = 0; in iova_magazine_alloc()
608 return mag; in iova_magazine_alloc()
611 static void iova_magazine_free(struct iova_magazine *mag) in iova_magazine_free() argument
613 kmem_cache_free(iova_magazine_cache, mag); in iova_magazine_free()
617 iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) in iova_magazine_free_pfns() argument
624 for (i = 0 ; i < mag->size; ++i) { in iova_magazine_free_pfns()
625 struct iova *iova = private_find_iova(iovad, mag->pfns[i]); in iova_magazine_free_pfns()
636 mag->size = 0; in iova_magazine_free_pfns()
639 static bool iova_magazine_full(struct iova_magazine *mag) in iova_magazine_full() argument
641 return mag->size == IOVA_MAG_SIZE; in iova_magazine_full()
644 static bool iova_magazine_empty(struct iova_magazine *mag) in iova_magazine_empty() argument
646 return mag->size == 0; in iova_magazine_empty()
649 static unsigned long iova_magazine_pop(struct iova_magazine *mag, in iova_magazine_pop() argument
656 for (i = mag->size - 1; mag->pfns[i] > limit_pfn; i--) in iova_magazine_pop()
661 pfn = mag->pfns[i]; in iova_magazine_pop()
662 mag->pfns[i] = mag->pfns[--mag->size]; in iova_magazine_pop()
667 static void iova_magazine_push(struct iova_magazine *mag, unsigned long pfn) in iova_magazine_push() argument
669 mag->pfns[mag->size++] = pfn; in iova_magazine_push()
674 struct iova_magazine *mag = rcache->depot; in iova_depot_pop() local
676 rcache->depot = mag->next; in iova_depot_pop()
677 mag->size = IOVA_MAG_SIZE; in iova_depot_pop()
679 return mag; in iova_depot_pop()
682 static void iova_depot_push(struct iova_rcache *rcache, struct iova_magazine *mag) in iova_depot_push() argument
684 mag->next = rcache->depot; in iova_depot_push()
685 rcache->depot = mag; in iova_depot_push()
692 struct iova_magazine *mag = NULL; in iova_depot_work_func() local
697 mag = iova_depot_pop(rcache); in iova_depot_work_func()
700 if (mag) { in iova_depot_work_func()
701 iova_magazine_free_pfns(mag, rcache->iovad); in iova_depot_work_func()
702 iova_magazine_free(mag); in iova_depot_work_func()
928 struct iova_magazine *mag = iova_depot_pop(rcache); in free_global_cached_iovas() local
930 iova_magazine_free_pfns(mag, iovad); in free_global_cached_iovas()
931 iova_magazine_free(mag); in free_global_cached_iovas()