diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 5ce65280b396..019932a7ea3a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
@@ -315,14 +315,16 @@ static bool amdgpu_ring_is_blacklisted(struct amdgpu_ring *ring, | |||
315 | * @type: amdgpu_ring_type enum | 315 | * @type: amdgpu_ring_type enum |
316 | * @blacklist: blacklisted ring ids array | 316 | * @blacklist: blacklisted ring ids array |
317 | * @num_blacklist: number of entries in @blacklist | 317 | * @num_blacklist: number of entries in @blacklist |
318 | * @lru_pipe_order: find a ring from the least recently used pipe | ||
318 | * @ring: output ring | 319 | * @ring: output ring |
319 | * | 320 | * |
320 | * Retrieve the amdgpu_ring structure for the least recently used ring of | 321 | * Retrieve the amdgpu_ring structure for the least recently used ring of |
321 | * a specific IP block (all asics). | 322 | * a specific IP block (all asics). |
322 | * Returns 0 on success, error on failure. | 323 | * Returns 0 on success, error on failure. |
323 | */ | 324 | */ |
324 | int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, int *blacklist, | 325 | int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, |
325 | int num_blacklist, struct amdgpu_ring **ring) | 326 | int *blacklist, int num_blacklist, |
327 | bool lru_pipe_order, struct amdgpu_ring **ring) | ||
326 | { | 328 | { |
327 | struct amdgpu_ring *entry; | 329 | struct amdgpu_ring *entry; |
328 | 330 | ||
@@ -337,10 +339,23 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, int *blacklist, | |||
337 | if (amdgpu_ring_is_blacklisted(entry, blacklist, num_blacklist)) | 339 | if (amdgpu_ring_is_blacklisted(entry, blacklist, num_blacklist)) |
338 | continue; | 340 | continue; |
339 | 341 | ||
340 | *ring = entry; | 342 | if (!*ring) { |
341 | amdgpu_ring_lru_touch_locked(adev, *ring); | 343 | *ring = entry; |
342 | break; | 344 | |
345 | /* We are done for ring LRU */ | ||
346 | if (!lru_pipe_order) | ||
347 | break; | ||
348 | } | ||
349 | |||
350 | /* Move all rings on the same pipe to the end of the list */ | ||
351 | if (entry->pipe == (*ring)->pipe) | ||
352 | amdgpu_ring_lru_touch_locked(adev, entry); | ||
343 | } | 353 | } |
354 | |||
355 | /* Move the ring we found to the end of the list */ | ||
356 | if (*ring) | ||
357 | amdgpu_ring_lru_touch_locked(adev, *ring); | ||
358 | |||
344 | spin_unlock(&adev->ring_lru_list_lock); | 359 | spin_unlock(&adev->ring_lru_list_lock); |
345 | 360 | ||
346 | if (!*ring) { | 361 | if (!*ring) { |