diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
| commit | 53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8 (patch) | |
| tree | b29473f21270aefd113b298c9402be8b4b3c91b4 /drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |
| parent | 746bb4ed6d626f3f9e431a7f9b20504538e62ded (diff) | |
| parent | f2bfc71aee75feff33ca659322b72ffeed5a243d (diff) | |
Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie:
"This is going to rebuild more than drm as it adds a new helper to
list.h for doing bulk updates. Seemed like a reasonable addition to
me.
Otherwise the usual merge window stuff lots of i915 and amdgpu, not so
much nouveau, and piles of everything else.
Core:
- Adds a new list.h helper for doing bulk list updates for TTM.
- Don't leak fb address in smem_start to userspace (comes with EXPORT
workaround for people using mali out of tree hacks)
- udmabuf device to turn memfd regions into dma-buf
- Per-plane blend mode property
- ref/unref replacements with get/put
- fbdev conflicting framebuffers code cleaned up
- host-endian format variants
- panel orientation quirk for Acer One 10
bridge:
- TI SN65DSI86 chip support
vkms:
- GEM support.
- Cursor support
amdgpu:
- Merge amdkfd and amdgpu into one module
- CEC over DP AUX support
- Picasso APU support + VCN dynamic powergating
- Raven2 APU support
- Vega20 enablement + kfd support
- ACP powergating improvements
- ABGR/XBGR display support
- VCN jpeg support
- xGMI support
- DC i2c/aux cleanup
- Ycbcr 4:2:0 support
- GPUVM improvements
- Powerplay and powerplay endian fixes
- Display underflow fixes
vmwgfx:
- Move vmwgfx specific TTM code to vmwgfx
- Split out vmwgfx buffer/resource validation code
- Atomic operation rework
bochs:
- use more helpers
- format/byteorder improvements
qxl:
- use more helpers
i915:
- GGTT coherency getparam
- Turn off resource streamer API
- More Icelake enablement + DMC firmware
- Full PPGTT for Ivybridge, Haswell and Valleyview
- DDB distribution based on resolution
- Limited range DP display support
nouveau:
- CEC over DP AUX support
- Initial HDMI 2.0 support
virtio-gpu:
- vmap support for PRIME objects
tegra:
- Initial Tegra194 support
- DMA/IOMMU integration fixes
msm:
- a6xx perf improvements + clock prefix
- GPU preemption optimisations
- a6xx devfreq support
- cursor support
rockchip:
- PX30 support
- rgb output interface support
mediatek:
- HDMI output support on mt2701 and mt7623
rcar-du:
- Interlaced modes on Gen3
- LVDS on R8A77980
- D3 and E3 SoC support
hisilicon:
- misc fixes
mxsfb:
- runtime pm support
sun4i:
- R40 TCON support
- Allwinner A64 support
- R40 HDMI support
omapdrm:
- Driver rework changing display pipeline ordering to use common code
- DMM memory barrier and irq fixes
- Errata workarounds
exynos:
- out-bridge support for LVDS bridge driver
- Samsung 16x16 tiled format support
- Plane alpha and pixel blend mode support
tilcdc:
- suspend/resume update
mali-dp:
- misc updates"
* tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits)
firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake.
drm/i915/icl: Fix signal_levels
drm/i915/icl: Fix DDI/TC port clk_off bits
drm/i915/icl: create function to identify combophy port
drm/i915/gen9+: Fix initial readout for Y tiled framebuffers
drm/i915: Large page offsets for pread/pwrite
drm/i915/selftests: Disable shrinker across mmap-exhaustion
drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode
drm/i915: Fix intel_dp_mst_best_encoder()
drm/i915: Skip vcpi allocation for MSTB ports that are gone
drm/i915: Don't unset intel_connector->mst_port
drm/i915: Only reset seqno if actually idle
drm/i915: Use the correct crtc when sanitizing plane mapping
drm/i915: Restore vblank interrupts earlier
drm/i915: Check fb stride against plane max stride
drm/amdgpu/vcn:Fix uninitialized symbol error
drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003)
drm/amd/amdgpu: Fix debugfs error handling
drm/amdgpu: Update gc_9_0 golden settings.
drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields
...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 123 |
1 files changed, 25 insertions, 98 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 93794a85f83d..b70e85ec147d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
| @@ -135,9 +135,6 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring) | |||
| 135 | 135 | ||
| 136 | if (ring->funcs->end_use) | 136 | if (ring->funcs->end_use) |
| 137 | ring->funcs->end_use(ring); | 137 | ring->funcs->end_use(ring); |
| 138 | |||
| 139 | if (ring->funcs->type != AMDGPU_RING_TYPE_KIQ) | ||
| 140 | amdgpu_ring_lru_touch(ring->adev, ring); | ||
| 141 | } | 138 | } |
| 142 | 139 | ||
| 143 | /** | 140 | /** |
| @@ -320,8 +317,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
| 320 | ring->max_dw = max_dw; | 317 | ring->max_dw = max_dw; |
| 321 | ring->priority = DRM_SCHED_PRIORITY_NORMAL; | 318 | ring->priority = DRM_SCHED_PRIORITY_NORMAL; |
| 322 | mutex_init(&ring->priority_mutex); | 319 | mutex_init(&ring->priority_mutex); |
| 323 | INIT_LIST_HEAD(&ring->lru_list); | ||
| 324 | amdgpu_ring_lru_touch(adev, ring); | ||
| 325 | 320 | ||
| 326 | for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i) | 321 | for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i) |
| 327 | atomic_set(&ring->num_jobs[i], 0); | 322 | atomic_set(&ring->num_jobs[i], 0); |
| @@ -368,99 +363,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring) | |||
| 368 | ring->adev->rings[ring->idx] = NULL; | 363 | ring->adev->rings[ring->idx] = NULL; |
| 369 | } | 364 | } |
| 370 | 365 | ||
| 371 | static void amdgpu_ring_lru_touch_locked(struct amdgpu_device *adev, | ||
| 372 | struct amdgpu_ring *ring) | ||
| 373 | { | ||
| 374 | /* list_move_tail handles the case where ring isn't part of the list */ | ||
| 375 | list_move_tail(&ring->lru_list, &adev->ring_lru_list); | ||
| 376 | } | ||
| 377 | |||
| 378 | static bool amdgpu_ring_is_blacklisted(struct amdgpu_ring *ring, | ||
| 379 | int *blacklist, int num_blacklist) | ||
| 380 | { | ||
| 381 | int i; | ||
| 382 | |||
| 383 | for (i = 0; i < num_blacklist; i++) { | ||
| 384 | if (ring->idx == blacklist[i]) | ||
| 385 | return true; | ||
| 386 | } | ||
| 387 | |||
| 388 | return false; | ||
| 389 | } | ||
| 390 | |||
| 391 | /** | ||
| 392 | * amdgpu_ring_lru_get - get the least recently used ring for a HW IP block | ||
| 393 | * | ||
| 394 | * @adev: amdgpu_device pointer | ||
| 395 | * @type: amdgpu_ring_type enum | ||
| 396 | * @blacklist: blacklisted ring ids array | ||
| 397 | * @num_blacklist: number of entries in @blacklist | ||
| 398 | * @lru_pipe_order: find a ring from the least recently used pipe | ||
| 399 | * @ring: output ring | ||
| 400 | * | ||
| 401 | * Retrieve the amdgpu_ring structure for the least recently used ring of | ||
| 402 | * a specific IP block (all asics). | ||
| 403 | * Returns 0 on success, error on failure. | ||
| 404 | */ | ||
| 405 | int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, | ||
| 406 | int *blacklist, int num_blacklist, | ||
| 407 | bool lru_pipe_order, struct amdgpu_ring **ring) | ||
| 408 | { | ||
| 409 | struct amdgpu_ring *entry; | ||
| 410 | |||
| 411 | /* List is sorted in LRU order, find first entry corresponding | ||
| 412 | * to the desired HW IP */ | ||
| 413 | *ring = NULL; | ||
| 414 | spin_lock(&adev->ring_lru_list_lock); | ||
| 415 | list_for_each_entry(entry, &adev->ring_lru_list, lru_list) { | ||
| 416 | if (entry->funcs->type != type) | ||
| 417 | continue; | ||
| 418 | |||
| 419 | if (amdgpu_ring_is_blacklisted(entry, blacklist, num_blacklist)) | ||
| 420 | continue; | ||
| 421 | |||
| 422 | if (!*ring) { | ||
| 423 | *ring = entry; | ||
| 424 | |||
| 425 | /* We are done for ring LRU */ | ||
| 426 | if (!lru_pipe_order) | ||
| 427 | break; | ||
| 428 | } | ||
| 429 | |||
| 430 | /* Move all rings on the same pipe to the end of the list */ | ||
| 431 | if (entry->pipe == (*ring)->pipe) | ||
| 432 | amdgpu_ring_lru_touch_locked(adev, entry); | ||
| 433 | } | ||
| 434 | |||
| 435 | /* Move the ring we found to the end of the list */ | ||
| 436 | if (*ring) | ||
| 437 | amdgpu_ring_lru_touch_locked(adev, *ring); | ||
| 438 | |||
| 439 | spin_unlock(&adev->ring_lru_list_lock); | ||
| 440 | |||
| 441 | if (!*ring) { | ||
| 442 | DRM_ERROR("Ring LRU contains no entries for ring type:%d\n", type); | ||
| 443 | return -EINVAL; | ||
| 444 | } | ||
| 445 | |||
| 446 | return 0; | ||
| 447 | } | ||
| 448 | |||
| 449 | /** | ||
| 450 | * amdgpu_ring_lru_touch - mark a ring as recently being used | ||
| 451 | * | ||
| 452 | * @adev: amdgpu_device pointer | ||
| 453 | * @ring: ring to touch | ||
| 454 | * | ||
| 455 | * Move @ring to the tail of the lru list | ||
| 456 | */ | ||
| 457 | void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring) | ||
| 458 | { | ||
| 459 | spin_lock(&adev->ring_lru_list_lock); | ||
| 460 | amdgpu_ring_lru_touch_locked(adev, ring); | ||
| 461 | spin_unlock(&adev->ring_lru_list_lock); | ||
| 462 | } | ||
| 463 | |||
| 464 | /** | 366 | /** |
| 465 | * amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper | 367 | * amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper |
| 466 | * | 368 | * |
| @@ -481,6 +383,31 @@ void amdgpu_ring_emit_reg_write_reg_wait_helper(struct amdgpu_ring *ring, | |||
| 481 | amdgpu_ring_emit_reg_wait(ring, reg1, mask, mask); | 383 | amdgpu_ring_emit_reg_wait(ring, reg1, mask, mask); |
| 482 | } | 384 | } |
| 483 | 385 | ||
| 386 | /** | ||
| 387 | * amdgpu_ring_soft_recovery - try to soft recover a ring lockup | ||
| 388 | * | ||
| 389 | * @ring: ring to try the recovery on | ||
| 390 | * @vmid: VMID we try to get going again | ||
| 391 | * @fence: timedout fence | ||
| 392 | * | ||
| 393 | * Tries to get a ring proceeding again when it is stuck. | ||
| 394 | */ | ||
| 395 | bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid, | ||
| 396 | struct dma_fence *fence) | ||
| 397 | { | ||
| 398 | ktime_t deadline = ktime_add_us(ktime_get(), 10000); | ||
| 399 | |||
| 400 | if (!ring->funcs->soft_recovery) | ||
| 401 | return false; | ||
| 402 | |||
| 403 | atomic_inc(&ring->adev->gpu_reset_counter); | ||
| 404 | while (!dma_fence_is_signaled(fence) && | ||
| 405 | ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0) | ||
| 406 | ring->funcs->soft_recovery(ring, vmid); | ||
| 407 | |||
| 408 | return dma_fence_is_signaled(fence); | ||
| 409 | } | ||
| 410 | |||
| 484 | /* | 411 | /* |
| 485 | * Debugfs info | 412 | * Debugfs info |
| 486 | */ | 413 | */ |
