OpenCloudOS-Kernel/drivers/gpu/drm/tegra
Daniel Vetter 51f644b40b drm/atomic-helper: reset vblank on crtc reset
Only when vblanks are supported ofc.

Some drivers do this already, but most unfortunately missed it. This
opens up bugs after driver load, before the crtc is enabled for the
first time. syzbot spotted this when loading vkms as a secondary
output. Given how many drivers are buggy it's best to solve this once
and for all in shared helper code.

Aside from moving the few existing calls to drm_crtc_vblank_reset into
helpers (i915 doesn't use helpers, so keeps its own) I think the
regression risk is minimal: atomic helpers already rely on drivers
calling drm_crtc_vblank_on/off correctly in their hooks when they
support vblanks. And driver that's failing to handle vblanks after
this is missing those calls already, and vblanks could only work by
accident when enabling a CRTC for the first time right after boot.

Big thanks to Tetsuo for helping track down what's going wrong here.

There's only a few drivers which already had the necessary call and
needed some updating:
- komeda, atmel and tidss also needed to be changed to call
  __drm_atomic_helper_crtc_reset() intead of open coding it
- tegra and msm even had it in the same place already, just code
  motion, and malidp already uses __drm_atomic_helper_crtc_reset().
- Laurent noticed that rcar-du and omap open-code their crtc reset and
  hence would actually be broken by this patch now. So fix them up by
  reusing the helpers, which brings the drm_crtc_vblank_reset() back.

Only call left is in i915, which doesn't use drm_mode_config_reset,
but has its own fastboot infrastructure. So that's the only case where
we actually want this in the driver still.

I've also reviewed all other drivers which set up vblank support with
drm_vblank_init. After the previous patch fixing mxsfb all atomic
drivers do call drm_crtc_vblank_on/off as they should, the remaining
drivers are either legacy kms or legacy dri1 drivers, so not affected
by this change to atomic helpers.

v2: Use the drm_dev_has_vblank() helper.

v3: Laurent pointed out that omap and rcar-du used drm_crtc_vblank_off
instead of drm_crtc_vblank_reset. Adjust them too.

v4: Laurent noticed that rcar-du and omap open-code their crtc reset
and hence would actually be broken by this patch now. So fix them up
by reusing the helpers, which brings the drm_crtc_vblank_reset() back.

v5: also mention rcar-du and ompadrm in the proper commit message
above (Laurent).

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://syzkaller.appspot.com/bug?id=0ba17d70d062b2595e1f061231474800f076c7cb
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot+0871b14ca2e2fb64f6e3@syzkaller.appspotmail.com
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mihail Atanassov <mihail.atanassov@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Brian Masney <masneyb@onstation.org>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: zhengbin <zhengbin13@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-tegra@vger.kernel.org
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200612160056.2082681-1-daniel.vetter@ffwll.ch
2020-07-02 20:25:51 +02:00
..
Kconfig drm/tegra: Unconditionally select IOMMU_IOVA 2019-11-01 10:49:29 +01:00
Makefile drm/tegra: Move drm_dp_link helpers to Tegra DRM 2019-10-23 18:22:10 +02:00
dc.c drm/atomic-helper: reset vblank on crtc reset 2020-07-02 20:25:51 +02:00
dc.h drm/tegra: Move IOMMU group into host1x client 2019-10-28 11:18:37 +01:00
dp.c drm/tegra: sor: Add DisplayPort support 2019-10-28 11:18:54 +01:00
dp.h drm/tegra: dp: Add DisplayPort link training helper 2019-10-28 11:18:53 +01:00
dpaux.c drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
dpaux.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
drm.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
drm.h drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
dsi.c drm/tegra: Use simple encoder 2020-04-02 14:16:45 +02:00
dsi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
falcon.c drm/tegra: falcon: Clarify address usage 2019-10-29 15:04:36 +01:00
falcon.h drm/tegra: falcon: Clarify address usage 2019-10-29 15:04:36 +01:00
fb.c drm/tegra: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:35 +01:00
gem.c drm/tegra: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:35 +01:00
gem.h drm/tegra: gem: Rename paddr -> iova 2019-10-28 11:18:38 +01:00
gr2d.c gpu: host1x: Rename "parent" to "host" 2020-01-10 16:37:38 +01:00
gr2d.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gr3d.c gpu: host1x: Rename "parent" to "host" 2020-01-10 16:37:38 +01:00
gr3d.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hda.c drm/tegra: hda: Extract HDA format parsing code 2019-01-16 13:10:20 +01:00
hda.h drm/tegra: hda: Extract HDA format parsing code 2019-01-16 13:10:20 +01:00
hdmi.c drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hub.c drm/tegra: Do not implement runtime PM 2020-01-10 16:37:43 +01:00
hub.h drm/tegra: Do not implement runtime PM 2020-01-10 16:37:43 +01:00
mipi-phy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mipi-phy.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
output.c drm/tegra: Use simple encoder 2020-04-02 14:16:45 +02:00
plane.c drm/tegra: Reuse IOVA mapping where possible 2020-02-06 18:21:55 +01:00
plane.h drm/tegra: Support DMA API for display controllers 2019-10-29 15:04:36 +01:00
rgb.c drm/tegra: Use simple encoder 2020-04-02 14:16:45 +02:00
sor.c drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
sor.h drm/tegra: sor: Add DisplayPort support 2019-10-28 11:18:54 +01:00
trace.c drm/tegra: dc: Trace register accesses 2017-08-17 17:57:14 +02:00
trace.h drm/tegra: trace: Fix path to include 2017-09-26 11:08:17 +02:00
vic.c gpu: host1x: Rename "parent" to "host" 2020-01-10 16:37:38 +01:00
vic.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00