OpenCloudOS-Kernel/drivers/gpu/drm/exynos
Marek Szyprowski 07dc3678ba drm/exynos: Fix cleanup of IOMMU related objects
Store the IOMMU mapping created by the device core of each Exynos DRM
sub-device and restore it when the Exynos DRM driver is unbound. This
fixes IOMMU initialization failure for the second time when a deferred
probe is triggered from the bind() callback of master's compound DRM
driver. This also fixes the following issue found using kmemleak
detector:

unreferenced object 0xc2137640 (size 64):
  comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s)
  hex dump (first 32 bytes):
    50 a3 14 c2 80 a2 14 c2 01 00 00 00 20 00 00 00  P........... ...
    00 10 00 00 00 80 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<3acd268d>] arch_setup_dma_ops+0x4c/0x104
    [<9f7d2cce>] of_dma_configure+0x19c/0x3a4
    [<ba07704b>] really_probe+0xb0/0x47c
    [<4f510e4f>] driver_probe_device+0x78/0x1c4
    [<7481a0cf>] device_driver_attach+0x58/0x60
    [<0ff8f5c1>] __driver_attach+0xb8/0x158
    [<86006144>] bus_for_each_dev+0x74/0xb4
    [<10159dca>] bus_add_driver+0x1c0/0x200
    [<8a265265>] driver_register+0x74/0x108
    [<e0f3451a>] exynos_drm_init+0xb0/0x134
    [<db3fc7ba>] do_one_initcall+0x90/0x458
    [<6da35917>] kernel_init_freeable+0x188/0x200
    [<db3f74d4>] kernel_init+0x8/0x110
    [<1f3cddf9>] ret_from_fork+0x14/0x20
    [<8cd12507>] 0x0
unreferenced object 0xc214a280 (size 128):
  comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s)
  hex dump (first 32 bytes):
    00 a0 ec ed 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<3acd268d>] arch_setup_dma_ops+0x4c/0x104
    [<9f7d2cce>] of_dma_configure+0x19c/0x3a4
    [<ba07704b>] really_probe+0xb0/0x47c
    [<4f510e4f>] driver_probe_device+0x78/0x1c4
    [<7481a0cf>] device_driver_attach+0x58/0x60
    [<0ff8f5c1>] __driver_attach+0xb8/0x158
    [<86006144>] bus_for_each_dev+0x74/0xb4
    [<10159dca>] bus_add_driver+0x1c0/0x200
    [<8a265265>] driver_register+0x74/0x108
    [<e0f3451a>] exynos_drm_init+0xb0/0x134
    [<db3fc7ba>] do_one_initcall+0x90/0x458
    [<6da35917>] kernel_init_freeable+0x188/0x200
    [<db3f74d4>] kernel_init+0x8/0x110
    [<1f3cddf9>] ret_from_fork+0x14/0x20
    [<8cd12507>] 0x0
unreferenced object 0xedeca000 (size 4096):
  comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<3acd268d>] arch_setup_dma_ops+0x4c/0x104
    [<9f7d2cce>] of_dma_configure+0x19c/0x3a4
    [<ba07704b>] really_probe+0xb0/0x47c
    [<4f510e4f>] driver_probe_device+0x78/0x1c4
    [<7481a0cf>] device_driver_attach+0x58/0x60
    [<0ff8f5c1>] __driver_attach+0xb8/0x158
    [<86006144>] bus_for_each_dev+0x74/0xb4
    [<10159dca>] bus_add_driver+0x1c0/0x200
    [<8a265265>] driver_register+0x74/0x108
    [<e0f3451a>] exynos_drm_init+0xb0/0x134
    [<db3fc7ba>] do_one_initcall+0x90/0x458
    [<6da35917>] kernel_init_freeable+0x188/0x200
    [<db3f74d4>] kernel_init+0x8/0x110
    [<1f3cddf9>] ret_from_fork+0x14/0x20
    [<8cd12507>] 0x0
