[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNp60ak6OASbPd_J@google.com>
Date: Mon, 29 Sep 2025 12:25:53 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: Daniel Mentz <danielmentz@...gle.com>
Cc: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
Will Deacon <will@...nel.org>,
Pranjal Shrivastava <praan@...gle.com>,
Liviu Dudau <liviu.dudau@....com>, Jason Gunthorpe <jgg@...dia.com>,
Rob Clark <robin.clark@....qualcomm.com>
Subject: Re: [PATCH 2/2] drivers/arm-smmu-v3: Implement .iotlb_sync_map
callback
On Sat, Sep 27, 2025 at 10:39:53PM +0000, Daniel Mentz wrote:
> Implement .iotlb_sync_map callback based on the new callback in the
> io-pgtable code.
>
> Signed-off-by: Daniel Mentz <danielmentz@...gle.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 2a8b46b948f0..0ffcc6c8e4bf 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2541,6 +2541,7 @@ static int arm_smmu_domain_finalise(struct arm_smmu_domain *smmu_domain,
> pgtbl_cfg = (struct io_pgtable_cfg) {
> .pgsize_bitmap = smmu->pgsize_bitmap,
> .coherent_walk = smmu->features & ARM_SMMU_FEAT_COHERENCY,
> + .defer_sync_pte = true,
> .tlb = &arm_smmu_flush_ops,
> .iommu_dev = smmu->dev,
> };
> @@ -3366,6 +3367,18 @@ static int arm_smmu_map_pages(struct iommu_domain *domain, unsigned long iova,
> return ops->map_pages(ops, iova, paddr, pgsize, pgcount, prot, gfp, mapped);
> }
>
> +static int arm_smmu_iotlb_sync_map(struct iommu_domain *domain,
> + unsigned long iova, size_t size)
> +{
> + struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops;
> +
> + if (!ops || !ops->iotlb_sync_map)
> + return 0;
> +
> + ops->iotlb_sync_map(ops, iova, size);
> + return 0;
Shouldn't that be
return ops->iotlb_sync_map(ops, iova, size);
As now we ignore the return from the ops and mask it to 0.
Thanks,
Mostafa
> +}
> +
> static size_t arm_smmu_unmap_pages(struct iommu_domain *domain, unsigned long iova,
> size_t pgsize, size_t pgcount,
> struct iommu_iotlb_gather *gather)
> @@ -3700,6 +3713,7 @@ static const struct iommu_ops arm_smmu_ops = {
> .map_pages = arm_smmu_map_pages,
> .unmap_pages = arm_smmu_unmap_pages,
> .flush_iotlb_all = arm_smmu_flush_iotlb_all,
> + .iotlb_sync_map = arm_smmu_iotlb_sync_map,
> .iotlb_sync = arm_smmu_iotlb_sync,
> .iova_to_phys = arm_smmu_iova_to_phys,
> .free = arm_smmu_domain_free_paging,
> --
> 2.51.0.570.gb178f27e6d-goog
>
Powered by blists - more mailing lists