[PATCH 4/4] iova-dbg2
Chris Wilson
chris at chris-wilson.co.uk
Wed Jan 13 10:37:21 UTC 2021
---
drivers/iommu/iova.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 10e411b0edaf..8762f4f01e04 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -195,8 +195,11 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
/* Walk the tree backwards */
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
if (limit_pfn <= iovad->dma_32bit_pfn &&
- size >= iovad->max32_alloc_size)
+ size >= iovad->max32_alloc_size) {
+ pr_err("%s size:%lu, limit_pfn:%lu, 32bit_pfn:%lu, 32bit_max:%lu\n",
+ __func__, size, limit_pfn, iovad->dma_32bit_pfn, iovad->max32_alloc_size);
goto iova32_full;
+ }
curr = __get_cached_rbnode(iovad, limit_pfn);
curr_iova = rb_entry(curr, struct iova, node);
@@ -213,13 +216,15 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
if (high_pfn < size || new_pfn < low_pfn) {
if (low_pfn == iovad->start_pfn && retry_pfn < limit_pfn) {
+ pr_err("%s retry\n", __func__);
high_pfn = limit_pfn;
low_pfn = retry_pfn;
curr = &iovad->anchor.node;
curr_iova = rb_entry(curr, struct iova, node);
goto retry;
}
- iovad->max32_alloc_size = size;
+ iovad->max32_alloc_size =
+ min(iovad->max32_alloc_size, size);
goto iova32_full;
}
@@ -309,8 +314,10 @@ alloc_iova(struct iova_domain *iovad, unsigned long size,
int ret;
new_iova = alloc_iova_mem();
- if (!new_iova)
+ if (!new_iova) {
+ pr_err("alloc_iova_mem\n");
return NULL;
+ }
ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn + 1,
new_iova, size_aligned);
--
2.20.1
More information about the Intel-gfx-trybot
mailing list