unreferenced object 0xc214a300 (size 128):
  comm "swapper/0", pid 1, jiffies 4294937900 (age 3127.400s)
  hex dump (first 32 bytes):
    00 a3 14 c2 00 a3 14 c2 00 40 18 c2 00 80 18 c2  .........@......
    02 00 02 00 ad 4e ad de ff ff ff ff ff ff ff ff  .....N..........
  backtrace:
    [<08cbd8bc>] iommu_domain_alloc+0x24/0x50
    [<b835abee>] arm_iommu_create_mapping+0xe4/0x134
    [<3acd268d>] arch_setup_dma_ops+0x4c/0x104
    [<9f7d2cce>] of_dma_configure+0x19c/0x3a4
    [<ba07704b>] really_probe+0xb0/0x47c
    [<4f510e4f>] driver_probe_device+0x78/0x1c4
    [<7481a0cf>] device_driver_attach+0x58/0x60
    [<0ff8f5c1>] __driver_attach+0xb8/0x158
    [<86006144>] bus_for_each_dev+0x74/0xb4
    [<10159dca>] bus_add_driver+0x1c0/0x200
    [<8a265265>] driver_register+0x74/0x108
    [<e0f3451a>] exynos_drm_init+0xb0/0x134
    [<db3fc7ba>] do_one_initcall+0x90/0x458
    [<6da35917>] kernel_init_freeable+0x188/0x200
    [<db3f74d4>] kernel_init+0x8/0x110
    [<1f3cddf9>] ret_from_fork+0x14/0x20

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2020-03-10 13:25:18 +09:00
..
Kconfig drm/exynos: Rename Exynos to lowercase 2020-01-21 09:09:42 +09:00
Makefile drm/exynos/iommu: merge IOMMU and DMA code 2018-12-04 13:23:17 +09:00
exynos7_drm_decon.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos5433_drm_decon.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_dp.c drm/exynos: Don't reset bridge->next 2019-12-02 09:34:06 +01:00
exynos_drm_crtc.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_crtc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_dma.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_dpi.c drm/panel: decouple connector from drm_panel 2019-12-09 22:57:26 +01:00
exynos_drm_drv.c drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
exynos_drm_drv.h drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_dsi.c drm/exynos: dsi: fix workaround for the legacy clock name 2020-03-02 13:02:34 +09:00
exynos_drm_fb.c drm/exynos: drop drmP.h usage 2019-06-27 19:56:09 +09:00
exynos_drm_fb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_fbdev.c drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
exynos_drm_fbdev.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_fimc.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_fimd.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_g2d.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_g2d.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 423 2019-06-05 17:37:15 +02:00
exynos_drm_gem.c Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()" 2019-08-07 11:56:48 -04:00
exynos_drm_gem.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_gsc.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_ipp.c drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_ipp.h drm/exynos: drop use of drmP.h 2019-09-01 20:55:12 +09:00
exynos_drm_mic.c drm: Stop including drm_bridge.h from drm_crtc.h 2019-08-28 22:11:03 +02:00
exynos_drm_plane.c drm/exynos: drop drmP.h usage 2019-06-27 19:56:09 +09:00
exynos_drm_plane.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_drm_rotator.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_scaler.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
exynos_drm_vidi.c drm/exynos: change callback names 2020-01-21 09:09:42 +09:00
exynos_drm_vidi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
exynos_hdmi.c drm/exynos: hdmi: don't leak enable HDMI_EN regulator if probe fails 2020-03-02 13:02:41 +09:00
exynos_mixer.c drm/exynos: Fix cleanup of IOMMU related objects 2020-03-10 13:25:18 +09:00
regs-decon7.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
regs-decon5433.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 423 2019-06-05 17:37:15 +02:00
regs-fimc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-gsc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-mixer.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-rotator.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-scaler.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
regs-vp.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00