diff mbox series

[v3,06/11] drm/amd/dp_mst: Expose a connector to kernel users after it's properly initialized

Message ID 20241211230328.4012496-7-imre.deak@intel.com (mailing list archive)
State New
Headers show
Series drm/connector: Expose only a properly inited connector | expand

Commit Message

Imre Deak Dec. 11, 2024, 11:03 p.m. UTC
After a connector is added to the drm_mode_config::connector_list, it's
visible to any in-kernel users looking up connectors via the above list.
Make sure that the connector is properly initialized before such
look-ups, by initializing the connector with
drm_connector_dynamic_register() - which doesn't add the connector to
the list - and registering it with drm_connector_dynamic_register() -
which adds the connector to the list - after the initialization is
complete.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Wayne Lin <wayne.lin@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jani Nikula Dec. 12, 2024, 10:14 a.m. UTC | #1
On Thu, 12 Dec 2024, Imre Deak <imre.deak@intel.com> wrote:
> After a connector is added to the drm_mode_config::connector_list, it's
> visible to any in-kernel users looking up connectors via the above list.
> Make sure that the connector is properly initialized before such
> look-ups, by initializing the connector with
> drm_connector_dynamic_register() - which doesn't add the connector to
> the list - and registering it with drm_connector_dynamic_register() -
> which adds the connector to the list - after the initialization is
> complete.
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Wayne Lin <wayne.lin@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index 6e43594906130..d398bc74e6677 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -590,11 +590,12 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  	amdgpu_dm_set_mst_status(&aconnector->mst_status,
>  			MST_PROBE, true);
>  
> -	if (drm_connector_init(
> +	if (drm_connector_dynamic_init(
>  		dev,
>  		connector,
>  		&dm_dp_mst_connector_funcs,
> -		DRM_MODE_CONNECTOR_DisplayPort)) {
> +		DRM_MODE_CONNECTOR_DisplayPort,
> +		NULL)) {
>  		kfree(aconnector);
>  		return NULL;
>  	}
Imre Deak Dec. 16, 2024, 12:45 p.m. UTC | #2
Hi Harry, Leo, Alex, Wayne,

could you please ack this change as well?

Thanks,
Imre

A typo below in the commit log, can fix it while merging the patch here and in
the i915/nouveau patches.

On Thu, Dec 12, 2024 at 01:03:23AM +0200, Imre Deak wrote:
> After a connector is added to the drm_mode_config::connector_list, it's
> visible to any in-kernel users looking up connectors via the above list.
> Make sure that the connector is properly initialized before such
> look-ups, by initializing the connector with
> drm_connector_dynamic_register() - which doesn't add the connector to
  ^ should be drm_connector_dynamic_init()

> the list - and registering it with drm_connector_dynamic_register() -
> which adds the connector to the list - after the initialization is
> complete.
> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Wayne Lin <wayne.lin@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index 6e43594906130..d398bc74e6677 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -590,11 +590,12 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  	amdgpu_dm_set_mst_status(&aconnector->mst_status,
>  			MST_PROBE, true);
>  
> -	if (drm_connector_init(
> +	if (drm_connector_dynamic_init(
>  		dev,
>  		connector,
>  		&dm_dp_mst_connector_funcs,
> -		DRM_MODE_CONNECTOR_DisplayPort)) {
> +		DRM_MODE_CONNECTOR_DisplayPort,
> +		NULL)) {
>  		kfree(aconnector);
>  		return NULL;
>  	}
> -- 
> 2.44.2
>
Alex Deucher Dec. 16, 2024, 6:26 p.m. UTC | #3
On Mon, Dec 16, 2024 at 8:13 AM Imre Deak <imre.deak@intel.com> wrote:
>
> Hi Harry, Leo, Alex, Wayne,
>
> could you please ack this change as well?

Patches 1-9 are:
Acked-by: Alex Deucher <alexander.deucher@amd.com>

Feel free to take this one through whichever tree you are planning to
commit these to.

Alex

>
> Thanks,
> Imre
>
> A typo below in the commit log, can fix it while merging the patch here and in
> the i915/nouveau patches.
>
> On Thu, Dec 12, 2024 at 01:03:23AM +0200, Imre Deak wrote:
> > After a connector is added to the drm_mode_config::connector_list, it's
> > visible to any in-kernel users looking up connectors via the above list.
> > Make sure that the connector is properly initialized before such
> > look-ups, by initializing the connector with
> > drm_connector_dynamic_register() - which doesn't add the connector to
>   ^ should be drm_connector_dynamic_init()
>
> > the list - and registering it with drm_connector_dynamic_register() -
> > which adds the connector to the list - after the initialization is
> > complete.
> >
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Leo Li <sunpeng.li@amd.com>
> > Cc: Wayne Lin <wayne.lin@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Lyude Paul <lyude@redhat.com>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> > index 6e43594906130..d398bc74e6677 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> > @@ -590,11 +590,12 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
> >       amdgpu_dm_set_mst_status(&aconnector->mst_status,
> >                       MST_PROBE, true);
> >
> > -     if (drm_connector_init(
> > +     if (drm_connector_dynamic_init(
> >               dev,
> >               connector,
> >               &dm_dp_mst_connector_funcs,
> > -             DRM_MODE_CONNECTOR_DisplayPort)) {
> > +             DRM_MODE_CONNECTOR_DisplayPort,
> > +             NULL)) {
> >               kfree(aconnector);
> >               return NULL;
> >       }
> > --
> > 2.44.2
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 6e43594906130..d398bc74e6677 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -590,11 +590,12 @@  dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	amdgpu_dm_set_mst_status(&aconnector->mst_status,
 			MST_PROBE, true);
 
-	if (drm_connector_init(
+	if (drm_connector_dynamic_init(
 		dev,
 		connector,
 		&dm_dp_mst_connector_funcs,
-		DRM_MODE_CONNECTOR_DisplayPort)) {
+		DRM_MODE_CONNECTOR_DisplayPort,
+		NULL)) {
 		kfree(aconnector);
 		return NULL;
 	}