aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch
new file mode 100644
index 00000000..4a8f581f
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/0809-drm-amd-amdgpu-restore-DGMA-request-size-check-and-N.patch
@@ -0,0 +1,55 @@
+From 6e50d37aa31d5a3fc97b1e1ad73d709758929928 Mon Sep 17 00:00:00 2001
+From: Roger He <Hongbo.He@amd.com>
+Date: Mon, 10 Jul 2017 15:55:06 +0800
+Subject: [PATCH 0809/4131] drm/amd/amdgpu: restore DGMA request size check and
+ NO_EVICT flag
+
+Change-Id: I8e69243ac89aaeb5048e2e0ec16720108cacaf79
+Reviewed-by: Flora Cui <Flora.Cui@amd.com>
+Signed-off-by: Roger He <Hongbo.He@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+index b58f185..a99545c 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+@@ -47,6 +47,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
+ struct drm_gem_object **obj)
+ {
+ struct amdgpu_bo *robj;
++ unsigned long max_size;
+ int r;
+
+ *obj = NULL;
+@@ -55,6 +56,23 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
+ alignment = PAGE_SIZE;
+ }
+
++ if ((initial_domain & AMDGPU_GEM_DOMAIN_DGMA) ||
++ (initial_domain & AMDGPU_GEM_DOMAIN_DGMA_IMPORT)) {
++ flags |= AMDGPU_GEM_CREATE_NO_EVICT;
++ max_size = (unsigned long)amdgpu_direct_gma_size << 20;
++
++ if (initial_domain & AMDGPU_GEM_DOMAIN_DGMA)
++ max_size -= atomic64_read(&adev->direct_gma.vram_usage);
++ else if (initial_domain & AMDGPU_GEM_DOMAIN_DGMA_IMPORT)
++ max_size -= atomic64_read(&adev->direct_gma.gart_usage);
++
++ if (size > max_size) {
++ DRM_DEBUG("Allocation size %ldMb bigger than %ldMb limit\n",
++ size >> 20, max_size >> 20);
++ return -ENOMEM;
++ }
++ }
++
+ retry:
+ r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain,
+ flags, NULL, NULL, 0, &robj);
+--
+2.7.4
+