Add a granule_ignore option when tlb gather for some HW which don't care about granule when it flush tlb.
Signed-off-by: Yong Wu <yong...@mediatek.com> --- include/linux/iommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 794d4085edd3..1aad32238510 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -171,6 +171,7 @@ enum iommu_dev_features { * @start: IOVA representing the start of the range to be flushed * @end: IOVA representing the end of the range to be flushed (exclusive) * @pgsize: The interval at which to perform the flush + * @granule_ignore: For tlb flushing that could be regardless of granule. * * This structure is intended to be updated by multiple calls to the * ->unmap() function in struct iommu_ops before eventually being passed @@ -180,6 +181,7 @@ struct iommu_iotlb_gather { unsigned long start; unsigned long end; size_t pgsize; + bool granule_ignore; }; /** @@ -544,7 +546,7 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain, * a different granularity, then sync the TLB so that the gather * structure can be rewritten. */ - if (gather->pgsize != size || + if ((!gather->granule_ignore && gather->pgsize != size) || end < gather->start || start > gather->end) { if (gather->pgsize) iommu_iotlb_sync(domain, gather); -- 2.18.0