Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: pm runtime support for iommu

In particular, attach() and unmap() need pm-runtime get/put to ensure
iommu clks are enabled.

Signed-off-by: Rob Clark <robdclark@gmail.com>

+14 -1
+14 -1
drivers/gpu/drm/msm/msm_iommu.c
··· 38 38 int cnt) 39 39 { 40 40 struct msm_iommu *iommu = to_msm_iommu(mmu); 41 - return iommu_attach_device(iommu->domain, mmu->dev); 41 + int ret; 42 + 43 + pm_runtime_get_sync(mmu->dev); 44 + ret = iommu_attach_device(iommu->domain, mmu->dev); 45 + pm_runtime_put_sync(mmu->dev); 46 + 47 + return ret; 42 48 } 43 49 44 50 static void msm_iommu_detach(struct msm_mmu *mmu, const char * const *names, 45 51 int cnt) 46 52 { 47 53 struct msm_iommu *iommu = to_msm_iommu(mmu); 54 + 55 + pm_runtime_get_sync(mmu->dev); 48 56 iommu_detach_device(iommu->domain, mmu->dev); 57 + pm_runtime_put_sync(mmu->dev); 49 58 } 50 59 51 60 static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova, ··· 63 54 struct msm_iommu *iommu = to_msm_iommu(mmu); 64 55 size_t ret; 65 56 57 + // pm_runtime_get_sync(mmu->dev); 66 58 ret = iommu_map_sg(iommu->domain, iova, sgt->sgl, sgt->nents, prot); 59 + // pm_runtime_put_sync(mmu->dev); 67 60 WARN_ON(ret < 0); 68 61 69 62 return (ret == len) ? 0 : -EINVAL; ··· 76 65 { 77 66 struct msm_iommu *iommu = to_msm_iommu(mmu); 78 67 68 + pm_runtime_get_sync(mmu->dev); 79 69 iommu_unmap(iommu->domain, iova, len); 70 + pm_runtime_put_sync(mmu->dev); 80 71 81 72 return 0; 82 73 }