Messages in this thread Patch in this message | | | From | John Garry <> | Subject | [PATCH 2/6] iova: Add a per-domain count of reserved nodes | Date | Fri, 19 Mar 2021 21:25:44 +0800 |
| |
To help learn if the domain has regular IOVA nodes, add a count of reserved nodes, calculated at init time.
Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/iommu/iova.c | 2 ++ include/linux/iova.h | 1 + 2 files changed, 3 insertions(+)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index e62e9e30b30c..cecc74fb8663 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -717,6 +717,8 @@ reserve_iova(struct iova_domain *iovad, * or need to insert remaining non overlap addr range */ iova = __insert_new_range(iovad, pfn_lo, pfn_hi); + if (iova) + iovad->reserved_node_count++; finish: spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); diff --git a/include/linux/iova.h b/include/linux/iova.h index c834c01c0a5b..fd3217a605b2 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -95,6 +95,7 @@ struct iova_domain { flush-queues */ atomic_t fq_timer_on; /* 1 when timer is active, 0 when not */ + int reserved_node_count; }; static inline unsigned long iova_size(struct iova *iova) -- 2.26.2
| |