diff options
Diffstat (limited to 'common/recipes-kernel/linux/files/0241-drm-amdgpu-remove-rptr-checking.patch')
-rw-r--r-- | common/recipes-kernel/linux/files/0241-drm-amdgpu-remove-rptr-checking.patch | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0241-drm-amdgpu-remove-rptr-checking.patch b/common/recipes-kernel/linux/files/0241-drm-amdgpu-remove-rptr-checking.patch new file mode 100644 index 00000000..4f03c26e --- /dev/null +++ b/common/recipes-kernel/linux/files/0241-drm-amdgpu-remove-rptr-checking.patch @@ -0,0 +1,181 @@ +From 35c5c7e91428453adf034b3644077eb813701521 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> +Date: Thu, 21 Jan 2016 13:06:05 +0100 +Subject: [PATCH 0241/1110] drm/amdgpu: remove rptr checking +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With the scheduler enabled we don't need that any more. + +Signed-off-by: Christian König <christian.koenig@amd.com> +Reviewed-by: Chunming Zhou <david1.zhou@amd.com> +Acked-by: Alex Deucher <alexander.deucher@amd.com> +Signed-off-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 5 +-- + drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 77 +++++++++++--------------------- + 2 files changed, 26 insertions(+), 56 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +index e05c6f4..de1e6ca 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +@@ -782,7 +782,7 @@ struct amdgpu_ring { + unsigned wptr; + unsigned wptr_old; + unsigned ring_size; +- unsigned ring_free_dw; ++ unsigned max_dw; + int count_dw; + uint64_t gpu_addr; + uint32_t align_mask; +@@ -1152,8 +1152,6 @@ int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, + int amdgpu_ib_pool_init(struct amdgpu_device *adev); + void amdgpu_ib_pool_fini(struct amdgpu_device *adev); + int amdgpu_ib_ring_tests(struct amdgpu_device *adev); +-/* Ring access between begin & end cannot sleep */ +-void amdgpu_ring_free_size(struct amdgpu_ring *ring); + int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw); + void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count); + void amdgpu_ring_commit(struct amdgpu_ring *ring); +@@ -2129,7 +2127,6 @@ static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v) + ring->ring[ring->wptr++] = v; + ring->wptr &= ring->ptr_mask; + ring->count_dw--; +- ring->ring_free_dw--; + } + + static inline struct amdgpu_sdma_instance * +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +index 81d06d7..1f0db99 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +@@ -49,28 +49,6 @@ + static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring); + + /** +- * amdgpu_ring_free_size - update the free size +- * +- * @adev: amdgpu_device pointer +- * @ring: amdgpu_ring structure holding ring information +- * +- * Update the free dw slots in the ring buffer (all asics). +- */ +-void amdgpu_ring_free_size(struct amdgpu_ring *ring) +-{ +- uint32_t rptr = amdgpu_ring_get_rptr(ring); +- +- /* This works because ring_size is a power of 2 */ +- ring->ring_free_dw = rptr + (ring->ring_size / 4); +- ring->ring_free_dw -= ring->wptr; +- ring->ring_free_dw &= ring->ptr_mask; +- if (!ring->ring_free_dw) { +- /* this is an empty ring */ +- ring->ring_free_dw = ring->ring_size / 4; +- } +-} +- +-/** + * amdgpu_ring_alloc - allocate space on the ring buffer + * + * @adev: amdgpu_device pointer +@@ -82,24 +60,16 @@ void amdgpu_ring_free_size(struct amdgpu_ring *ring) + */ + int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw) + { +- int r; +- +- /* make sure we aren't trying to allocate more space than there is on the ring */ +- if (ndw > (ring->ring_size / 4)) +- return -ENOMEM; + /* Align requested size with padding so unlock_commit can + * pad safely */ +- amdgpu_ring_free_size(ring); + ndw = (ndw + ring->align_mask) & ~ring->align_mask; +- while (ndw > (ring->ring_free_dw - 1)) { +- amdgpu_ring_free_size(ring); +- if (ndw < ring->ring_free_dw) { +- break; +- } +- r = amdgpu_fence_wait_next(ring); +- if (r) +- return r; +- } ++ ++ /* Make sure we aren't trying to allocate more space ++ * than the maximum for one submission ++ */ ++ if (WARN_ON_ONCE(ndw > ring->max_dw)) ++ return -ENOMEM; ++ + ring->count_dw = ndw; + ring->wptr_old = ring->wptr; + return 0; +@@ -326,7 +296,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, + } + } + ring->ptr_mask = (ring->ring_size / 4) - 1; +- ring->ring_free_dw = ring->ring_size / 4; ++ ring->max_dw = DIV_ROUND_UP(ring->ring_size / 4, ++ amdgpu_sched_hw_submission); + + if (amdgpu_debugfs_ring_init(adev, ring)) { + DRM_ERROR("Failed to register debugfs file for rings !\n"); +@@ -406,25 +377,18 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data) + struct amdgpu_ring *ring = (void *)(((uint8_t*)adev) + roffset); + + uint32_t rptr, wptr, rptr_next; +- unsigned count, i, j; +- +- amdgpu_ring_free_size(ring); +- count = (ring->ring_size / 4) - ring->ring_free_dw; ++ unsigned i; + + wptr = amdgpu_ring_get_wptr(ring); +- seq_printf(m, "wptr: 0x%08x [%5d]\n", +- wptr, wptr); ++ seq_printf(m, "wptr: 0x%08x [%5d]\n", wptr, wptr); + + rptr = amdgpu_ring_get_rptr(ring); +- seq_printf(m, "rptr: 0x%08x [%5d]\n", +- rptr, rptr); +- + rptr_next = le32_to_cpu(*ring->next_rptr_cpu_addr); + ++ seq_printf(m, "rptr: 0x%08x [%5d]\n", rptr, rptr); ++ + seq_printf(m, "driver's copy of the wptr: 0x%08x [%5d]\n", + ring->wptr, ring->wptr); +- seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); +- seq_printf(m, "%u dwords in ring\n", count); + + if (!ring->ready) + return 0; +@@ -433,11 +397,20 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data) + * packet that is the root issue + */ + i = (rptr + ring->ptr_mask + 1 - 32) & ring->ptr_mask; +- for (j = 0; j <= (count + 32); j++) { ++ while (i != rptr) { ++ seq_printf(m, "r[%5d]=0x%08x", i, ring->ring[i]); ++ if (i == rptr) ++ seq_puts(m, " *"); ++ if (i == rptr_next) ++ seq_puts(m, " #"); ++ seq_puts(m, "\n"); ++ i = (i + 1) & ring->ptr_mask; ++ } ++ while (i != wptr) { + seq_printf(m, "r[%5d]=0x%08x", i, ring->ring[i]); +- if (rptr == i) ++ if (i == rptr) + seq_puts(m, " *"); +- if (rptr_next == i) ++ if (i == rptr_next) + seq_puts(m, " #"); + seq_puts(m, "\n"); + i = (i + 1) & ring->ptr_mask; +-- +2.7.4 + |