]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 22 Nov 2017 13:14:47 +0000 (14:14 +0100)
committerSasha Levin <alexander.levin@microsoft.com>
Fri, 18 May 2018 17:25:05 +0000 (13:25 -0400)
[ Upstream commit 120a264f9c2782682027d931d83dcbd22e01da80 ]

When no IOMMU is available, all GEM buffers allocated by Exynos DRM driver
are contiguous, because of the underlying dma_alloc_attrs() function
provides only such buffers. In such case it makes no sense to keep
BO_NONCONTIG flag for the allocated GEM buffers. This allows to avoid
failures for buffer contiguity checks in the subsequent operations on GEM
objects.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
CC: stable@vger.kernel.org # v4.4+
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/gpu/drm/exynos/exynos_drm_gem.c

index 0d5b9698d38402d912304b3915e95e37bd207978..e7d6139528ca38e8dffc99e119385bed7555f76d 100644 (file)
@@ -241,6 +241,15 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev,
 
        exynos_gem_obj->buffer = buf;
 
+       if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
+               /*
+                * when no IOMMU is available, all allocated buffers are
+                * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
+                */
+               flags &= ~EXYNOS_BO_NONCONTIG;
+               DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
+       }
+
        /* set memory type and cache attribute from user side. */
        exynos_gem_obj->flags = flags;