diff options
Diffstat (limited to 'common/recipes-kernel/linux/files/0029-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch')
-rw-r--r-- | common/recipes-kernel/linux/files/0029-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0029-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch b/common/recipes-kernel/linux/files/0029-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch new file mode 100644 index 00000000..889b82a1 --- /dev/null +++ b/common/recipes-kernel/linux/files/0029-drm-amdgpu-restrict-the-sched-jobs-number-to-power-o.patch @@ -0,0 +1,62 @@ +From 0cb97db6c8809cf2127421383a668cbf912660e3 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 0029/1110] 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 + +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 991884a..a138f69 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -949,6 +949,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", +-- +2.7.4 + |