summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
diff options
context:
space:
mode:
authorAndres Rodriguez <andresx7@gmail.com>2017-03-17 14:30:15 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-05-31 16:49:03 -0400
commit6065343a116fce16f7523ab10841efd942ce612d (patch)
treec21ee48ee40775c1705cdd931b28ddb643be8f91 /drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
parent795f2813e628bcf57a69f2dfe413360d14a1d7f4 (diff)
downloadop-kernel-dev-6065343a116fce16f7523ab10841efd942ce612d.zip
op-kernel-dev-6065343a116fce16f7523ab10841efd942ce612d.tar.gz
drm/amdgpu: guarantee bijective mapping of ring ids for LRU v3
Depending on usage patterns, the current LRU policy may create a non-injective mapping between userspace ring ids and kernel rings. This behaviour is undesired as apps that attempt to fill all HW blocks would be unable to reach some of them. This change forces the LRU policy to create bijective mappings only. v2: compress ring_blacklist v3: simplify amdgpu_ring_is_blacklisted() logic Signed-off-by: Andres Rodriguez <andresx7@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
index 4073f07..9a14c27 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_queue_mgr.c
@@ -124,10 +124,22 @@ static int amdgpu_lru_map(struct amdgpu_device *adev,
int user_ring,
struct amdgpu_ring **out_ring)
{
- int r;
+ int r, i, j;
int ring_type = amdgpu_hw_ip_to_ring_type(mapper->hw_ip);
+ int ring_blacklist[AMDGPU_MAX_RINGS];
+ struct amdgpu_ring *ring;
- r = amdgpu_ring_lru_get(adev, ring_type, out_ring);
+ /* 0 is a valid ring index, so initialize to -1 */
+ memset(ring_blacklist, 0xff, sizeof(ring_blacklist));
+
+ for (i = 0, j = 0; i < AMDGPU_MAX_RINGS; i++) {
+ ring = mapper->queue_map[i];
+ if (ring)
+ ring_blacklist[j++] = ring->idx;
+ }
+
+ r = amdgpu_ring_lru_get(adev, ring_type, ring_blacklist,
+ j, out_ring);
if (r)
return r;
OpenPOWER on IntegriCloud