All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lin, Wayne" <Wayne.Lin@amd.com>
To: Lyude Paul <lyude@redhat.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Zuo, Jerry" <Jerry.Zuo@amd.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr
Date: Mon, 9 Dec 2019 05:56:48 +0000	[thread overview]
Message-ID: <DM6PR12MB41371AC4B0EC24E84AB0C84DFC580@DM6PR12MB4137.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ec3e020798d99ce638c05b0f3eb00ebf53c3bd7c.camel@redhat.com>



> -----Original Message-----
> From: Lyude Paul <lyude@redhat.com>
> Sent: Saturday, December 7, 2019 3:57 AM
> To: Lin, Wayne <Wayne.Lin@amd.com>; dri-devel@lists.freedesktop.org;
> amd-gfx@lists.freedesktop.org
> Cc: Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Wentland, Harry
> <Harry.Wentland@amd.com>; Zuo, Jerry <Jerry.Zuo@amd.com>;
> stable@vger.kernel.org
> Subject: Re: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology
> mgr
> 
> On Fri, 2019-12-06 at 14:24 -0500, Lyude Paul wrote:
> > Reviewed-by: Lyude Paul <lyude@redhat.com>
> >
> > I'll go ahead and push this to drm-misc-next-fixes right now, thanks!
> 
> Whoops-meant to say drm-misc-next here, anyway, pushed!
Thanks for your time!

