OpenCloudOS-Kernel/drivers/gpu/drm/radeon
Thomas Zimmermann 27655b9bb9 drm/client: Send hotplug event after registering a client
Generate a hotplug event after registering a client to allow the
client to configure its display. Remove the hotplug calls from the
existing clients for fbdev emulation. This change fixes a concurrency
bug between registering a client and receiving events from the DRM
core. The bug is present in the fbdev emulation of all drivers.

The fbdev emulation currently generates a hotplug event before
registering the client to the device. For each new output, the DRM
core sends an additional hotplug event to each registered client.

If the DRM core detects first output between sending the artificial
hotplug and registering the device, the output's hotplug event gets
lost. If this is the first output, the fbdev console display remains
dark. This has been observed with amdgpu and fbdev-generic.

Fix this by adding hotplug generation directly to the client's
register helper drm_client_register(). Registering the client and
receiving events are serialized by struct drm_device.clientlist_mutex.
So an output is either configured by the initial hotplug event, or
the client has already been registered.

The bug was originally added in commit 6e3f17ee73 ("drm/fb-helper:
generic: Call drm_client_add() after setup is done"), in which adding
a client and receiving a hotplug event switched order. It was hidden,
as most hardware and drivers have at least on static output configured.
Other drivers didn't use the internal DRM client or still had struct
drm_mode_config_funcs.output_poll_changed set. That callback handled
hotplug events as well. After not setting the callback in amdgpu in
commit 0e3172bac3 ("drm/amdgpu: Don't set struct
drm_driver.output_poll_changed"), amdgpu did not show a framebuffer
console if output events got lost. The bug got copy-pasted from
fbdev-generic into the other fbdev emulation.

Reported-by: Moritz Duge <MoritzDuge@kolahilft.de>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649
Fixes: 6e3f17ee73 ("drm/fb-helper: generic: Call drm_client_add() after setup is done")
Fixes: 8ab59da26b ("drm/fb-helper: Move generic fbdev emulation into separate source file")
Fixes: b79fe9abd5 ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers")
Fixes: 63c381552f ("drm/armada: Implement fbdev emulation as in-kernel client")
Fixes: 49953b70e7 ("drm/exynos: Implement fbdev emulation as in-kernel client")
Fixes: 8f1aaccb04 ("drm/gma500: Implement client-based fbdev emulation")
Fixes: 940b869c2f ("drm/msm: Implement fbdev emulation as in-kernel client")
Fixes: 9e69bcd88e ("drm/omapdrm: Implement fbdev emulation as in-kernel client")
Fixes: e317a69fe8 ("drm/radeon: Implement client-based fbdev emulation")
Fixes: 71ec16f45e ("drm/tegra: Implement fbdev emulation as in-kernel client")
Fixes: 0e3172bac3 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Moritz Duge <MoritzDuge@kolahilft.de>
Tested-by: Torsten Krah <krah.tm@gmail.com>
Tested-by: Paul Schyska <pschyska@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Cc: linux-tegra@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.2+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> # msm
Link: https://patchwork.freedesktop.org/patch/msgid/20230710091029.27503-1-tzimmermann@suse.de
2023-07-11 14:02:01 +02:00
..
reg_srcs
.gitignore drm/radeon: fix incorrrect SPDX-License-Identifiers 2022-06-21 17:54:53 -04:00
Kconfig drm/radeon: Use regular fbdev I/O helpers 2023-06-01 12:26:50 +02:00
Makefile drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set 2023-03-31 11:18:42 -04:00
ObjectID.h
atom-bits.h
atom-names.h
atom-types.h
atom.c drm: Convert open-coded yes/no strings to yesno() 2022-02-07 13:04:25 -08:00
atom.h drm/radeon/atom: Move 'radeon_atom_hw_i2c_*()'s prototypes into shared header 2020-11-16 15:56:34 -05:00
atombios.h drm/radeon: Replace 1-element arrays with flexible-array members 2022-12-15 12:18:19 -05:00
atombios_crtc.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
atombios_dp.c drm: Rename dp/ to display/ 2022-04-25 11:17:45 +02:00
atombios_encoders.c drm/radeon: Fix eDP for single-display iMac11,2 2023-03-01 22:37:25 -05:00
atombios_i2c.c
avivod.h
btc_dpm.c drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared header 2020-11-16 15:56:35 -05:00
btc_dpm.h
btcd.h
cayman_blit_shaders.h drm/radeon: change cayman_default_state table from global to static 2022-04-11 13:50:35 -04:00
ci_dpm.c radeon: avoid double free in ci_dpm_init() 2023-04-18 16:28:54 -04:00
ci_dpm.h
ci_smc.c
cik.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
cik.h drm/radeon/cik: Move 'Move 'cik_sdma_*()'s prototypes to shared header 2020-11-16 15:56:35 -05:00
cik_blit_shaders.h drm/radeon: change cik_default_state table from global to static 2022-04-26 11:43:51 -04:00
cik_reg.h
cik_sdma.c drm/radeon/cik_sdma: Move 'amdgpu_cik_gpu_check_soft_reset()'s prototype to shared header 2020-11-16 15:56:35 -05:00
cikd.h
clearstate_cayman.h
clearstate_ci.h
clearstate_defs.h
clearstate_evergreen.h
clearstate_si.h
cypress_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
cypress_dpm.h
dce3_1_afmt.c
dce6_afmt.c drm/radeon/radeon_audio: Move 'dce6_*()'s prototypes to shared header 2020-11-16 15:56:35 -05:00
dce6_afmt.h drm/radeon/radeon_audio: Move 'dce6_*()'s prototypes to shared header 2020-11-16 15:56:35 -05:00
evergreen.c drm: Drop drm_framebuffer.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
evergreen.h drm/radeon/evergreen: Remove the repeated declaration 2021-05-25 23:47:24 -04:00
evergreen_blit_shaders.h drm/radeon/kms: change evergreen_default_state table from global to static 2022-04-19 13:58:32 -04:00
evergreen_cs.c drm/radeon/evergreen_cs: Move 'r600_dma_cs_next_reloc()'s prototype to shared header 2020-11-16 15:56:35 -05:00
evergreen_dma.c drm/radeon/evergreen_dma: Move 'evergreen_gpu_check_soft_reset()'s prototype to shared header 2020-11-16 15:56:34 -05:00
evergreen_hdmi.c drm/radeon/evergreen_hdmi: Move 'evergreen_*()' and 'dce4_*()' HDMI prototypes to shared header 2020-11-16 15:56:34 -05:00
evergreen_hdmi.h drm/radeon/evergreen_hdmi: Move 'evergreen_*()' and 'dce4_*()' HDMI prototypes to shared header 2020-11-16 15:56:34 -05:00
evergreen_reg.h
evergreen_smc.h
evergreend.h
kv_dpm.c drm/radeon/kv_dpm: Strip out unused functions and their tables 2020-11-13 00:11:53 -05:00
kv_dpm.h
kv_smc.c
mkregtable.c
ni.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
ni.h drm/radeon/ni_dma: Move 'cayman_gpu_check_soft_reset()'s prototype to shared header 2020-11-16 15:56:34 -05:00
ni_dma.c drm/radeon/ni_dma: Move 'cayman_gpu_check_soft_reset()'s prototype to shared header 2020-11-16 15:56:34 -05:00
ni_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
ni_dpm.h drm/radeon/ni_dpm: Move 'ni_get_{pi, ps}()'s into shared header 2020-11-16 15:56:34 -05:00
ni_reg.h
nid.h
nislands_smc.h drm/radeon/ni_dpm: Fix booting bug 2021-05-13 10:45:15 -04:00
ppsmc.h
pptable.h
r100.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
r100_track.h
r100d.h
r200.c
r300.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
r300_reg.h gpu/drm/radeon: Fix typo in comments 2022-06-23 17:21:49 -04:00
r300d.h
r420.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
r420d.h
r500_reg.h
r520.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
r520d.h
r600.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
r600.h drm/radeon/radeon_audio: Move 'r600_*' prototypes into shared header 2020-11-16 15:56:35 -05:00
r600_cs.c drm/radeon/r600_cs: remove r600_cs_legacy_get_tiling_conf() declaration 2022-09-13 14:52:14 -04:00
r600_dma.c drm/radeon/r600_dma: Move 'r600_gpu_check_soft_reset()'s prototype to shared location 2020-11-16 15:56:34 -05:00
r600_dpm.c drm/radeon: make array encoded_lanes static 2021-09-23 15:17:28 -04:00
r600_dpm.h
r600_hdmi.c drm/radeon/radeon_audio: Move 'r600_*' prototypes into shared header 2020-11-16 15:56:35 -05:00
r600_reg.h
r600d.h
radeon.h drm/radeon: Move radeon_align_pitch() next to dumb-buffer helpers 2023-03-31 11:18:42 -04:00
radeon_acpi.c drm: Include <linux/backlight.h> where needed 2023-01-13 13:13:57 +01:00
radeon_acpi.h drm/radeon: Fix missing prototypes in radeon_atpx_handler.c 2023-06-15 11:06:58 -04:00
radeon_agp.c drm/radeon: Move AGP data structures into radeon 2021-05-10 15:46:50 +02:00
radeon_asic.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_asic.h drm/radeon: remove the repeated declaration 2021-05-25 23:47:30 -04:00
radeon_atombios.c drm/radeon: Replace all non-returning strlcpy with strscpy 2023-05-26 13:52:19 -07:00
radeon_atombios.h drm/radeon/radeon_encoders: Move 'radeon_atom_backlight_init's prototype to shared header 2020-11-16 15:56:34 -05:00
radeon_atpx_handler.c drm/radeon: Fix missing prototypes in radeon_atpx_handler.c 2023-06-15 11:06:58 -04:00
radeon_audio.c drm/radeon: Add HD-audio component notifier support (v6) 2022-11-10 15:29:00 -05:00
radeon_audio.h drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location 2020-11-16 15:56:33 -05:00
radeon_benchmark.c
radeon_bios.c drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios() 2022-11-29 11:03:38 -05:00
radeon_clocks.c
radeon_combios.c drm/radeon: Replace all non-returning strlcpy with strscpy 2023-05-26 13:52:19 -07:00
radeon_connectors.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_cs.c drm/radeon: Fix integer overflow in radeon_cs_parser_init 2023-04-21 08:50:21 -04:00
radeon_cursor.c drm/radeon: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:34 +01:00
radeon_device.c Merge tag 'amd-drm-next-6.3-2023-01-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-next 2023-01-16 15:04:13 +10:00
radeon_device.h drm/radeon/radeon: Move prototype into shared header 2020-11-16 15:56:33 -05:00
radeon_display.c drm/radeon: Implement client-based fbdev emulation 2023-03-31 11:18:42 -04:00
radeon_dp_auxch.c drm/radeon: Do not use deprecated drm log API 2023-01-18 10:00:03 +01:00
radeon_drv.c drm/radeon: Implement client-based fbdev emulation 2023-03-31 11:18:42 -04:00
radeon_drv.h drm/radeon: Implement client-based fbdev emulation 2023-03-31 11:18:42 -04:00
radeon_encoders.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_family.h
radeon_fbdev.c drm/client: Send hotplug event after registering a client 2023-07-11 14:02:01 +02:00
radeon_fence.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_gart.c drm/radeon: use the dummy page for GART if needed 2021-05-19 22:32:24 -04:00
radeon_gem.c drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl 2023-06-09 12:41:08 -04:00
radeon_i2c.c drm/radeon: Remove references to struct drm_device.pdev 2021-01-06 15:43:46 +01:00
radeon_ib.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_irq_kms.c drm/radeon: reintroduce radeon_dp_work_func content 2023-06-09 10:42:07 -04:00
radeon_kms.c drm/radeon: Implement client-based fbdev emulation 2023-03-31 11:18:42 -04:00
radeon_kms.h drm/radeon: Convert to Linux IRQ interfaces 2021-08-10 20:13:49 +02:00
radeon_legacy_crtc.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_legacy_encoders.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_legacy_encoders.h drm/radeon/radeon_legacy_encoders: Move 'radeon_add_legacy_encoder's prototype to shared location 2020-11-16 15:56:33 -05:00
radeon_legacy_tv.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_mn.c dma-buf: add DMA_RESV_USAGE_BOOKKEEP v3 2022-04-07 12:53:54 +02:00
radeon_mode.h drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set 2023-03-31 11:18:42 -04:00
radeon_object.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
radeon_object.h drm/radeon: Use the drm suballocation manager implementation. 2023-03-01 17:18:19 +01:00
radeon_pm.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_pm.h drm/radeon/radeon_pm: Move 'radeon_pm_acpi_event_handler' prototype into shared header 2020-11-16 15:56:33 -05:00
radeon_prime.c drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2 2022-12-06 12:54:14 +01:00
radeon_prime.h drm/radeon/radeon_drv: Move 'radeon_gem_prime_import_sg_table()'s prototype to shared header 2020-11-16 15:56:35 -05:00
radeon_reg.h
radeon_ring.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_sa.c drm/radeon: Use the drm suballocation manager implementation. 2023-03-01 17:18:19 +01:00
radeon_semaphore.c drm/radeon: Use the drm suballocation manager implementation. 2023-03-01 17:18:19 +01:00
radeon_sync.c Linux 5.18-rc5 2022-05-03 16:08:48 +10:00
radeon_test.c
radeon_trace.h drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
radeon_trace_points.c
radeon_ttm.c drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
radeon_ttm.h drm/radeon: Implement mmap as GEM object function 2021-05-26 20:56:29 +02:00
radeon_ucode.c
radeon_ucode.h
radeon_uvd.c drm/radeon: use DMA_RESV_USAGE_KERNEL 2022-04-07 12:53:54 +02:00
radeon_vce.c drm/radeon: Fix syntax errors in comments 2021-12-14 16:11:02 -05:00
radeon_vm.c dma-buf/drivers: make reserving a shared slot mandatory v4 2022-04-06 17:38:25 +02:00
rs100d.h
rs400.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
rs400d.h
rs600.c drm: Drop drm_framebuffer.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
rs600d.h
rs690.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
rs690d.h
rs780_dpm.c drm/radeon: Remove references to struct drm_device.pdev 2021-01-06 15:43:46 +01:00
rs780_dpm.h
rs780d.h
rv6xx_dpm.c
rv6xx_dpm.h
rv6xxd.h
rv200d.h
rv250d.h
rv350d.h
rv515.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
rv515d.h
rv730_dpm.c drm/radeon/rv770: Move 'rv770_get_*()'s prototypes to shared header 2020-11-16 15:56:34 -05:00
rv730d.h
rv740_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
rv740d.h
rv770.c drm: Drop drm_framebuffer.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
rv770.h drm/radeon/rv770: Move 'rv770_get_*()'s prototypes to shared header 2020-11-16 15:56:34 -05:00
rv770_dma.c
rv770_dpm.c drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared header 2020-11-16 15:56:35 -05:00
rv770_dpm.h
rv770_smc.c
rv770_smc.h
rv770d.h
si.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
si.h drm/radeon/evergreen: Move 'si_get_csb_*()'s prototypes to shared header 2020-11-16 15:56:35 -05:00
si_blit_shaders.h drm/radeon: change si_default_state table from global to static 2022-04-06 10:20:25 -04:00
si_dma.c drm/radeon/si_dma: Move 'si_gpu_check_soft_reset()'s prototype to shared header 2020-11-16 15:56:34 -05:00
si_dpm.c drm/radeon: change cac_weights_* to static 2022-04-26 11:43:57 -04:00
si_dpm.h drm/radeon/ci_dpm: Move 'si_*()'s prototypes to shared header 2020-11-16 15:56:35 -05:00
si_reg.h
si_smc.c
sid.h
sislands_smc.h drm/radeon/si_dpm: Fix SMU power state load 2021-05-13 10:45:29 -04:00
smu7.h
smu7_discrete.h
smu7_fusion.h
sumo_dpm.c drm/radeon: Add implementation of get_current_vddc for Sumo 2020-10-27 17:43:42 -04:00
sumo_dpm.h drm/radeon/sumo_dpm: Move 'sumo_get_pi()'s prototype into shared header 2020-11-13 00:12:30 -05:00
sumo_smc.c drm/radeon/sumo_dpm: Move 'sumo_get_pi()'s prototype into shared header 2020-11-13 00:12:30 -05:00
sumod.h
trinity_dpm.c drm/radeon/si_dpm: Move 'vce_v1_0_enable_mgcg()'s prototype to shared header 2020-11-16 15:56:35 -05:00
trinity_dpm.h
trinity_smc.c
trinityd.h
uvd_v1_0.c drm/radeon: fix typoes in comments 2020-09-22 17:37:38 -04:00
uvd_v2_2.c drm/radeon: fix typoes in comments 2020-09-22 17:37:38 -04:00
uvd_v3_1.c
uvd_v4_2.c drm/radeon: fix typoes in comments 2020-09-22 17:37:38 -04:00
vce.h drm/radeon/cik: Move 'vce_v2_0_enable_mgcg()'s prototype to shared header 2020-11-16 15:56:35 -05:00
vce_v1_0.c drm/radeon: OLAND boards don't have VCE 2021-02-18 16:43:09 -05:00
vce_v2_0.c drm/radeon/cik: Move 'vce_v2_0_enable_mgcg()'s prototype to shared header 2020-11-16 15:56:35 -05:00