diff options
author | Jonathan Marek <jonathan@marek.ca> | 2018-11-14 17:08:04 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2018-12-11 13:07:10 -0500 |
commit | c2052a4e5c99f7edcb0283e6e12b2fb6975b7353 (patch) | |
tree | 2c1b7d32227e42b3d757d3cce7b6a5af1fbdad4a /drivers/gpu/drm/msm/msm_gpu.c | |
parent | d1d9d0e1724d6a7123b4280fdf6630ae70f96c9c (diff) |
drm/msm: implement a2xx mmu
A2XX has its own very simple MMU.
Added a msm_use_mmu() function because we can't rely on iommu_present to
decide to use MMU or not.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gpu.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index c3909ba75b12..6e079a83bd36 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "msm_mmu.h" | 20 | #include "msm_mmu.h" |
21 | #include "msm_fence.h" | 21 | #include "msm_fence.h" |
22 | #include "msm_gpu_trace.h" | 22 | #include "msm_gpu_trace.h" |
23 | #include "adreno/adreno_gpu.h" | ||
23 | 24 | ||
24 | #include <generated/utsrelease.h> | 25 | #include <generated/utsrelease.h> |
25 | #include <linux/string_helpers.h> | 26 | #include <linux/string_helpers.h> |
@@ -822,7 +823,6 @@ static struct msm_gem_address_space * | |||
822 | msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev, | 823 | msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev, |
823 | uint64_t va_start, uint64_t va_end) | 824 | uint64_t va_start, uint64_t va_end) |
824 | { | 825 | { |
825 | struct iommu_domain *iommu; | ||
826 | struct msm_gem_address_space *aspace; | 826 | struct msm_gem_address_space *aspace; |
827 | int ret; | 827 | int ret; |
828 | 828 | ||
@@ -831,20 +831,27 @@ msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev, | |||
831 | * and have separate page tables per context. For now, to keep things | 831 | * and have separate page tables per context. For now, to keep things |
832 | * simple and to get something working, just use a single address space: | 832 | * simple and to get something working, just use a single address space: |
833 | */ | 833 | */ |
834 | iommu = iommu_domain_alloc(&platform_bus_type); | 834 | if (!adreno_is_a2xx(to_adreno_gpu(gpu))) { |
835 | if (!iommu) | 835 | struct iommu_domain *iommu = iommu_domain_alloc(&platform_bus_type); |
836 | return NULL; | 836 | if (!iommu) |
837 | 837 | return NULL; | |
838 | iommu->geometry.aperture_start = va_start; | 838 | |
839 | iommu->geometry.aperture_end = va_end; | 839 | iommu->geometry.aperture_start = va_start; |
840 | 840 | iommu->geometry.aperture_end = va_end; | |
841 | DRM_DEV_INFO(gpu->dev->dev, "%s: using IOMMU\n", gpu->name); | 841 | |
842 | DRM_DEV_INFO(gpu->dev->dev, "%s: using IOMMU\n", gpu->name); | ||
843 | |||
844 | aspace = msm_gem_address_space_create(&pdev->dev, iommu, "gpu"); | ||
845 | if (IS_ERR(aspace)) | ||
846 | iommu_domain_free(iommu); | ||
847 | } else { | ||
848 | aspace = msm_gem_address_space_create_a2xx(&pdev->dev, gpu, "gpu", | ||
849 | va_start, va_end); | ||
850 | } | ||
842 | 851 | ||
843 | aspace = msm_gem_address_space_create(&pdev->dev, iommu, "gpu"); | ||
844 | if (IS_ERR(aspace)) { | 852 | if (IS_ERR(aspace)) { |
845 | DRM_DEV_ERROR(gpu->dev->dev, "failed to init iommu: %ld\n", | 853 | DRM_DEV_ERROR(gpu->dev->dev, "failed to init mmu: %ld\n", |
846 | PTR_ERR(aspace)); | 854 | PTR_ERR(aspace)); |
847 | iommu_domain_free(iommu); | ||
848 | return ERR_CAST(aspace); | 855 | return ERR_CAST(aspace); |
849 | } | 856 | } |
850 | 857 | ||