amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher@amd.com>
To: "Lipski, Mikita" <Mikita.Lipski@amd.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Thierry Reding" <thierry.reding@gmail.com>
Cc: "Wang, Chao-kai \(Stylon\)" <Stylon.Wang@amd.com>,
	"Park, Chris" <Chris.Park@amd.com>,
	"Brol, Eryk" <Eryk.Brol@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Li, Sun peng \(Leo\)" <Sunpeng.Li@amd.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>,
	"Siqueira, Rodrigo" <Rodrigo.Siqueira@amd.com>,
	open list <linux-kernel@vger.kernel.org>,
	"Cornij,  Nikola" <Nikola.Cornij@amd.com>,
	"Somasundaram,
	Meenakshikumar" <Meenakshikumar.Somasundaram@amd.com>,
	David Airlie <airlied@linux.ie>,
	"Pillai, Aurabindo" <Aurabindo.Pillai@amd.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	"Lin,  Wayne" <Wayne.Lin@amd.com>,
	"Lakha, Bhawanpreet" <Bhawanpreet.Lakha@amd.com>,
	"Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>
Subject: Re: [PATCH v3 01/20] drm/amdgpu: Add error handling to amdgpu_dm_initialize_dp_connector()
Date: Wed, 21 Apr 2021 15:22:09 +0000	[thread overview]
Message-ID: <MN2PR12MB44881474AB2AC26A83C8E968F7479@MN2PR12MB4488.namprd12.prod.outlook.com> (raw)
In-Reply-To: <bf4f9c16-f5d7-214c-dbb7-08cb58cf6d7c@amd.com>


[-- Attachment #1.1: Type: text/plain, Size: 8505 bytes --]

[AMD Official Use Only - Internal Distribution Only]

I'm fine with having these changes go through drm-misc.

Alex

________________________________
From: Lipski, Mikita <Mikita.Lipski@amd.com>
Sent: Wednesday, April 21, 2021 10:23 AM
To: Lyude Paul <lyude@redhat.com>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; intel-gfx@lists.freedesktop.org <intel-gfx@lists.freedesktop.org>; nouveau@lists.freedesktop.org <nouveau@lists.freedesktop.org>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Ville Syrjälä <ville.syrjala@linux.intel.com>; Jani Nikula <jani.nikula@linux.intel.com>; Rodrigo Vivi <rodrigo.vivi@intel.com>; Thomas Zimmermann <tzimmermann@suse.de>; Thierry Reding <thierry.reding@gmail.com>
Cc: Wang, Chao-kai (Stylon) <Stylon.Wang@amd.com>; Lipski, Mikita <Mikita.Lipski@amd.com>; Park, Chris <Chris.Park@amd.com>; Brol, Eryk <Eryk.Brol@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Lin, Wayne <Wayne.Lin@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; open list <linux-kernel@vger.kernel.org>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Somasundaram, Meenakshikumar <Meenakshikumar.Somasundaram@amd.com>; David Airlie <airlied@linux.ie>; Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Daniel Vetter <daniel@ffwll.ch>; Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>; Deucher, Alexander <Alexander.Deucher@amd.com>; Cornij, Nikola <Nikola.Cornij@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH v3 01/20] drm/amdgpu: Add error handling to amdgpu_dm_initialize_dp_connector()

Thanks for the change!

Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>

