Lines Matching refs:rcache
733 struct iova_rcache *rcache; in iova_domain_init_rcaches() local
735 rcache = &iovad->rcaches[i]; in iova_domain_init_rcaches()
736 spin_lock_init(&rcache->lock); in iova_domain_init_rcaches()
737 rcache->depot_size = 0; in iova_domain_init_rcaches()
738 rcache->cpu_rcaches = __alloc_percpu(sizeof(*cpu_rcache), in iova_domain_init_rcaches()
740 if (!rcache->cpu_rcaches) { in iova_domain_init_rcaches()
745 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in iova_domain_init_rcaches()
776 struct iova_rcache *rcache, in __iova_rcache_insert() argument
784 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_insert()
796 spin_lock(&rcache->lock); in __iova_rcache_insert()
797 if (rcache->depot_size < MAX_GLOBAL_MAGS) { in __iova_rcache_insert()
798 rcache->depot[rcache->depot_size++] = in __iova_rcache_insert()
803 spin_unlock(&rcache->lock); in __iova_rcache_insert()
839 static unsigned long __iova_rcache_get(struct iova_rcache *rcache, in __iova_rcache_get() argument
847 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_get()
856 spin_lock(&rcache->lock); in __iova_rcache_get()
857 if (rcache->depot_size > 0) { in __iova_rcache_get()
859 cpu_rcache->loaded = rcache->depot[--rcache->depot_size]; in __iova_rcache_get()
862 spin_unlock(&rcache->lock); in __iova_rcache_get()
895 struct iova_rcache *rcache; in free_iova_rcaches() local
901 rcache = &iovad->rcaches[i]; in free_iova_rcaches()
902 if (!rcache->cpu_rcaches) in free_iova_rcaches()
905 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_iova_rcaches()
909 free_percpu(rcache->cpu_rcaches); in free_iova_rcaches()
910 for (j = 0; j < rcache->depot_size; ++j) in free_iova_rcaches()
911 iova_magazine_free(rcache->depot[j]); in free_iova_rcaches()
924 struct iova_rcache *rcache; in free_cpu_cached_iovas() local
929 rcache = &iovad->rcaches[i]; in free_cpu_cached_iovas()
930 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_cpu_cached_iovas()
943 struct iova_rcache *rcache; in free_global_cached_iovas() local
948 rcache = &iovad->rcaches[i]; in free_global_cached_iovas()
949 spin_lock_irqsave(&rcache->lock, flags); in free_global_cached_iovas()
950 for (j = 0; j < rcache->depot_size; ++j) { in free_global_cached_iovas()
951 iova_magazine_free_pfns(rcache->depot[j], iovad); in free_global_cached_iovas()
952 iova_magazine_free(rcache->depot[j]); in free_global_cached_iovas()
954 rcache->depot_size = 0; in free_global_cached_iovas()
955 spin_unlock_irqrestore(&rcache->lock, flags); in free_global_cached_iovas()