linux-stable/drivers/gpu/drm
Imre Deak 0cb5670baa drm/i915: Make sure engines are idle during GPU idling in LR mode
We assume that the GPU is idle once receiving the seqno via the last
request's user interrupt. In execlist mode the corresponding context
completed interrupt can be delayed though and until this latter
interrupt arrives we consider the request to be pending on the ELSP
submit port. This can cause a problem during system suspend where this
last request will be seen by the resume code as still pending. Such
pending requests are normally replayed after a GPU reset, but during
resume we reset both SW and HW tracking of the ring head/tail pointers,
so replaying the pending request with its stale tail pointer will leave
the ring in an inconsistent state. A subsequent request submission can
lead then to the GPU executing from uninitialized area in the ring
behind the above stale tail pointer.

Fix this by making sure any pending request on the ELSP port is
completed before suspending. I used a polling wait since the completion
time I measured was <1ms and since normally we only need to wait during
system suspend. GPU idling during runtime suspend is scheduled with a
delay (currently 50-100ms) after the retirement of the last request at
which point the context completed interrupt must have arrived already.

The chance of this bug was increased by

commit 1c777c5d1d
Author: Imre Deak <imre.deak@intel.com>
Date:   Wed Oct 12 17:46:37 2016 +0300

    drm/i915/hsw: Fix GPU hang during resume from S3-devices state

but it could happen even without the explicit GPU reset, since we
disable interrupts afterwards during the suspend sequence.

