linux-stable/drivers/gpu/drm
Imre Deak 2c7d0602c8 drm/i915/gen9: Fix PCODE polling during CDCLK change notification
commit 848496e590
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Jul 13 16:32:03 2016 +0300

    drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL

increased the timeout to match the spec, but we still see a timeout on
at least one SKL. A CDCLK change request following the failed one will
succeed nevertheless.

I could reproduce this problem easily by running kms_pipe_crc_basic in a
loop. In all failure cases _wait_for() was pre-empted for >3ms and so in
the worst case - when the pre-emption happened right after calculating
timeout__ in _wait_for() - we called skl_cdclk_wait_for_pcu_ready() only
once which failed and so _wait_for() timed out. As opposed to this the
spec says to keep retrying the request for at most a 3ms period.

To fix this send the first request explicitly to guarantee that there is
3ms between the first and last request. Though this matches the spec, I
noticed that in rare cases this can still time out if we sent only a few
requests (in the worst case 2) _and_ PCODE is busy for some reason even
after a previous request and a 3ms delay. To work around this retry the
polling with pre-emption disabled to maximize the number of requests.
Also increase the timeout to 10ms to account for interrupts that could
reduce the number of requests. With this change I couldn't trigger
the problem.

v2:
- Use 1ms poll period instead of 10us. (Chris)
v3:
- Poll with pre-emption disabled to increase the number of request
  attempts. (Ville, Chris)
- Factor out a helper to poll, it's also needed by the next patch.
v4:
- Pass reply_mask, reply to skl_pcode_request(), instead of assuming the
  reply is generic. (Ville)