On 2021-04-19 6:55 p.m., Lyude Paul wrote:
> While working on moving i2c device registration into drm_dp_aux_init() - I
> realized that in order to do so we need to make sure that drivers calling
> drm_dp_aux_init() handle any errors it could possibly return. In the
> process of doing that, I noticed that the majority of AMD's code for DP
> connector creation doesn't attempt to do any real error handling.
>
> So, let's fix this and also cleanup amdgpu_dm_initialize_dp_connector()
> while we're at it. This way we can handle the error codes from
> drm_dp_aux_init().
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 +++++++-----
>   .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 44 +++++++++++--------
>   .../display/amdgpu_dm/amdgpu_dm_mst_types.h   |  6 +--
>   3 files changed, 45 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index a0c8c41e4e57..fc5d315bbb05 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7608,10 +7608,9 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
>
>        aconnector->i2c = i2c;
>        res = i2c_add_adapter(&i2c->base);
> -
>        if (res) {
>                DRM_ERROR("Failed to register hw i2c %d\n", link->link_index);
> -             goto out_free;
> +             goto fail_free;
>        }
>
>        connector_type = to_drm_connector_type(link->connector_signal);
> @@ -7625,8 +7624,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
>
>        if (res) {
>                DRM_ERROR("connector_init failed\n");
> -             aconnector->connector_id = -1;
> -             goto out_free;
> +             goto fail_id;
>        }
>
>        drm_connector_helper_add(
> @@ -7643,15 +7641,22 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
>        drm_connector_attach_encoder(
>                &aconnector->base, &aencoder->base);
>
> -     if (connector_type == DRM_MODE_CONNECTOR_DisplayPort
> -             || connector_type == DRM_MODE_CONNECTOR_eDP)
> -             amdgpu_dm_initialize_dp_connector(dm, aconnector, link->link_index);
> -
> -out_free:
> -     if (res) {
> -             kfree(i2c);
> -             aconnector->i2c = NULL;
> +     if (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
> +         connector_type == DRM_MODE_CONNECTOR_eDP) {
> +             res = amdgpu_dm_initialize_dp_connector(dm, aconnector, link->link_index);
> +             if (res)
> +                     goto fail_cleanup;
>        }
> +
> +     return 0;
> +fail_cleanup:
> +     drm_connector_cleanup(&aconnector->base);
> +fail_id:
> +     aconnector->connector_id = -1;
> +fail_free:
> +     kfree(i2c);
> +     aconnector->i2c = NULL;
> +
>        return res;
>   }
>
> 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 73cdb9fe981a..3dee9cce9c9e 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
> @@ -425,33 +425,39 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
>        .add_connector = dm_dp_add_mst_connector,
>   };
>
> -void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> -                                    struct amdgpu_dm_connector *aconnector,
> -                                    int link_index)
> +int amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> +                                   struct amdgpu_dm_connector *aconnector,
> +                                   int link_index)
>   {
> -     aconnector->dm_dp_aux.aux.name =
> -             kasprintf(GFP_KERNEL, "AMDGPU DM aux hw bus %d",
> -                       link_index);
> -     aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
> -     aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
> +     struct amdgpu_dm_dp_aux *dm_aux = &aconnector->dm_dp_aux;
> +     int ret;
>
> -     drm_dp_aux_init(&aconnector->dm_dp_aux.aux);
> -     drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux,
> -                                   &aconnector->base);
> +     dm_aux->aux.name = kasprintf(GFP_KERNEL, "AMDGPU DM aux hw bus %d", link_index);
> +     if (!dm_aux->aux.name)
> +             return -ENOMEM;
> +
> +     dm_aux->aux.transfer = dm_dp_aux_transfer;
> +     dm_aux->ddc_service = aconnector->dc_link->ddc;
> +
> +     drm_dp_aux_init(&dm_aux->aux);
> +     drm_dp_cec_register_connector(&dm_aux->aux, &aconnector->base);
>
>        if (aconnector->base.connector_type == DRM_MODE_CONNECTOR_eDP)
> -             return;
> +             return 0;
>
>        aconnector->mst_mgr.cbs = &dm_mst_cbs;
> -     drm_dp_mst_topology_mgr_init(
> -             &aconnector->mst_mgr,
> -             adev_to_drm(dm->adev),
> -             &aconnector->dm_dp_aux.aux,
> -             16,
> -             4,
> -             aconnector->connector_id);
> +     ret = drm_dp_mst_topology_mgr_init(&aconnector->mst_mgr, adev_to_drm(dm->adev),
> +                                        &dm_aux->aux, 16, 4, aconnector->connector_id);
> +     if (ret)
> +             goto unreg_cec;
>
>        drm_connector_attach_dp_subconnector_property(&aconnector->base);
> +
> +     return 0;
> +unreg_cec:
> +     drm_dp_cec_unregister_connector(&dm_aux->aux);
> +     kfree(dm_aux->aux.name);
> +     return ret;
>   }
>
>   int dm_mst_get_pbn_divider(struct dc_link *link)
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> index b38bd68121ce..cf771ff58bb3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> @@ -31,9 +31,9 @@ struct amdgpu_dm_connector;
>
>   int dm_mst_get_pbn_divider(struct dc_link *link);
>
> -void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> -                                    struct amdgpu_dm_connector *aconnector,
> -                                    int link_index);
> +int amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> +                                   struct amdgpu_dm_connector *aconnector,
> +                                   int link_index);
>
>   void
>   dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev);
>

