aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch')
-rw-r--r--meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch b/meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch
new file mode 100644
index 00000000..6d0aeda9
--- /dev/null
+++ b/meta-amdfalconx86/recipes-kernel/linux/linux-yocto/0919-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch
@@ -0,0 +1,63 @@
+From 3fddf572b1b24c0c88000abdd897aa02f8e9c688 Mon Sep 17 00:00:00 2001
+From: Chunming Zhou <David1.Zhou@amd.com>
+Date: Thu, 10 Dec 2015 17:34:33 +0800
+Subject: [PATCH 0919/1050] drm/amdgpu: restrict the sched jobs number to power
+ of two
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Change-Id: I2c9417e92399b31149be6f6a6caf494053fa61d3
+Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+CC: stable@vger.kernel.org
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 ++--
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++++
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+index ee121ec..17d1fb1 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+@@ -252,7 +252,7 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring,
+ unsigned idx = 0;
+ struct fence *other = NULL;
+
+- idx = seq % amdgpu_sched_jobs;
++ idx = seq & (amdgpu_sched_jobs - 1);
+ other = cring->fences[idx];
+ if (other) {
+ signed long r;
+@@ -292,7 +292,7 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx,
+ return NULL;
+ }
+
+- fence = fence_get(cring->fences[seq % amdgpu_sched_jobs]);
++ fence = fence_get(cring->fences[seq & (amdgpu_sched_jobs - 1)]);
+ spin_unlock(&ctx->ring_lock);
+
+ return fence;
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index 33d1265..1785a92 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -950,6 +950,15 @@ static bool amdgpu_check_pot_argument(int arg)
+ */
+ static void amdgpu_check_arguments(struct amdgpu_device *adev)
+ {
++ if (amdgpu_sched_jobs < 4) {
++ dev_warn(adev->dev, "sched jobs (%d) must be at least 4\n",
++ amdgpu_sched_jobs);
++ amdgpu_sched_jobs = 4;
++ } else if (!amdgpu_check_pot_argument(amdgpu_sched_jobs)){
++ dev_warn(adev->dev, "sched jobs (%d) must be a power of 2\n",
++ amdgpu_sched_jobs);
++ amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs);
++ }
+ /* vramlimit must be a power of two */
+ if (!amdgpu_check_pot_argument(amdgpu_vram_limit)) {
+ dev_warn(adev->dev, "vram limit (%d) must be a power of 2\n",
+--
+1.9.1
+