Lines Matching refs:cpu_rcache

726 		struct iova_cpu_rcache *cpu_rcache;  in iova_domain_init_rcaches()  local
732 rcache->cpu_rcaches = __alloc_percpu(sizeof(*cpu_rcache), in iova_domain_init_rcaches()
739 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in iova_domain_init_rcaches()
741 spin_lock_init(&cpu_rcache->lock); in iova_domain_init_rcaches()
742 cpu_rcache->loaded = iova_magazine_alloc(GFP_KERNEL); in iova_domain_init_rcaches()
743 cpu_rcache->prev = iova_magazine_alloc(GFP_KERNEL); in iova_domain_init_rcaches()
744 if (!cpu_rcache->loaded || !cpu_rcache->prev) { in iova_domain_init_rcaches()
774 struct iova_cpu_rcache *cpu_rcache; in __iova_rcache_insert() local
778 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_insert()
779 spin_lock_irqsave(&cpu_rcache->lock, flags); in __iova_rcache_insert()
781 if (!iova_magazine_full(cpu_rcache->loaded)) { in __iova_rcache_insert()
783 } else if (!iova_magazine_full(cpu_rcache->prev)) { in __iova_rcache_insert()
784 swap(cpu_rcache->prev, cpu_rcache->loaded); in __iova_rcache_insert()
793 cpu_rcache->loaded; in __iova_rcache_insert()
795 mag_to_free = cpu_rcache->loaded; in __iova_rcache_insert()
799 cpu_rcache->loaded = new_mag; in __iova_rcache_insert()
805 iova_magazine_push(cpu_rcache->loaded, iova_pfn); in __iova_rcache_insert()
807 spin_unlock_irqrestore(&cpu_rcache->lock, flags); in __iova_rcache_insert()
836 struct iova_cpu_rcache *cpu_rcache; in __iova_rcache_get() local
841 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches); in __iova_rcache_get()
842 spin_lock_irqsave(&cpu_rcache->lock, flags); in __iova_rcache_get()
844 if (!iova_magazine_empty(cpu_rcache->loaded)) { in __iova_rcache_get()
846 } else if (!iova_magazine_empty(cpu_rcache->prev)) { in __iova_rcache_get()
847 swap(cpu_rcache->prev, cpu_rcache->loaded); in __iova_rcache_get()
852 iova_magazine_free(cpu_rcache->loaded); in __iova_rcache_get()
853 cpu_rcache->loaded = rcache->depot[--rcache->depot_size]; in __iova_rcache_get()
860 iova_pfn = iova_magazine_pop(cpu_rcache->loaded, limit_pfn); in __iova_rcache_get()
862 spin_unlock_irqrestore(&cpu_rcache->lock, flags); in __iova_rcache_get()
890 struct iova_cpu_rcache *cpu_rcache; in free_iova_rcaches() local
899 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_iova_rcaches()
900 iova_magazine_free(cpu_rcache->loaded); in free_iova_rcaches()
901 iova_magazine_free(cpu_rcache->prev); in free_iova_rcaches()
917 struct iova_cpu_rcache *cpu_rcache; in free_cpu_cached_iovas() local
924 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu); in free_cpu_cached_iovas()
925 spin_lock_irqsave(&cpu_rcache->lock, flags); in free_cpu_cached_iovas()
926 iova_magazine_free_pfns(cpu_rcache->loaded, iovad); in free_cpu_cached_iovas()
927 iova_magazine_free_pfns(cpu_rcache->prev, iovad); in free_cpu_cached_iovas()
928 spin_unlock_irqrestore(&cpu_rcache->lock, flags); in free_cpu_cached_iovas()