mirror of
https://github.com/torvalds/linux.git
synced 2026-05-18 11:38:01 +02:00
Atm when the connector is added to the drm_mode_config::connector_list, the connector may not be fully initialized yet. This is not a problem for static connectors initialized/added during driver loading, for which the driver ensures that look-ups via the above list are not possible until all the connector and other required state is fully initialized already. It's also not a problem for user space looking up either a static or dynamic (see what this is below) connector, since this will be only possible once the connector is registered. A dynamic - atm only a DP MST - connector can be initialized and added after the load time initialization is done. Such a connector may be looked up by in-kernel users once it's added to the connector list. In particular a hotplug handler could perform a detection on all the connectors on the list and hence find a connector there which isn't yet initialized. For instance the connector's helper hooks may be unset, leading to a NULL dereference while the detect helper calls the connector's drm_connector_helper_funcs::detect() or detect_ctx() handler. To resolve the above issue, add a way for dynamic connectors to separately initialize the DRM core specific parts of the connector without adding it to the connector list - by calling the new drm_connector_dynamic_init() - and to add the connector to the list later once all the initialization is complete and the connector is registered - by calling the new drm_connector_dynamic_register(). Adding the above 2 functions was also motivated to make the distinction of the interface between static and dynamic connectors clearer: Drivers should manually initialize and register only dynamic connectors (with the above 2 functions). A driver should only initialize a static connector (with one of the drm_connector_init*, drmm_connector_init* functions) while the registration of the connector will be done automatically by DRM core. v2: (Jani) - Let initing DDC as well via drm_connector_init_core(). - Rename __drm_connector_init to drm_connector_init_core_and_add(). v3: - Rename drm_connector_init_core() to drm_connector_dynamic_init(). (Sima) - Instead of exporting drm_connector_add(), move adding the connector to the registration step via a new drm_connector_dynamic_register(). (Sima) - Update drm_connector_dynamic_init()'s function documentation and the commit log according to the above changes. - Update the commit log describing the problematic scenario during connector detection. (Maxime) Cc: Jani Nikula <jani.nikula@intel.com> Cc: Simona Vetter <simona@ffwll.ch> Cc: Maxime Ripard <mripard@kernel.org> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (v1) Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241211230328.4012496-2-imre.deak@intel.com |
||
|---|---|---|
| .. | ||
| bridge | ||
| clients | ||
| display | ||
| i2c | ||
| intel | ||
| ttm | ||
| amd_asic_type.h | ||
| drm_accel.h | ||
| drm_atomic_helper.h | ||
| drm_atomic_state_helper.h | ||
| drm_atomic_uapi.h | ||
| drm_atomic.h | ||
| drm_audio_component.h | ||
| drm_auth.h | ||
| drm_blend.h | ||
| drm_bridge_connector.h | ||
| drm_bridge.h | ||
| drm_buddy.h | ||
| drm_cache.h | ||
| drm_client_event.h | ||
| drm_client.h | ||
| drm_color_mgmt.h | ||
| drm_connector.h | ||
| drm_crtc_helper.h | ||
| drm_crtc.h | ||
| drm_damage_helper.h | ||
| drm_debugfs_crc.h | ||
| drm_debugfs.h | ||
| drm_device.h | ||
| drm_drv.h | ||
| drm_edid.h | ||
| drm_eld.h | ||
| drm_encoder_slave.h | ||
| drm_encoder.h | ||
| drm_exec.h | ||
| drm_fb_dma_helper.h | ||
| drm_fb_helper.h | ||
| drm_fbdev_dma.h | ||
| drm_fbdev_shmem.h | ||
| drm_fbdev_ttm.h | ||
| drm_file.h | ||
| drm_fixed.h | ||
| drm_flip_work.h | ||
| drm_format_helper.h | ||
| drm_fourcc.h | ||
| drm_framebuffer.h | ||
| drm_gem_atomic_helper.h | ||
| drm_gem_dma_helper.h | ||
| drm_gem_framebuffer_helper.h | ||
| drm_gem_shmem_helper.h | ||
| drm_gem_ttm_helper.h | ||
| drm_gem_vram_helper.h | ||
| drm_gem.h | ||
| drm_gpuvm.h | ||
| drm_ioctl.h | ||
| drm_kunit_helpers.h | ||
| drm_lease.h | ||
| drm_managed.h | ||
| drm_mipi_dbi.h | ||
| drm_mipi_dsi.h | ||
| drm_mm.h | ||
| drm_mode_config.h | ||
| drm_mode_object.h | ||
| drm_modes.h | ||
| drm_modeset_helper_vtables.h | ||
| drm_modeset_helper.h | ||
| drm_modeset_lock.h | ||
| drm_module.h | ||
| drm_of.h | ||
| drm_panel.h | ||
| drm_panic.h | ||
| drm_pciids.h | ||
| drm_plane_helper.h | ||
| drm_plane.h | ||
| drm_prime.h | ||
| drm_print.h | ||
| drm_privacy_screen_consumer.h | ||
| drm_privacy_screen_driver.h | ||
| drm_privacy_screen_machine.h | ||
| drm_probe_helper.h | ||
| drm_property.h | ||
| drm_rect.h | ||
| drm_self_refresh_helper.h | ||
| drm_simple_kms_helper.h | ||
| drm_suballoc.h | ||
| drm_syncobj.h | ||
| drm_sysfs.h | ||
| drm_util.h | ||
| drm_utils.h | ||
| drm_vblank_work.h | ||
| drm_vblank.h | ||
| drm_vma_manager.h | ||
| drm_writeback.h | ||
| gpu_scheduler.h | ||
| gud.h | ||
| spsc_queue.h | ||
| task_barrier.h | ||