Lines Matching refs:rcache
727 struct iova_rcache *rcache; in iova_domain_init_rcaches() local
729 rcache = &iovad->rcaches[i]; in iova_domain_init_rcaches()
730 spin_lock_init(&rcache->lock); in iova_domain_init_rcaches()
731 rcache->depot_size = 0; in iova_domain_init_rcaches()
732 rcache->cpu_rcaches = __alloc_percpu(sizeof(*cpu_rcache), in iova_domain_init_rcaches()
734 if (!rcache->cpu_rcaches) { in iova_domain_init_rcaches()
739 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in iova_domain_init_rcaches()
770 struct iova_rcache *rcache, in __iova_rcache_insert() argument
778 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_insert()
790 spin_lock(&rcache->lock); in __iova_rcache_insert()
791 if (rcache->depot_size < MAX_GLOBAL_MAGS) { in __iova_rcache_insert()
792 rcache->depot[rcache->depot_size++] = in __iova_rcache_insert()
797 spin_unlock(&rcache->lock); in __iova_rcache_insert()
833 static unsigned long __iova_rcache_get(struct iova_rcache *rcache, in __iova_rcache_get() argument
841 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_get()
850 spin_lock(&rcache->lock); in __iova_rcache_get()
851 if (rcache->depot_size > 0) { in __iova_rcache_get()
853 cpu_rcache->loaded = rcache->depot[--rcache->depot_size]; in __iova_rcache_get()
856 spin_unlock(&rcache->lock); in __iova_rcache_get()
889 struct iova_rcache *rcache; in free_iova_rcaches() local
895 rcache = &iovad->rcaches[i]; in free_iova_rcaches()
896 if (!rcache->cpu_rcaches) in free_iova_rcaches()
899 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_iova_rcaches()
903 free_percpu(rcache->cpu_rcaches); in free_iova_rcaches()
904 for (j = 0; j < rcache->depot_size; ++j) in free_iova_rcaches()
905 iova_magazine_free(rcache->depot[j]); in free_iova_rcaches()
918 struct iova_rcache *rcache; in free_cpu_cached_iovas() local
923 rcache = &iovad->rcaches[i]; in free_cpu_cached_iovas()
924 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_cpu_cached_iovas()
937 struct iova_rcache *rcache; in free_global_cached_iovas() local
942 rcache = &iovad->rcaches[i]; in free_global_cached_iovas()
943 spin_lock_irqsave(&rcache->lock, flags); in free_global_cached_iovas()
944 for (j = 0; j < rcache->depot_size; ++j) { in free_global_cached_iovas()
945 iova_magazine_free_pfns(rcache->depot[j], iovad); in free_global_cached_iovas()
946 iova_magazine_free(rcache->depot[j]); in free_global_cached_iovas()
948 rcache->depot_size = 0; in free_global_cached_iovas()
949 spin_unlock_irqrestore(&rcache->lock, flags); in free_global_cached_iovas()