diff options
Diffstat (limited to 'drivers/pci/iova.c')
-rw-r--r-- | drivers/pci/iova.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c index 7914951ef29a..c5c274ab5c5a 100644 --- a/drivers/pci/iova.c +++ b/drivers/pci/iova.c | |||
@@ -63,8 +63,16 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) | |||
63 | curr = iovad->cached32_node; | 63 | curr = iovad->cached32_node; |
64 | cached_iova = container_of(curr, struct iova, node); | 64 | cached_iova = container_of(curr, struct iova, node); |
65 | 65 | ||
66 | if (free->pfn_lo >= cached_iova->pfn_lo) | 66 | if (free->pfn_lo >= cached_iova->pfn_lo) { |
67 | iovad->cached32_node = rb_next(&free->node); | 67 | struct rb_node *node = rb_next(&free->node); |
68 | struct iova *iova = container_of(node, struct iova, node); | ||
69 | |||
70 | /* only cache if it's below 32bit pfn */ | ||
71 | if (node && iova->pfn_lo < iovad->dma_32bit_pfn) | ||
72 | iovad->cached32_node = node; | ||
73 | else | ||
74 | iovad->cached32_node = NULL; | ||
75 | } | ||
68 | } | 76 | } |
69 | 77 | ||
70 | /* Computes the padding size required, to make the | 78 | /* Computes the padding size required, to make the |
@@ -391,7 +399,7 @@ reserve_iova(struct iova_domain *iovad, | |||
391 | break; | 399 | break; |
392 | } | 400 | } |
393 | 401 | ||
394 | /* We are here either becasue this is the first reserver node | 402 | /* We are here either because this is the first reserver node |
395 | * or need to insert remaining non overlap addr range | 403 | * or need to insert remaining non overlap addr range |
396 | */ | 404 | */ |
397 | iova = __insert_new_range(iovad, pfn_lo, pfn_hi); | 405 | iova = __insert_new_range(iovad, pfn_lo, pfn_hi); |