[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1623760166.24285.1.camel@mhfsdcap03>
Date: Tue, 15 Jun 2021 20:29:26 +0800
From: Yong Wu <yong.wu@...iatek.com>
To: Nadav Amit <nadav.amit@...il.com>
CC: Joerg Roedel <joro@...tes.org>,
Robin Murphy <robin.murphy@....com>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux-foundation.org>,
Jiajun Cao <caojiajun@...are.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH v3 3/6] iommu: Improve iommu_iotlb_gather helpers
On Mon, 2021-06-07 at 11:25 -0700, Nadav Amit wrote:
> From: Robin Murphy <robin.murphy@....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 <joro@...tes.org>
> Cc: Will Deacon <will@...nel.org>
> Cc: Jiajun Cao <caojiajun@...are.com>
> Cc: Robin Murphy <robin.murphy@....com>
> Cc: Lu Baolu <baolu.lu@...ux.intel.com>
> Cc: iommu@...ts.linux-foundation.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Robin Murphy <robin.murphy@....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]
Powered by blists - more mailing lists