iommu/msm: Hook up iotlb_sync_map
authorRobin Murphy <robin.murphy@arm.com>
Wed, 27 Jan 2021 16:29:28 +0000 (16:29 +0000)
committerWill Deacon <will@kernel.org>
Thu, 28 Jan 2021 20:29:56 +0000 (20:29 +0000)
The core API can now accommodate invalidate-on-map style behaviour in a
single efficient call, so hook that up instead of having io-pgatble do
it piecemeal.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/e95223a0abf129230a0bec6743f837075f0a2fcb.1611764372.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/msm_iommu.c

index 040e85f..f0ba6a0 100644 (file)
@@ -343,7 +343,6 @@ static int msm_iommu_domain_config(struct msm_priv *priv)
        spin_lock_init(&priv->pgtlock);
 
        priv->cfg = (struct io_pgtable_cfg) {
-               .quirks = IO_PGTABLE_QUIRK_TLBI_ON_MAP,
                .pgsize_bitmap = msm_iommu_ops.pgsize_bitmap,
                .ias = 32,
                .oas = 32,
@@ -490,6 +489,14 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
        return ret;
 }
 
+static void msm_iommu_sync_map(struct iommu_domain *domain, unsigned long iova,
+                              size_t size)
+{
+       struct msm_priv *priv = to_msm_priv(domain);
+
+       __flush_iotlb_range(iova, size, SZ_4K, false, priv);
+}
+
 static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
                              size_t len, struct iommu_iotlb_gather *gather)
 {
@@ -680,6 +687,7 @@ static struct iommu_ops msm_iommu_ops = {
         * kick starting the other master.
         */
        .iotlb_sync = NULL,
+       .iotlb_sync_map = msm_iommu_sync_map,
        .iova_to_phys = msm_iommu_iova_to_phys,
        .probe_device = msm_iommu_probe_device,
        .release_device = msm_iommu_release_device,