v5:
- List the request specific timeout values as code comment. (Ville)
v6:
- Try the poll first with preemption enabled.
- Add code comment about first request being queued by PCODE. (Art)
- Add timeout_base_ms argument. (Ville)
v7:
- Clarify code comment about first queued request. (Chris)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Art Runyan <arthur.j.runyan@intel.com>
Cc: <stable@vger.kernel.org> # v4.2- : 3b2c171 : drm/i915: Wait up to 3ms
Cc: <stable@vger.kernel.org> # v4.2-
Fixes: 5d96d8afcf ("drm/i915/skl: Deinit/init the display at suspend/resume")
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97929
Testcase: igt/kms_pipe_crc_basic/suspend-read-crc-pipe-B
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/1480955258-26311-1-git-send-email-imre.deak@intel.com
(cherry picked from commit a0b8a1fe34)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2016-12-20 16:28:52 +02:00
..
amd drm/irq: Unexport drm_vblank_on/off 2016-11-15 23:33:48 +01:00
arc drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
arm Merge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next 2016-11-17 08:55:26 +10:00
armada drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:54:13 +01:00
ast drm/ast: free correct pointer in astfb_create() error paths 2016-11-14 07:45:16 +01:00
atmel-hlcdc drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
bochs drm/bochs: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:54:38 +01:00
bridge drm/bridge: analogix_dp: return error if transfer none byte 2016-11-16 11:16:13 +05:30
cirrus Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-11-11 09:28:44 +10:00
etnaviv drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
exynos drm/exynos: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:54:50 +01:00
fsl-dcu drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
gma500 drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 08:01:01 +01:00
hisilicon drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
i2c Merge branch 'drm-tda998x-mali' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next 2016-11-17 08:55:26 +10:00
i810 drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
i915 drm/i915/gen9: Fix PCODE polling during CDCLK change notification 2016-12-20 16:28:52 +02:00
imx drm/imx: Switch to drm_fb_cma_prepare_fb() helper 2016-11-15 08:25:06 +01:00
mediatek drm/irq: Unexport drm_vblank_count 2016-11-15 23:33:47 +01:00
mga
mgag200 Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-11-11 09:28:44 +10:00
msm drm/msm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:58:04 +01:00
nouveau drm/nouveau: Use drm_crtc_vblank_off/on 2016-11-15 23:33:37 +01:00
omapdrm drm/omapdrm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:58:15 +01:00
panel
qxl drm/qxl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:55:33 +01:00
r128
radeon drm/radeon: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:56:52 +01:00
rcar-du Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next 2016-11-16 09:39:21 +10:00
rockchip drm/rockchip: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:56:47 +01:00
savage drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
shmobile drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
sis drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
sti Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-11-11 09:28:44 +10:00
sun4i Merge tag 'drm-misc-next-2016-11-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2016-11-17 08:02:46 +10:00
tdfx drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
tegra drm/tegra: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:56:58 +01:00
tilcdc drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
ttm drm/ttm: fix ttm_bo_wait 2016-11-09 00:46:04 +05:30
udl drm/udl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:57:59 +01:00
vc4 This pull request brings in fragment shader threading and ETC1 support 2016-11-17 09:43:56 +10:00
vgem dma-buf: Rename struct fence to dma_fence 2016-10-25 14:40:39 +02:00
via drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
virtio drm/virtio: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops 2016-11-14 07:58:10 +01:00
vmwgfx drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
zte drm: zte: checking for NULL instead of IS_ERR() 2016-11-15 11:00:42 +01:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c drm/fence: add out-fences support 2016-11-16 14:36:27 +01:00
drm_atomic_helper.c drm/fence: add in-fences support 2016-11-16 09:55:27 +01:00
drm_auth.c
drm_blend.c
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_color_mgmt.c drm/color: document NULL values and default settings better 2016-11-15 22:39:48 +01:00
drm_connector.c drm: Move tile group code into drm_connector.c 2016-11-15 15:30:38 +01:00
drm_context.c
drm_crtc.c drm/fence: add out-fences support 2016-11-16 14:36:27 +01:00
drm_crtc_helper.c
drm_crtc_helper_internal.h
drm_crtc_internal.h drm/fence: add fence timeline to drm_crtc 2016-11-16 10:42:48 +01:00
drm_debugfs.c drm/atomic: add debugfs file to dump out atomic state 2016-11-08 16:38:03 -05:00
drm_debugfs_crc.c
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
drm_dp_mst_topology.c drm/dp/mst: Check peer device type before attempting EDID read 2016-10-26 18:53:44 +02:00
drm_drv.c drm: Extract drm_drv.h 2016-11-15 12:50:30 +01:00
drm_dumb_buffers.c drm: Consolidate dumb buffer docs 2016-11-15 12:51:49 +01:00
drm_edid.c Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued 2016-11-17 14:32:57 +01:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb_cma_helper: Add drm_fb_cma_prepare_fb() helper 2016-11-14 12:43:58 +01:00
drm_fb_helper.c drm/fb-helper: fix segfaults in drm_fb_helper_debug_* 2016-11-14 07:47:34 +01:00
drm_flip_work.c
drm_fops.c drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs 2016-11-02 11:33:47 -04:00
drm_fourcc.c drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
drm_framebuffer.c drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
drm_gem.c
drm_gem_cma_helper.c
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h drm: drm_irq.h header cleanup 2016-11-15 23:33:48 +01:00
drm_ioc32.c
drm_ioctl.c
drm_irq.c drm/irq: Unexport drm_vblank_on/off 2016-11-15 23:33:48 +01:00
drm_kms_helper_common.c
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c
drm_mm.c drm: Add stackdepot include for DRM_DEBUG_MM 2016-11-08 13:46:49 +01:00
drm_mode_config.c drm/fence: add out-fences support 2016-11-16 14:36:27 +01:00
drm_mode_object.c
drm_modes.c Revert "drm: Add aspect ratio parsing in DRM layer" 2016-11-15 15:01:42 +01:00
drm_modeset_helper.c drm: move allocation out of drm_get_format_name() 2016-11-12 14:19:38 +01:00
drm_modeset_lock.c drm: don't let crtc_ww_class leak out 2016-11-15 08:33:35 +01:00
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_plane.c drm/fence: add in-fences support 2016-11-16 09:55:27 +01:00
drm_plane_helper.c drm: add helpers to go from plane state to drm_rect 2016-11-08 16:38:03 -05:00
drm_platform.c
drm_prime.c
drm_print.c drm/print: Move kerneldoc next to definition 2016-11-15 12:55:24 +01:00
drm_probe_helper.c
drm_property.c
drm_rect.c drm: helper macros to print composite types 2016-11-08 16:38:03 -05:00
drm_scatter.c
drm_simple_kms_helper.c
drm_sysfs.c
drm_trace.h
drm_trace_points.c
drm_vm.c
drm_vma_manager.c
Kconfig drm/fence: add in-fences support 2016-11-16 09:55:27 +01:00
Makefile drm: Extract drm_mode_config.[hc] 2016-11-15 15:23:29 +01:00