]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iommu/iova: Extend cached node lookup condition
authorRobin Murphy <robin.murphy@arm.com>
Fri, 11 Nov 2016 18:35:46 +0000 (18:35 +0000)
committerJoerg Roedel <jroedel@suse.de>
Tue, 15 Nov 2016 11:39:52 +0000 (12:39 +0100)
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: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iova.c

index e23001bfcfee996f8ab18f1695d1e3476bc6b9c2..080beca0197dcec22802dfc7fc0aebbbfec3c023 100644 (file)
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(init_iova_domain);
 static struct rb_node *
 __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))
                return rb_last(&iovad->rbroot);
        else {