Lines Matching defs:rcache

429  * alloc_iova_fast - allocates an iova from rcache
433 * @flush_rcache: - set to flush rcache on regular allocation failure
434 * This function tries to satisfy an iova allocation from the rcache,
436 * fails too and the flush_rcache flag is set then the rcache will be flushed.
466 /* Try replenishing IOVAs by flushing rcache. */
479 * free_iova_fast - free iova pfn range into rcache
483 * This functions frees an iova range by trying to put it into the rcache,
733 struct iova_rcache *rcache;
735 rcache = &iovad->rcaches[i];
736 spin_lock_init(&rcache->lock);
737 rcache->depot_size = 0;
738 rcache->cpu_rcaches = __alloc_percpu(sizeof(*cpu_rcache),
740 if (!rcache->cpu_rcaches) {
745 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
770 * Try inserting IOVA range starting with 'iova_pfn' into 'rcache', and
771 * return true on success. Can fail if rcache is full and we can't free
776 struct iova_rcache *rcache,
784 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches);
796 spin_lock(&rcache->lock);
797 if (rcache->depot_size < MAX_GLOBAL_MAGS) {
798 rcache->depot[rcache->depot_size++] =
803 spin_unlock(&rcache->lock);
835 * Caller wants to allocate a new IOVA range from 'rcache'. If we can
837 * it from the 'rcache'.
839 static unsigned long __iova_rcache_get(struct iova_rcache *rcache,
847 cpu_rcache = raw_cpu_ptr(rcache->cpu_rcaches);
856 spin_lock(&rcache->lock);
857 if (rcache->depot_size > 0) {
859 cpu_rcache->loaded = rcache->depot[--rcache->depot_size];
862 spin_unlock(&rcache->lock);
874 * Try to satisfy IOVA allocation range from rcache. Fail if requested
891 * free rcache data structures.
895 struct iova_rcache *rcache;
901 rcache = &iovad->rcaches[i];
902 if (!rcache->cpu_rcaches)
905 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
909 free_percpu(rcache->cpu_rcaches);
910 for (j = 0; j < rcache->depot_size; ++j)
911 iova_magazine_free(rcache->depot[j]);
924 struct iova_rcache *rcache;
929 rcache = &iovad->rcaches[i];
930 cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
943 struct iova_rcache *rcache;
948 rcache = &iovad->rcaches[i];
949 spin_lock_irqsave(&rcache->lock, flags);
950 for (j = 0; j < rcache->depot_size; ++j) {
951 iova_magazine_free_pfns(rcache->depot[j], iovad);
952 iova_magazine_free(rcache->depot[j]);
954 rcache->depot_size = 0;
955 spin_unlock_irqrestore(&rcache->lock, flags);