> >
> > On Thu, 2019-12-05 at 17:00 +0800, Wayne Lin wrote:
> > > [Why]
> > >
> > > This patch is trying to address the issue observed when hotplug DP
> > > daisy chain monitors.
> > >
> > > e.g.
> > > src-mstb-mstb-sst -> src (unplug) mstb-mstb-sst -> src-mstb-mstb-sst
> > > (plug in again)
> > >
> > > Once unplug a DP MST capable device, driver will call
> > > drm_dp_mst_topology_mgr_set_mst() to disable MST. In this function,
> > > it cleans data of topology manager while disabling mst_state.
> > > However, it doesn't clean up the proposed_vcpis of topology manager.
> > > If proposed_vcpi is not reset, once plug in MST daisy chain monitors
> > > later, code will fail at checking port validation while trying to
> > > allocate payloads.
> > >
> > > When MST capable device is plugged in again and try to allocate
> > > payloads by calling drm_dp_update_payload_part1(), this function
> > > will iterate over all proposed virtual channels to see if any
> > > proposed VCPI's num_slots is greater than 0. If any proposed VCPI's
> > > num_slots is greater than 0 and the port which the specific virtual
> > > channel directed to is not in the topology, code then fails at the
> > > port validation. Since there are stale VCPI allocations from the
> > > previous topology enablement in proposed_vcpi[], code will fail at
> > > port validation and reurn EINVAL.
> > >
> > > [How]
> > >
> > > Clean up the data of stale proposed_vcpi[] and reset
> > > mgr->proposed_vcpis to NULL while disabling mst in
> drm_dp_mst_topology_mgr_set_mst().
> > >
> > > Changes since v1:
> > > *Add on more details in commit message to describe the issue which
> > > the patch is trying to fix
> > >
> > > Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> > > ---
> > >  drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > index ae5809a1f19a..bf4f745a4edb 100644
> > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > @@ -3386,6 +3386,7 @@ static int drm_dp_get_vc_payload_bw(u8
> > > dp_link_bw,
> > > u8  dp_link_count)
> > >  int drm_dp_mst_topology_mgr_set_mst(struct
> drm_dp_mst_topology_mgr
> > > *mgr, bool mst_state)  {
> > >  	int ret = 0;
> > > +	int i = 0;
> > >  	struct drm_dp_mst_branch *mstb = NULL;
> > >
> > >  	mutex_lock(&mgr->lock);
> > > @@ -3446,10 +3447,21 @@ int
> drm_dp_mst_topology_mgr_set_mst(struct
> > > drm_dp_mst_topology_mgr *mgr, bool ms
> > >  		/* this can fail if the device is gone */
> > >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
> > >  		ret = 0;
> > > +		mutex_lock(&mgr->payload_lock);
> > >  		memset(mgr->payloads, 0, mgr->max_payloads * sizeof(struct
> > > drm_dp_payload));
> > >  		mgr->payload_mask = 0;
> > >  		set_bit(0, &mgr->payload_mask);
> > > +		for (i = 0; i < mgr->max_payloads; i++) {
> > > +			struct drm_dp_vcpi *vcpi = mgr->proposed_vcpis[i];
> > > +
> > > +			if (vcpi) {
> > > +				vcpi->vcpi = 0;
> > > +				vcpi->num_slots = 0;
> > > +			}
> > > +			mgr->proposed_vcpis[i] = NULL;
> > > +		}
> > >  		mgr->vcpi_mask = 0;
> > > +		mutex_unlock(&mgr->payload_lock);
> > >  	}
> > >
> > >  out_unlock:
> --
> Cheers,
> 	Lyude Paul

--
Regards,
Wayne Lin

WARNING: multiple messages have this Message-ID (diff)
From: "Lin, Wayne" <Wayne.Lin@amd.com>
To: Lyude Paul <lyude@redhat.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Zuo, Jerry" <Jerry.Zuo@amd.com>,
	"Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr
Date: Mon, 9 Dec 2019 05:56:48 +0000	[thread overview]
Message-ID: <DM6PR12MB41371AC4B0EC24E84AB0C84DFC580@DM6PR12MB4137.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ec3e020798d99ce638c05b0f3eb00ebf53c3bd7c.camel@redhat.com>



> -----Original Message-----
> From: Lyude Paul <lyude@redhat.com>
> Sent: Saturday, December 7, 2019 3:57 AM
> To: Lin, Wayne <Wayne.Lin@amd.com>; dri-devel@lists.freedesktop.org;
> amd-gfx@lists.freedesktop.org
> Cc: Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Wentland, Harry
> <Harry.Wentland@amd.com>; Zuo, Jerry <Jerry.Zuo@amd.com>;
> stable@vger.kernel.org
> Subject: Re: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology
> mgr
> 
> On Fri, 2019-12-06 at 14:24 -0500, Lyude Paul wrote:
> > Reviewed-by: Lyude Paul <lyude@redhat.com>
> >
> > I'll go ahead and push this to drm-misc-next-fixes right now, thanks!
> 
> Whoops-meant to say drm-misc-next here, anyway, pushed!
Thanks for your time!

> >
> > On Thu, 2019-12-05 at 17:00 +0800, Wayne Lin wrote:
> > > [Why]
> > >
> > > This patch is trying to address the issue observed when hotplug DP
> > > daisy chain monitors.
> > >
> > > e.g.
> > > src-mstb-mstb-sst -> src (unplug) mstb-mstb-sst -> src-mstb-mstb-sst
> > > (plug in again)
> > >
> > > Once unplug a DP MST capable device, driver will call
> > > drm_dp_mst_topology_mgr_set_mst() to disable MST. In this function,
> > > it cleans data of topology manager while disabling mst_state.
> > > However, it doesn't clean up the proposed_vcpis of topology manager.
> > > If proposed_vcpi is not reset, once plug in MST daisy chain monitors
> > > later, code will fail at checking port validation while trying to
> > > allocate payloads.
> > >
> > > When MST capable device is plugged in again and try to allocate
> > > payloads by calling drm_dp_update_payload_part1(), this function
> > > will iterate over all proposed virtual channels to see if any
> > > proposed VCPI's num_slots is greater than 0. If any proposed VCPI's
> > > num_slots is greater than 0 and the port which the specific virtual
> > > channel directed to is not in the topology, code then fails at the
> > > port validation. Since there are stale VCPI allocations from the
> > > previous topology enablement in proposed_vcpi[], code will fail at
> > > port validation and reurn EINVAL.
> > >
> > > [How]
> > >
> > > Clean up the data of stale proposed_vcpi[] and reset
> > > mgr->proposed_vcpis to NULL while disabling mst in
> drm_dp_mst_topology_mgr_set_mst().
> > >
> > > Changes since v1:
> > > *Add on more details in commit message to describe the issue which
> > > the patch is trying to fix
> > >
> > > Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> > > ---
> > >  drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > index ae5809a1f19a..bf4f745a4edb 100644
> > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > @@ -3386,6 +3386,7 @@ static int drm_dp_get_vc_payload_bw(u8
> > > dp_link_bw,
> > > u8  dp_link_count)
> > >  int drm_dp_mst_topology_mgr_set_mst(struct
> drm_dp_mst_topology_mgr
> > > *mgr, bool mst_state)  {
> > >  	int ret = 0;
> > > +	int i = 0;
> > >  	struct drm_dp_mst_branch *mstb = NULL;
> > >
> > >  	mutex_lock(&mgr->lock);
> > > @@ -3446,10 +3447,21 @@ int
> drm_dp_mst_topology_mgr_set_mst(struct
> > > drm_dp_mst_topology_mgr *mgr, bool ms
> > >  		/* this can fail if the device is gone */
> > >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
> > >  		ret = 0;
> > > +		mutex_lock(&mgr->payload_lock);
> > >  		memset(mgr->payloads, 0, mgr->max_payloads * sizeof(struct
> > > drm_dp_payload));
> > >  		mgr->payload_mask = 0;
> > >  		set_bit(0, &mgr->payload_mask);
> > > +		for (i = 0; i < mgr->max_payloads; i++) {
> > > +			struct drm_dp_vcpi *vcpi = mgr->proposed_vcpis[i];
> > > +
> > > +			if (vcpi) {
> > > +				vcpi->vcpi = 0;
> > > +				vcpi->num_slots = 0;
> > > +			}
> > > +			mgr->proposed_vcpis[i] = NULL;
> > > +		}
> > >  		mgr->vcpi_mask = 0;
> > > +		mutex_unlock(&mgr->payload_lock);
> > >  	}
> > >
> > >  out_unlock:
> --
> Cheers,
> 	Lyude Paul

--
Regards,
Wayne Lin
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Lin, Wayne" <Wayne.Lin@amd.com>
To: Lyude Paul <lyude@redhat.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Zuo, Jerry" <Jerry.Zuo@amd.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Kazlauskas, Nicholas" <Nicholas.Kazlauskas@amd.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr
Date: Mon, 9 Dec 2019 05:56:48 +0000	[thread overview]
Message-ID: <DM6PR12MB41371AC4B0EC24E84AB0C84DFC580@DM6PR12MB4137.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ec3e020798d99ce638c05b0f3eb00ebf53c3bd7c.camel@redhat.com>



> -----Original Message-----
> From: Lyude Paul <lyude@redhat.com>
> Sent: Saturday, December 7, 2019 3:57 AM
> To: Lin, Wayne <Wayne.Lin@amd.com>; dri-devel@lists.freedesktop.org;
> amd-gfx@lists.freedesktop.org
> Cc: Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Wentland, Harry
> <Harry.Wentland@amd.com>; Zuo, Jerry <Jerry.Zuo@amd.com>;
> stable@vger.kernel.org
> Subject: Re: [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology
> mgr
> 
> On Fri, 2019-12-06 at 14:24 -0500, Lyude Paul wrote:
> > Reviewed-by: Lyude Paul <lyude@redhat.com>
> >
> > I'll go ahead and push this to drm-misc-next-fixes right now, thanks!
> 
> Whoops-meant to say drm-misc-next here, anyway, pushed!
Thanks for your time!

> >
> > On Thu, 2019-12-05 at 17:00 +0800, Wayne Lin wrote:
> > > [Why]
> > >
> > > This patch is trying to address the issue observed when hotplug DP
> > > daisy chain monitors.
> > >
> > > e.g.
> > > src-mstb-mstb-sst -> src (unplug) mstb-mstb-sst -> src-mstb-mstb-sst
> > > (plug in again)
> > >
> > > Once unplug a DP MST capable device, driver will call
> > > drm_dp_mst_topology_mgr_set_mst() to disable MST. In this function,
> > > it cleans data of topology manager while disabling mst_state.
> > > However, it doesn't clean up the proposed_vcpis of topology manager.
> > > If proposed_vcpi is not reset, once plug in MST daisy chain monitors
> > > later, code will fail at checking port validation while trying to
> > > allocate payloads.
> > >
> > > When MST capable device is plugged in again and try to allocate
> > > payloads by calling drm_dp_update_payload_part1(), this function
> > > will iterate over all proposed virtual channels to see if any
> > > proposed VCPI's num_slots is greater than 0. If any proposed VCPI's
> > > num_slots is greater than 0 and the port which the specific virtual
> > > channel directed to is not in the topology, code then fails at the
> > > port validation. Since there are stale VCPI allocations from the
> > > previous topology enablement in proposed_vcpi[], code will fail at
> > > port validation and reurn EINVAL.
> > >
> > > [How]
> > >
> > > Clean up the data of stale proposed_vcpi[] and reset
> > > mgr->proposed_vcpis to NULL while disabling mst in
> drm_dp_mst_topology_mgr_set_mst().
> > >
> > > Changes since v1:
> > > *Add on more details in commit message to describe the issue which
> > > the patch is trying to fix
> > >
> > > Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> > > ---
> > >  drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > index ae5809a1f19a..bf4f745a4edb 100644
> > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > @@ -3386,6 +3386,7 @@ static int drm_dp_get_vc_payload_bw(u8
> > > dp_link_bw,
> > > u8  dp_link_count)
> > >  int drm_dp_mst_topology_mgr_set_mst(struct
> drm_dp_mst_topology_mgr
> > > *mgr, bool mst_state)  {
> > >  	int ret = 0;
> > > +	int i = 0;
> > >  	struct drm_dp_mst_branch *mstb = NULL;
> > >
> > >  	mutex_lock(&mgr->lock);
> > > @@ -3446,10 +3447,21 @@ int
> drm_dp_mst_topology_mgr_set_mst(struct
> > > drm_dp_mst_topology_mgr *mgr, bool ms
> > >  		/* this can fail if the device is gone */
> > >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
> > >  		ret = 0;
> > > +		mutex_lock(&mgr->payload_lock);
> > >  		memset(mgr->payloads, 0, mgr->max_payloads * sizeof(struct
> > > drm_dp_payload));
> > >  		mgr->payload_mask = 0;
> > >  		set_bit(0, &mgr->payload_mask);
> > > +		for (i = 0; i < mgr->max_payloads; i++) {
> > > +			struct drm_dp_vcpi *vcpi = mgr->proposed_vcpis[i];
> > > +
> > > +			if (vcpi) {
> > > +				vcpi->vcpi = 0;
> > > +				vcpi->num_slots = 0;
> > > +			}
> > > +			mgr->proposed_vcpis[i] = NULL;
> > > +		}
> > >  		mgr->vcpi_mask = 0;
> > > +		mutex_unlock(&mgr->payload_lock);
> > >  	}
> > >
> > >  out_unlock:
> --
> Cheers,
> 	Lyude Paul

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

  reply	other threads:[~2019-12-09  5:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05  9:00 [PATCH v2] drm/dp_mst: Remove VCPI while disabling topology mgr Wayne Lin
2019-12-05  9:00 ` Wayne Lin
2019-12-05  9:00 ` Wayne Lin
2019-12-06 19:24 ` Lyude Paul
2019-12-06 19:24   ` Lyude Paul
2019-12-06 19:24   ` Lyude Paul
2019-12-06 19:57   ` Lyude Paul
2019-12-06 19:57     ` Lyude Paul
2019-12-06 19:57     ` Lyude Paul
2019-12-09  5:56     ` Lin, Wayne [this message]
2019-12-09  5:56       ` Lin, Wayne
2019-12-09  5:56       ` Lin, Wayne
2020-01-17 16:19       ` Sean Paul
2020-01-17 16:19         ` Sean Paul
2020-01-17 16:19         ` Sean Paul
2020-01-17 20:27         ` Lyude Paul
2020-01-17 20:27           ` Lyude Paul
2020-01-17 20:27           ` Lyude Paul
2020-01-17 20:43           ` Sean Paul
2020-01-17 20:43             ` Sean Paul
2020-01-17 20:43             ` Sean Paul
2020-01-17 20:45             ` Lyude Paul
2020-01-17 20:45               ` Lyude Paul
2020-01-17 20:45               ` Lyude Paul
2020-01-22  4:48               ` Lin, Wayne
2020-01-22  4:48                 ` Lin, Wayne
2020-01-22  4:48                 ` Lin, Wayne
2020-01-22 20:18                 ` Lyude Paul
2020-01-22 20:18                   ` Lyude Paul
2020-01-22 20:18                   ` 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=DM6PR12MB41371AC4B0EC24E84AB0C84DFC580@DM6PR12MB4137.namprd12.prod.outlook.com \
    --to=wayne.lin@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.