v2:
- Do an unlocked poll-wait first. (Chris)
v3-4:
- s/intel_lr_engines_idle/intel_execlists_idle/ and move
  i915.enable_execlists check to the new helper. (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98470
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1478510405-11799-3-git-send-email-imre.deak@intel.com
2016-11-07 14:48:05 +02:00
..
amd Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
arc drm: Don't swallow error codes in drm_dev_alloc() 2016-09-22 04:03:48 -07:00
arm drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
armada drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
ast drm/ttm: make eviction decision a driver callback v2 2016-10-25 14:44:04 -04:00
atmel-hlcdc drm/atmel-hlcdc: Use per-plane rotation property 2016-10-21 18:24:09 +02:00
bochs drm/ttm: make eviction decision a driver callback v2 2016-10-25 14:44:04 -04:00
bridge drm/bridge: fix platform_no_drv_owner.cocci warnings 2016-10-27 11:35:23 +05:30
cirrus drm/ttm: make eviction decision a driver callback v2 2016-10-25 14:44:04 -04:00
etnaviv drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
exynos Merge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-10-25 16:35:20 +10:00
fsl-dcu drm/fsl-dcu: enable pixel clock when enabling CRTC 2016-10-19 17:03:02 -07:00
gma500 drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info() 2016-10-18 15:22:38 +05:30
hisilicon drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
i2c drm/i2c/tda998x: mark symbol static where possible 2016-10-24 16:27:16 +02:00
i810
i915 drm/i915: Make sure engines are idle during GPU idling in LR mode 2016-11-07 14:48:05 +02:00
imx Linux 4.8-rc8 2016-09-28 12:08:49 +10:00
mediatek drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
mga
mgag200 drm/ttm: make eviction decision a driver callback v2 2016-10-25 14:44:04 -04:00
msm drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
nouveau Merge branch 'linux-4.9' of git://github.com/skeggsb/linux into drm-next 2016-10-28 14:24:56 +10:00
omapdrm drm/omap: Use per-plane rotation property 2016-10-21 18:25:47 +02:00
panel drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel 2016-09-16 17:32:48 +02:00
qxl Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
r128
radeon Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
rcar-du drm: Add reference counting to drm_atomic_state 2016-10-17 08:19:57 +02:00
rockchip drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
savage drm/savage: dereferencing an error pointer 2016-10-13 07:56:14 +02:00
shmobile
sis
sti drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
sun4i drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
tdfx
tegra gpu: Remove depends on RESET_CONTROLLER when not a provider 2016-10-19 09:26:15 +02:00
tilcdc drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
ttm Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
udl Merge tag 'drm-for-v4.9' of git://people.freedesktop.org/~airlied/linux 2016-10-11 18:12:22 -07:00
vc4 Merge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-10-25 16:35:20 +10:00
vgem dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
via mm: replace get_user_pages() write/force parameters with gup_flags 2016-10-19 08:11:43 -07:00
virtio Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
vmwgfx Merge tag 'topic/drm-misc-2016-10-27' of git://anongit.freedesktop.org/git/drm-intel into drm-next 2016-10-28 11:33:52 +10:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
drm_atomic_helper.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
drm_auth.c
drm_blend.c drm: RIP mode_config->rotation_property 2016-10-22 10:42:11 +02:00
drm_bridge.c drm: Extract drm_bridge.h 2016-09-19 15:04:15 +02:00
drm_bufs.c GPU-DRM: Replace a kzalloc() call by kcalloc() in drm_legacy_addbufs_sg() 2016-09-21 13:24:27 +02:00
drm_cache.c
drm_color_mgmt.c drm/doc: Document color space handling 2016-09-22 00:04:03 -07:00
drm_connector.c drm: Release resources with a safer function 2016-10-10 11:20:48 +02:00
drm_context.c
drm_crtc.c drm: Add drm_rotation_90_or_270() 2016-10-21 18:21:33 +02:00
drm_crtc_helper.c
drm_crtc_helper_internal.h drm/fb-helper: Fix sparse warnings 2016-09-19 16:45:15 +02:00
drm_crtc_internal.h drm: Extract drm_color_mgmt.[hc] 2016-09-22 00:04:02 -07:00
drm_debugfs.c Merge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-10-25 16:35:20 +10:00
drm_debugfs_crc.c drm: fix sparse warnings on undeclared symbols in crc debugfs 2016-10-19 14:10:29 +03:00
drm_dma.c
drm_dp_aux_dev.c
drm_dp_dual_mode_helper.c drm: Print some debug/error info during DP dual mode detect 2016-10-26 15:57:11 -04:00
drm_dp_helper.c Merge tag 'drm-for-v4.9' of git://people.freedesktop.org/~airlied/linux 2016-10-11 18:12:22 -07:00
drm_dp_mst_topology.c
drm_drv.c drm: Simplify drm_printk to reduce object size quite a bit 2016-10-04 08:23:14 +02:00
drm_edid.c drm/edid: Only print the bad edid when aborting 2016-10-25 08:32:16 +02:00
drm_edid_load.c
drm_encoder.c drm: Fix typo in encoder docs 2016-09-21 13:33:50 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb_cma_helper: do not free fbdev if there is none 2016-10-20 09:05:34 +02:00
drm_fb_helper.c drm: RIP mode_config->rotation_property 2016-10-22 10:42:11 +02:00
drm_flip_work.c
drm_fops.c dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
drm_fourcc.c drm: Don't export the drm_fb_get_bpp_depth() function 2016-10-18 15:24:08 +05:30
drm_framebuffer.c drm: WARN when calling drm_format_info() for an unsupported format 2016-10-18 15:21:38 +05:30
drm_gem.c drm: use drm_file to tag vm-bos 2016-09-19 11:22:08 +02:00
drm_gem_cma_helper.c
drm_global.c drm: modify drm_global_item_ref to avoid two times of writing ref->object 2016-09-14 15:10:29 -04:00
drm_hashtab.c
drm_info.c drm: Print device information again in debugfs 2016-10-17 16:20:53 +10:00
drm_internal.h drm: Add API for capturing frame CRCs 2016-10-17 16:44:34 +02:00
drm_ioc32.c drm: drop obsolete drm_core.h 2016-09-19 13:57:38 +02:00
drm_ioctl.c drm: drop obsolete drm_core.h 2016-09-19 13:57:38 +02:00
drm_irq.c drm: avoid uninitialized timestamp use in wait_vblank 2016-10-18 09:45:17 +02:00
drm_kms_helper_common.c
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_object.c drm: Move property validation to a helper, v2. 2016-09-12 10:32:49 -04:00
drm_modes.c drm: Use u64 for intermediate dotclock calculations 2016-10-21 20:23:16 +02:00
drm_modeset_helper.c drm: Don't export the drm_fb_get_bpp_depth() function 2016-10-18 15:24:08 +05:30
drm_modeset_lock.c
drm_of.c drm: convert DT component matching to component_match_add_release() 2016-10-25 11:52:38 -04:00
drm_panel.c
drm_pci.c drm: Don't swallow error codes in drm_dev_alloc() 2016-09-22 04:03:48 -07:00
drm_plane.c drm: Undo damage to page_flip_ioctl 2016-10-04 12:53:12 +10:00
drm_plane_helper.c
drm_platform.c drm: Don't swallow error codes in drm_dev_alloc() 2016-09-22 04:03:48 -07:00
drm_prime.c drm: Fix up kerneldoc for new drm_gem_dmabuf_export() 2016-10-10 11:19:42 +02:00
drm_probe_helper.c
drm_property.c
drm_rect.c
drm_scatter.c
drm_simple_kms_helper.c drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks 2016-10-05 15:18:02 +02:00
drm_sysfs.c drm: drop obsolete drm_core.h 2016-09-19 13:57:38 +02:00
drm_trace.h
drm_trace_points.c
drm_vm.c
drm_vma_manager.c drm: use drm_file to tag vm-bos 2016-09-19 11:22:08 +02:00
Kconfig
Makefile drm: Add API for capturing frame CRCs 2016-10-17 16:44:34 +02:00