• Home
  • Raw
  • Download

Lines Matching full:iova

14  * struct iova_bitmap_map - A bitmap representing an IOVA range
20 * total IOVA range. The struct iova_bitmap_map, though, represents the
21 * subset of said IOVA space that is pinned by its parent structure (struct
26 * records the IOVA *range* in the bitmap by setting the corresponding
29 * The bitmap is an array of u64 whereas each bit represents an IOVA of
32 * data[(iova / page_size) / 64] & (1ULL << (iova % 64))
35 /* base IOVA representing bit 0 of the first page */
36 unsigned long iova; member
52 * struct iova_bitmap - The IOVA bitmap object
56 * Abstracts the pinning work and iterates in IOVA ranges.
66 * For example iterating on a total IOVA range of 4G..128G, it will walk
72 * An example of the APIs on how to use/iterate over the IOVA bitmap:
74 * bitmap = iova_bitmap_alloc(iova, length, page_size, data);
82 * Each iteration of the @dirty_reporter_fn is called with a unique @iova
87 * iova_bitmap_set(bitmap, iova, iova_length);
94 * The IOVA bitmap is usually located on what tracks DMA mapped ranges or
95 * some form of IOVA range tracking that co-relates to the user passed
99 /* IOVA range representing the currently mapped bitmap data */
111 /* base IOVA of the whole bitmap */
112 unsigned long iova; member
114 /* length of the IOVA range for the whole bitmap */
119 * Converts a relative IOVA to a bitmap index.
121 * for a given IOVA offset.
122 * Relative IOVA means relative to the bitmap::mapped base IOVA
123 * (stored in mapped::iova). All computations in this file are done using
124 * relative IOVAs and thus avoid an extra subtraction against mapped::iova.
128 unsigned long iova) in iova_bitmap_offset_to_index()
132 return iova / (BITS_PER_TYPE(*bitmap->bitmap) * pgsize); in iova_bitmap_offset_to_index()
136 * Converts a bitmap index to a *relative* IOVA.
147 * Returns the base IOVA of the mapped range.
153 return bitmap->iova + iova_bitmap_index_to_offset(bitmap, skip); in iova_bitmap_mapped_iova()
158 * This is internal to IOVA bitmap and called when advancing the
197 /* Base IOVA where @pages point to i.e. bit 0 of the first page */ in iova_bitmap_get()
198 mapped->iova = iova_bitmap_mapped_iova(bitmap); in iova_bitmap_get()
225 * iova_bitmap_alloc() - Allocates an IOVA bitmap object
226 * @iova: Start address of the IOVA range
227 * @length: Length of the IOVA range
228 * @page_size: Page size of the IOVA bitmap. It defines what each bit
232 * Allocates an IOVA object and initializes all its fields including the
238 struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length, in iova_bitmap_alloc() argument
254 bitmap->iova = iova; in iova_bitmap_alloc()
256 mapped->iova = iova; in iova_bitmap_alloc()
274 * iova_bitmap_free() - Frees an IOVA bitmap object
275 * @bitmap: IOVA bitmap to free
312 * Returns the length of the mapped IOVA range.
316 unsigned long max_iova = bitmap->iova + bitmap->length - 1; in iova_bitmap_mapped_length()
317 unsigned long iova = iova_bitmap_mapped_iova(bitmap); in iova_bitmap_mapped_length() local
322 * when converted to IOVA gives us a max length that the bitmap in iova_bitmap_mapped_length()
324 * only cover the IOVA range in @bitmap::iova .. @bitmap::length. in iova_bitmap_mapped_length()
329 if (iova + remaining - 1 > max_iova) in iova_bitmap_mapped_length()
330 remaining -= ((iova + remaining - 1) - max_iova); in iova_bitmap_mapped_length()
350 unsigned long iova = iova_bitmap_mapped_length(bitmap) - 1; in iova_bitmap_advance() local
351 unsigned long count = iova_bitmap_offset_to_index(bitmap, iova) + 1; in iova_bitmap_advance()
365 * @bitmap: IOVA bitmap to iterate
367 * @fn: Function that gets called for each IOVA range
369 * Helper function to iterate over bitmap data representing a portion of IOVA
371 * mapped bitmap user pages into IOVA ranges to process.
393 * iova_bitmap_set() - Records an IOVA range in bitmap
394 * @bitmap: IOVA bitmap
395 * @iova: IOVA to start
396 * @length: IOVA range length
398 * Set the bits corresponding to the range [iova .. iova+length-1] in
403 unsigned long iova, size_t length) in iova_bitmap_set() argument
406 unsigned long cur_bit = ((iova - mapped->iova) >> in iova_bitmap_set()
408 unsigned long last_bit = (((iova + length - 1) - mapped->iova) >> in iova_bitmap_set()