diff mbox series

[v2,4/5] drm/i915: dont retry stream management at seq_num_m roll over

Message ID 20200212102942.26568-5-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show
Series HDCP misc | expand

Commit Message

Ramalingam C Feb. 12, 2020, 10:29 a.m. UTC
When roll over detected for seq_num_m, we shouldn't continue with stream
management with rolled over value.

So we are terminating the stream management retry, on roll over of the
seq_num_m.

v2:
  using drm_dbg_kms instead of DRM_DEBUG_KMS [Anshuman]
v3:
  dev_priv is used as i915 [JaniN]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Gupta, Anshuman Feb. 13, 2020, 10:37 a.m. UTC | #1
On 2020-02-12 at 15:59:41 +0530, Ramalingam C wrote:
> When roll over detected for seq_num_m, we shouldn't continue with stream
> management with rolled over value.
> 
> So we are terminating the stream management retry, on roll over of the
> seq_num_m.
> 
> v2:
>   using drm_dbg_kms instead of DRM_DEBUG_KMS [Anshuman]
> v3:
>   dev_priv is used as i915 [JaniN]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index b24d12efae0a..b35f50d4a0e9 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -1419,11 +1419,6 @@ int _hdcp2_propagate_stream_management_info(struct intel_connector *connector)
>  
>  err_exit:
>  	hdcp->seq_num_m++;
> -	if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
> -		DRM_DEBUG_KMS("seq_num_m roll over.\n");
> -		ret = -1;
> -	}
> -
>  	return ret;
>  }
>  
> @@ -1618,8 +1613,11 @@ hdcp2_propagate_stream_management_info(struct intel_connector *connector)
>  
>  	for (i = 0; i < tries; i++) {
>  		ret = _hdcp2_propagate_stream_management_info(connector);
> -		if (!ret)
> +		if (!ret || connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
> +			if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX)
> +				drm_dbg_kms(&i915->drm, "seq_num_m roll over.\n");
>  			break;
> +		}
Tested this with HDCP Comp tool.
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Tested-by: Anshuman Gupta <anshuman.gupta@intel.com>
>  
>  		drm_dbg_kms(&i915->drm,
>  			    "HDCP2 stream management %d of %d Failed.(%d)\n",
> -- 
> 2.20.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sean Paul Feb. 18, 2020, 3:40 p.m. UTC | #2
On Wed, Feb 12, 2020 at 03:59:41PM +0530, Ramalingam C wrote:
> When roll over detected for seq_num_m, we shouldn't continue with stream
> management with rolled over value.
> 
> So we are terminating the stream management retry, on roll over of the
> seq_num_m.
> 
> v2:
>   using drm_dbg_kms instead of DRM_DEBUG_KMS [Anshuman]
> v3:
>   dev_priv is used as i915 [JaniN]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index b24d12efae0a..b35f50d4a0e9 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -1419,11 +1419,6 @@ int _hdcp2_propagate_stream_management_info(struct intel_connector *connector)
>  
>  err_exit:
>  	hdcp->seq_num_m++;
> -	if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
> -		DRM_DEBUG_KMS("seq_num_m roll over.\n");
> -		ret = -1;
> -	}
> -
>  	return ret;
>  }
>  
> @@ -1618,8 +1613,11 @@ hdcp2_propagate_stream_management_info(struct intel_connector *connector)
>  
>  	for (i = 0; i < tries; i++) {
>  		ret = _hdcp2_propagate_stream_management_info(connector);
> -		if (!ret)
> +		if (!ret || connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
> +			if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX)
> +				drm_dbg_kms(&i915->drm, "seq_num_m roll over.\n");
>  			break;
> +		}

IMO it doesn't read quite right bunching up a success outcome and a failure,
and it's actually less code (character-wise) to do:

                if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
                        drm_dbg_kms(&i915->drm, "seq_num_m roll over.\n");
                        break;
                } else if (!ret) {
                        break;
                }

feel free to add

Reviewed-by: Sean Paul <sean@poorly.run>

with this addressed

>  
>  		drm_dbg_kms(&i915->drm,
>  			    "HDCP2 stream management %d of %d Failed.(%d)\n",
> -- 
> 2.20.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index b24d12efae0a..b35f50d4a0e9 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -1419,11 +1419,6 @@  int _hdcp2_propagate_stream_management_info(struct intel_connector *connector)
 
 err_exit:
 	hdcp->seq_num_m++;
-	if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
-		DRM_DEBUG_KMS("seq_num_m roll over.\n");
-		ret = -1;
-	}
-
 	return ret;
 }
 
@@ -1618,8 +1613,11 @@  hdcp2_propagate_stream_management_info(struct intel_connector *connector)
 
 	for (i = 0; i < tries; i++) {
 		ret = _hdcp2_propagate_stream_management_info(connector);
-		if (!ret)
+		if (!ret || connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
+			if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX)
+				drm_dbg_kms(&i915->drm, "seq_num_m roll over.\n");
 			break;
+		}
 
 		drm_dbg_kms(&i915->drm,
 			    "HDCP2 stream management %d of %d Failed.(%d)\n",