[PATCH] drm/dp_mst: Remove VCPI while disabling topology mgr

Lyude Paul lyude at redhat.com
Tue Dec 3 00:02:35 UTC 2019


I'm, not entirely sure what this patch is trying to accomplish. I'm guessing
maybe we're leaving stale VCPI allocations from the previous topology
enablement and then somehow trying to use those again when allocating
payloads? The patch looks correct at least.

If this patch is fixing an issue, such as displays not turning on with amdgpu,
I'd definitely mention it in more detail here and Cc to stable if applicable.
Also, one nitpick below:

On Mon, 2019-12-02 at 11:57 +0800, Wayne Lin wrote:
> [Why]
> While disabling mst topology manager in
> drm_dp_mst_topology_mgr_set_mst(), now just reset the mgr->payloads
> but doesn't handle the mgr->proposed_vcpis.
> 
> [How]
> Remove mgr->proposed_vcpis to NULL.
> 
> Signed-off-by: Wayne Lin <Wayne.Lin at 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..81e92b260d7a 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 *tmp_vcpi = mgr->proposed_vcpis[i];
> +
> +			if (tmp_vcpi) {
> +				tmp_vcpi->vcpi = 0;
> +				tmp_vcpi->num_slots = 0;
> +			}
> +			mgr->proposed_vcpis[i] = NULL;
> +		}
>  		mgr->vcpi_mask = 0;
> +		mutex_unlock(&mgr->payload_lock);

bikeshed: I'd just rename tmp_vcpi here to vcpi, but I'll leave that up to you
>  	}
>  
>  out_unlock:
-- 
Cheers,
	Lyude Paul



More information about the amd-gfx mailing list