[-- Attachment #1.2: Type: text/html, Size: 16189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-04-21 15:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 22:55 [PATCH v3 00/20] drm: Use new DRM printk funcs (like drm_dbg_*()) in DP helpers Lyude Paul
2021-04-19 22:55 ` [PATCH v3 01/20] drm/amdgpu: Add error handling to amdgpu_dm_initialize_dp_connector() Lyude Paul
2021-04-21 14:23   ` Mikita Lipski
2021-04-21 15:22     ` Deucher, Alexander [this message]
2021-04-19 22:55 ` [PATCH v3 02/20] drm/dp: Add __no_check to drm_dp_aux_register() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 03/20] drm/dp: Move i2c init to drm_dp_aux_init, add __must_check and fini Lyude Paul
2021-04-19 23:16   ` Ville Syrjälä
2021-04-22 17:18     ` Lyude Paul
2021-04-22 22:33       ` Lyude Paul
2021-04-23  4:11         ` Lyude Paul
2021-04-23 12:39           ` Thierry Reding
2021-04-23 17:53             ` Lyude Paul
2021-04-23 12:38         ` Thierry Reding
2021-04-23 12:34       ` Thierry Reding
2021-04-19 22:55 ` [PATCH v3 04/20] drm/bridge/cdns-mhdp8546: Register DP aux channel with userspace Lyude Paul
2021-04-19 22:55 ` [PATCH v3 05/20] drm/nouveau/kms/nv50-: Move AUX adapter reg to connector late register/early unregister Lyude Paul
2021-04-19 22:55 ` [PATCH v3 06/20] drm/dp: Add backpointer to drm_device in drm_dp_aux Lyude Paul
2021-04-19 22:55 ` [PATCH v3 07/20] drm/dp: Clarify DP AUX registration time Lyude Paul
2021-04-19 22:55 ` [PATCH v3 08/20] drm/dp: Pass drm_dp_aux to drm_dp_link_train_clock_recovery_delay() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 09/20] drm/dp: Pass drm_dp_aux to drm_dp*_link_train_channel_eq_delay() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 10/20] drm/dp: Always print aux channel name in logs Lyude Paul
2021-04-19 22:55 ` [PATCH v3 11/20] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 12/20] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_set_tmds_output() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 13/20] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_max_tmds_clock() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 14/20] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_get_tmds_output() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 15/20] drm/dp_dual_mode: Pass drm_device to drm_lspcon_(get|set)_mode() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 16/20] drm/dp_mst: Pass drm_dp_mst_topology_mgr to drm_dp_get_vc_payload_bw() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 17/20] drm/print: Handle potentially NULL drm_devices in drm_dbg_* Lyude Paul
2021-04-19 22:55 ` [PATCH v3 18/20] drm/dp: Convert drm_dp_helper.c to using drm_err/drm_dbg_*() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 19/20] drm/dp_dual_mode: Convert drm_dp_dual_mode_helper.c to using drm_err/drm_dbg_kms() Lyude Paul
2021-04-19 22:55 ` [PATCH v3 20/20] drm/dp_mst: Convert drm_dp_mst_topology.c to drm_err()/drm_dbg*() Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB44881474AB2AC26A83C8E968F7479@MN2PR12MB4488.namprd12.prod.outlook.com \
    --to=alexander.deucher@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Chris.Park@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Eryk.Brol@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Meenakshikumar.Somasundaram@amd.com \
    --cc=Mikita.Lipski@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=Nikola.Cornij@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Stylon.Wang@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bas@basnieuwenhuizen.nl \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=thierry.reding@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).