drm/exynos/mixer: fix MIXER shadow registry synchronisation code 04/201804/1
authorAndrzej Hajda <a.hajda@samsung.com>
Tue, 19 Mar 2019 13:05:11 +0000 (14:05 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 19 Mar 2019 13:53:35 +0000 (14:53 +0100)
commitbf75262d7163301a838c4d4f9e5c761c4aa2da46
tree83d017a6da40d92fe8afed86bfc463c79953d9ad
parent1d2108db4bdec55725b3217f06ac5138ea558b87
drm/exynos/mixer: fix MIXER shadow registry synchronisation code

MIXER on Exynos5 SoCs uses different synchronisation method than Exynos4
to update internal state (shadow registers).
Apparently the driver implements it incorrectly. The rule should be
as follows:
- do not request updating registers until previous request was finished,
  ie. MXR_CFG_LAYER_UPDATE_COUNT must be 0.
- before setting registers synchronisation on VSYNC should be turned off,
  ie. MXR_STATUS_SYNC_ENABLE should be reset,
- after finishing MXR_STATUS_SYNC_ENABLE should be set again.
The patch hopefully implements it correctly.
Below sample kernel log from page fault caused by the bug:

[   25.670038] exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x2247b800
[   25.677888] ------------[ cut here ]------------
[   25.682164] kernel BUG at ../drivers/iommu/exynos-iommu.c:450!
[   25.687971] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   25.693778] Modules linked in:
[   25.696816] CPU: 5 PID: 1553 Comm: fb-release_test Not tainted 5.0.0-rc7-01157-g5f86b1566bdd #136
[   25.705646] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   25.711710] PC is at exynos_sysmmu_irq+0x1c0/0x264
[   25.716470] LR is at lock_is_held_type+0x44/0x64

v2: added missing MXR_CFG_LAYER_UPDATE bit setting in mixer_enable_sync

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Change-Id: Idd49412e699350a7ea3a98ef7f925924e0ddf1ff
drivers/gpu/drm/exynos/exynos_mixer.c