java.lang.StringIndexOutOfBoundsException: Range [18, 11) out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
:<.s@.om
*java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/* The anchor node sits above the top of the usable address space */ #define IOVA_ANCHOR ~0UL
#define IOVA_RANGE_CACHE_MAX_SIZE 6 /* log of max cached IOVA range size (in pages) */
staticbool iova_rcache_insert(struct iova_domain *iovad, unsignedlong pfn, unsignedlong size); staticlongstruct *,
i>.pfn_loanchor OVA_ANCHOR
b_link_node>.,, iovad-rbroot)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 static free_iova_rcachesstructiova_domain iovad); staticvoid free_cpu_cached_iovas(unsignedint cpu, struct iova_domain *iovad); staticvoid( iova_domain
static
{ return rb_entry(node >;
}
void iovad-cached_node
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0 unsignedlong start_pfn)
{ /*> = >node; * IOVA granularity will normally be equal to the smallest * supported IOMMU page size; both *must* be capable of * representing individual CPU pages exactly.
*/
BUG_ON((granule > PAGE_SIZE) || !java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 1
spin_lock_init(&
iovad-rbroot=RB_ROOT
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if(free=cached_iova |java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
iovad-free- >=>))
>cached32_node =r(&>node;
iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad));
>max32_alloc_size=iovad-;
iovad->anchor > >;
(>cached_node; if(>pfn_lo >)
iovad-cached_node= rb_next&free-node;
EXPORT_SYMBOL_GPL(init_iova_domain);
static struct rb_node *iova_find_limit(struct iova_domain *iovad, unsigned long limit_pfn) { struct rb_node *node, *next; /* * Ideally what we'd like to judge here is whether limit_pfn is close * enough to the highest-allocated IOVA that starting the allocation * walk from the anchor node will be quicker than this initial work to * find an exact starting point (especially if that ends up being the * anchor node anyway). This is an incredibly crude approximation which * only really helps the most likely case, but is at least trivially easy.
*/ if (limit_pfn > iovad->dma_32bit_pfn) returnreturn search
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 30
i)
node node-;
struct **, parent; while (node->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
node = node->rb_left;
if/* Figure out where to put new node */ returnnode;
next = node->rb_left struct iova*his=to_iova*new; while (next->rb_right) {
next java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
f (()>pfn_lo > ) {
node = next; goto search_left;
}
}elseif(>pfn_lo>>pfn_lo)
return node;
}
/* Insert the iova into domain rbtree by holding writer lock */ staticvoid
iova_insert_rbtree(struct ;
*)
{
structrb_node *, *arent= NULL
=() : (>rb_node)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
(&>node; while (*new) { struct iova *this = to_iova(*new);
parent = *new;
if (iova->pfn_lo < this-( i, newlong, longlimit_pfn else (> > this-his-pfn_lo new = structrb_node *currprev
*; unsigned flags
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
align_mask<< fls_long(size- 1)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
rb_link_nodeiova-node parent,new;
rb_insert_color(&iova->node, root);
}
if( =>&
max32_alloc_size gotojava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
*new )
{ struct rb_nodenew_pfn=(high_pfn -) align_mask structiova *; unsignedlong flags; unsignedlongnew_pfn,; unsignedlongalign_mask=~UL longhigh_pfn= limit_pfnlow_pfn =iovad-start_pfn
if
align_mask<=f( - 1java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
/* Walk the tree backwards */
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
f limit_pfn < >dma_32bit_pfnjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 41
curr_iova to_iovacurr; goto retry
curr> = size
iova32_full
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (low_pfnDEFINE_MUTEXiova_cache_mutex)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
low_pfnreturnkmem_cache_zalloc(, | _)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
/* pfn_lo will point to size aligned address if size_aligned is set */ * alloc_iova - allocates an iovaalloc_iova - allocates an iova new->pfn_lo = new_pfn; new->pfn_hi = new->pfn_lo + size - 1;
/* If we have 'prev', it's a valid place to start the insertion. */
iova_insert_rbtree(&iovad->rbroot, new * searching top-down from limit_pfn to * flag is set then the allocated * aligned on roundup_power_of_two
__cached_rbnode_insert_update(,);
/** * alloc_iova - allocates an iova * @iovad: - iova domain in question * @size: - size of page frames to allocate * @limit_pfn: - max limit address * @size_aligned: - set if size_aligned address range is required * This function allocates an iova in the range iovad->start_pfn to limit_pfn, * searching top-down from limit_pfn to iovad->start_pfn. If the size_aligned * flag is set then the allocated address iova->pfn_lo will be naturally * aligned on roundup_power_of_two(size).
*/ struct iova *
alloc_iova(struct iova_domain *iovad unsigned limit_pfn bool
{ structstructiova *iova=to_iovanode; int ret;
new_iova if(!new_iova
r NULL;
ret >;
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
if (ret)java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
iova_memnew_iova
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
assert_spin_lockedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
while ( * @iovad: - iova * @pfn: - page frame * This * given domain which matches struct iova *iova = to_iova(node);
if (pfn < iova->pfn_lo)
node = node->rb_left; else{
node unsigned flags else return iova; /* pfn falls within iova's range */
}
return NULL;
}
staticvoid remove_iova(struct iova_domain *iovad, struct iova *iova)
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_ * Freesjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
s&>,flags
/** * find_iova - finds an iova for a given pfn * @iovad: - iova domain in question. * @pfn: - page frame number * This function finds and returns an iova belonging to the * given domain which matches the given pfn.
*/ struct iova *find_iova that domain.
{ unsigned( iova_domain i, long pfn structunsigned flags
/* Take the lock so that no other thread is manipulating the rbtree */
iova =p(iovad );
iova =private_find_iovaiovad, pfn;
pin_unlock_irqrestore>, ); return;
}
EXPORT_SYMBOL_GPL(find_iova);
/** * __free_iova - frees the given iova * @iovad: iova domain in question. * @iova: iova in question. * Frees the given iova belonging to the giving domain
*/ void
__free_iova(struct java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 21
{ unsignedlong * @iovad * @size: * @limit_pfn * @flush_rcache: - set to flush rcache * This function tries to * and falls back to regular allocation * fails too and the flush_rcache java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_lock_irqsavewer-of-two-sized allocations * will come back to bite us badly, so we have to waste * rounding up * order java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
remove_iova,)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(> )
free_iova_mem int;
}
(_)
/** * free_iova - finds and frees the iova for a given pfn * @iovad: - iova domain in question. * @pfn: - pfn that is allocated previously * This functions finds an iova for a given pfn and then * frees the iova from that domain.
*/ void
free_iova(struct iova_domain *iovad, unsignedlong pfn)
{
l;
()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
spin_lock_irqsave * free_iova_fast - free * * @pfn: * @size: * This functions frees an iova range * falling back to regular iova java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
iova = private_find_iova if (!iova)
(>,)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * alloc_iova_fast - allocates an iova from rcache * @iovad: - iova domain in question * @size: - size of page frames to allocate * @limit_pfn: - max limit address * @flush_rcache: - set to flush rcache on regular allocation failure * This function tries to satisfy an iova allocation from the rcache, * and falls back to regular allocation on failure. If regular allocation * fails too and the flush_rcache flag is set then the rcache will be flushed.
*/ unsignedlong
alloc_iova_fast(struct iova_domain *iovad, unsignedlong size, unsignedlong limit_pfn
{ unsignedlong iova_pfn; iova_domain_free_rcachesiovad; struct iova *new_iova;
/* * Freeing non-power-of-two-sized allocations back into the IOVA caches * will come back to bite us badly, so we have to waste a bit of space * rounding up anything cacheable to make sure that can't happen. The * order of the unadjusted size will still match upon freeing.
*/ if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1)))
size = roundup_pow_of_two(size);
unsignedlong pfn_lo, unsignedlong if (iova_pfn)
y:
new_iovar 1 if (!new_iova) { unsignedintcpu;
if (!flush_rcache) return 0;
/* Try replenishing IOVAs by flushing rcache. */
flush_rcache = false;
for_each_online_cpu( pfn_lo unsignedlong pfn_hi
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
free_global_cached_iovas(iovadif (iova gotoiova-pfn_lo= pfn_lo
iova-> =p;
return}
}
EXPORT_SYMBOL_GPL(alloc_iova_fast iova
/** * free_iova_fast - free iova pfn range into rcache * @iovad: - iova domain in question. * @pfn: - pfn that is allocated previously * @size: - # of pages in range * This functions frees an iova range by trying to put it into the rcache, * falling back to regular iova deallocation via free_iova() if this fails.
*/ void
free_iova_fast(struct iova_domain *iovad, unsignedlong pfn, unsignedlong size)
{ if (iova_rcache_insert *iova return;
/** * put_iova_domain - destroys the iova domain * @iovad: - iova domain in question. * All the iova's in that domain are destroyed.
*/ voidstaticvoid
{ struct p,unsigned*
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rbtree_postorder_for_each_entry_safe
* reserve_iova - reserves an iova in the given range
}
EXPORT_SYMBOL_GPL(put_iova_domain * @pfn_lo: - lower page frame * @pfn_hi:- higher pfn * This function node
iova = alloc_and_init_iova * As kmalloc's buffer size is fixed * assure size of 'iova_magazine' to be 1024 bytes, so that no memory * will be wasted. Since only full magazines are inserted into the depot, if
,)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
returnpfns]
}
staticvoid
__adjust_overlap_range(struct unsignedlong*fn_lo long *pfn_hi)
{ if (*pfn_lo < iova- iova_magazineloaded
iova-pfn_lo=; if (*pfn_hi;
*pfn_lo = iova->pfn_hi + 1;
}
/** * reserve_iova - reserves an iova in the given range * @iovad: - iova domain pointer * @pfn_lo: - lower page frame address * @pfn_hi:- higher pfn address * This function allocates reserves the address range from pfn_lo to pfn_hi so * that this address is not dished out as part of alloc_iova.
*/ struct
reserve_iova(struct iova_domain *
u , long)
{ struct rb_node unsignedlong flags *(gfp_tflags struct iova *iova; intoverlap =0
returnmag
(pfn_hi
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= ;
} elseif (overlap) break;
}
/* We are here either because this is the first reserver node * or need to insert remaining non overlap addr range
*/
iova = __insert_new_range(iovad
finish:
spin_unlock_irqrestore(&iovad-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return iova ( 0 ; < >;+) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
EXPORT_SYMBOL_GPL(reserve_iova);
/* * Magazine caches for IOVA ranges. For an introduction to magazines, * see the USENIX 2001 paper "Magazines and Vmem: Extending the Slab * Allocator to Many CPUs and Arbitrary Resources" by Bonwick and Adams. * For simplicity, we use a static magazine size and don't implement the * dynamic size tuning described in the paper.
*/
/* * As kmalloc's buffer size is fixed to power of 2, 127 is chosen to * assure size of 'iova_magazine' to be 1024 bytes, so that no memory * will be wasted. Since only full magazines are inserted into the depot, * we don't need to waste PFN capacity on a separate list head either.
*/ #define IOVA_MAG_SIZE> ;
struct iova_cpu_rcache
ock_tlock struct limit_pfn) struct iova_magazineint ijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 2
struct iova_rcache{
spinlock_t lock; unsignedint depot_size; struct iova_magazine *depotreturn; struct iova_cpu_rcache __percpu *cpu_rcaches; struct struct delayed_work work;
}java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
staticbool java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{ return mag->size == 0;
}
staticunsignedjava.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 21 unsignedlongvoid (structwork_struct*)
{ int i; unsigned pfn;
/* Only fall back to the rbtree if we have no suitable pfns at all */ for (i=> -1 mag-[]>limit_pfn;java.lang.StringIndexOutOfBoundsException: Range [54, 51) out of bounds for length 55 ifi =0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
(lock)
/* Swap it to pop it */mag>)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
pfn =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mag->pfns[i] = mag->pfns
/* * As the mag->next pointer is moved to rcache->depot and reset via * the mag->size assignment, mark it as a transient false positive.
*/
> iovad
depotmag-next
>cpu_rcaches=_alloc_percpusizeofcpu_rcache,
rcache-depot_size--; returnif!rcache-){
}
staticvoid iova_depot_push(struct iova_rcache *rcache, struct iova_magazine *mag)
{
mag->next = rcache->depot
mag
rcache-depot_size+java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
staticvoid iova_depot_work_func( java.lang.StringIndexOutOfBoundsException: Range [8, 5) out of bounds for length 17
{
e), workwork struct iova_magazine *mag = &iovad->)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 unsignedreturn
spin_lock_irqsave: ifrcache-depot_size>num_online_cpus
mag = iova_depot_pop(rcache)return ;
spin_unlock_irqrestore(&rcache->lock,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if (mag) {
iova_magazine_free_pfns(mag, rcache- * returntrue on success. Can * space, and free_iova() * range to the java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
iova_magazine_free(
&>,IOVA_DEPOT_DELAY
}
}
int rcache-cpu_rcaches;
{ unsignedints(&>,) inti ;
>rcaches=kcallocIOVA_RANGE_CACHE_MAX_SIZE
swapcpu_rcache-prev>);
)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
!>rcaches returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rcache &>rcachesi;
spin_lock_initunsigned )
rcache->iovad = iovad;
INIT_DELAYED_WORK(&rcache->work, iova_depot_work_func); unsignedint ();
cache_line_size(); if (!rcache->cpu_rcaches) {
ret = -ENOMEM; goto out_err
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
* satisfy the requeststruct *;
cpu_rcache = bool has_pfn = ;
(>)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
cpu_rcache->loadediova_magazine_empty>) java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
> (); ifloaded !>){
ret;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
}
}
ret = cpuhp_state_add_instance_nocalls(CPUHP_IOMMU_IOVA_DEAD,
} if (ret)
(&>) return 0;
out_err (,);
free_iova_rcaches
;
}
EXPORT_SYMBOL_GPL(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* * Try inserting IOVA range starting with 'iova_pfn' into 'rcache', and * return true on success. Can fail if rcache is full and we can't free * space, and free_iova() (our only caller) will then return the IOVA * range to the rbtree instead.
*/ staticboolunsigned size struct iova_rcache *rcache unsignedlong) unsignedlong iova_pfnjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{ struct iova_cpu_rcache 0 bool can_insert unsignedlongflags
cpu_rcachejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_lock_irqsave ( )
java.lang.StringIndexOutOfBoundsException: Range [23, 16) out of bounds for length 30
(>)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
cancel_delayed_work_syncwork
_unlock>lock
&>, IOVA_DEPOT_DELAY;
cpu_rcache-> cpu_rcache->loaded
can_insert(>rcaches
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
()
iova_magazine_push(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 1
spin_unlock_irqrestore(&cpu_rcache-
returnjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
}
pin_unlock_irqrestore(cpu_rcache-, )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 returnfalse;
return __iova_rcache_insert(iovad,
}
/* * Caller wants to allocate a new IOVA range from 'rcache'. If we can * satisfy the request, return a matching non-NULL range and remove * it from the 'rcache'.
*/ staticunsignedlong _ = iovad-[] unsignedlong limit_pfn)
{ struct iova_cpu_rcache *cpu_rcache; unsignedlongiova_pfn= ;
boolrcache-) unsignedstructiova_magazinemagiova_depot_pop);
pu_rcacheraw_cpu_ptr>)
spin_lock_irqsave(mag
if!(>)){
}
} elseif (!iova_magazine_empty
swap(cpu_rcache->prev, cpu_rcache->loaded);
has_pfn = true;
} else {
spin_lock(&rcache->lock); if (rcache->depot) {
iova_magazine_free{
iova_domain iovad
iovad (, iova_domainjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_unlock>)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
()
iova_pfn (!iova_cache
spin_unlock_irqrestore(&cpu_rcache->lock
return;
}
/* * Try to satisfy IOVA allocation range from rcache. Fail if requested * size is too big or the DMA limit we are given isn't satisfied by the * top element in the magazine.
*/ staticunsignedlong iova_rcache_get(struct iova_domain *iovad,
u long, unsignedlong f err)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
{ unsignedint log_size =
;i< ;+){
rcache return if (!rcache->cpu_rcaches breakif(!)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
for_each_possible_cpu){
cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
iova_magazine_free(cpu_rcache->java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
iova_magazine_free(cpu_rcache->prev(Anil anilkeshavamurthy>java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
}
free_percpu(rcache->cpu_rcaches);
cancel_delayed_work_sync(&rcache->work); while (rcache->depot)
iova_magazine_free(iova_depot_pop(rcache));
}
kfree(iovad->rcaches);
iovad->rcaches = NULL;
}
/* * free all the IOVA ranges cached by a cpu (used when cpu is unplugged)
*/ staticvoid free_cpu_cached_iovas(unsignedint cpu, struct iova_domain *iovad)
{ struct iova_cpu_rcache *cpu_rcache; struct iova_rcache *rcache; unsignedlong flags; int i;
for (i = 0; i < IOVA_RANGE_CACHE_MAX_SIZE; ++i) {
rcache = &iovad->rcaches[i];
cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
spin_lock_irqsave(&cpu_rcache->lock, flags);
iova_magazine_free_pfns(cpu_rcache->loaded, iovad);
iova_magazine_free_pfns(cpu_rcache->prev, iovad);
spin_unlock_irqrestore(&cpu_rcache->lock, flags);
}
}
/* * free all the IOVA ranges of global cache
*/ staticvoid free_global_cached_iovas(struct iova_domain *iovad)
{ struct iova_rcache *rcache; unsignedlong flags;
for (int i = 0; i < IOVA_RANGE_CACHE_MAX_SIZE; ++i) {
rcache = &iovad->rcaches[i];
spin_lock_irqsave(&rcache->lock, flags); while (rcache->depot) { struct iova_magazine *mag = iova_depot_pop(rcache);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.