On Mon, 2021-06-07 at 11:25 -0700, Nadav Amit wrote:
> From: Robin Murphy <robin.mur...@arm.com>
> 
> The Mediatek driver is not the only one which might want a basic
> address-based gathering behaviour, so although it's arguably simple
> enough to open-code, let's factor it out for the sake of cleanliness.
> Let's also take this opportunity to document the intent of these
> helpers for clarity.
> 
> Cc: Joerg Roedel <j...@8bytes.org>
> Cc: Will Deacon <w...@kernel.org>
> Cc: Jiajun Cao <caojia...@vmware.com>
> Cc: Robin Murphy <robin.mur...@arm.com>
> Cc: Lu Baolu <baolu...@linux.intel.com>
> Cc: iommu@lists.linux-foundation.org
> Cc: linux-ker...@vger.kernel.org
> Signed-off-by: Robin Murphy <robin.mur...@arm.com>
> 
> ---
> 
> Changes from Robin's version:
> * Added iommu_iotlb_gather_add_range() stub !CONFIG_IOMMU_API
> * Use iommu_iotlb_gather_add_range() in iommu_iotlb_gather_add_page()
> ---
>  drivers/iommu/mtk_iommu.c |  5 +----
>  include/linux/iommu.h     | 43 ++++++++++++++++++++++++++++++++++-----
>  2 files changed, 39 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index e06b8a0e2b56..0af4a91ac7da 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -523,10 +523,7 @@ static size_t mtk_iommu_unmap(struct iommu_domain 
> *domain,
>       struct mtk_iommu_domain *dom = to_mtk_domain(domain);
>       unsigned long end = iova + size - 1;

Please also help delete this "end".

>  
> -     if (gather->start > iova)
> -             gather->start = iova;
> -     if (gather->end < end)
> -             gather->end = end;
> +     iommu_iotlb_gather_add_range(gather, iova, size);
>       return dom->iop->unmap(dom->iop, iova, size, gather);
>  }

[snip] 


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to