Commit 62280cf2 authored by Robin Murphy's avatar Robin Murphy Committed by Joerg Roedel

iommu/iova: Extend cached node lookup condition

When searching for a free IOVA range, we optimise the tree traversal
by starting from the cached32_node, instead of the last node, when
limit_pfn is equal to dma_32bit_pfn. However, if limit_pfn happens to
be smaller, then we'll go ahead and start from the top even though
dma_32bit_pfn is still a more suitable upper bound. Since this is
clearly a silly thing to do, adjust the lookup condition appropriately.
Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 5d1d43b0
...@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(init_iova_domain); ...@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(init_iova_domain);
static struct rb_node * static struct rb_node *
__get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn) __get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn)
{ {
if ((*limit_pfn != iovad->dma_32bit_pfn) || if ((*limit_pfn > iovad->dma_32bit_pfn) ||
(iovad->cached32_node == NULL)) (iovad->cached32_node == NULL))
return rb_last(&iovad->rbroot); return rb_last(&iovad->rbroot);
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment