diff mbox series

[2/2] drm/i915/hdcp: Fix 1B-10 HDCP 2.2 Comp test

Message ID 20200206150442.32353-3-anshuman.gupta@intel.com (mailing list archive)
State New, archived
Headers show
Series HDCP 2.2 Comp fixes | expand

Commit Message

Gupta, Anshuman Feb. 6, 2020, 3:04 p.m. UTC
1B-10 HDCP Comp test verifies that source DUT reattempts
Content Stream Management following a failure of Content
Stream Management, 1B-10 test fail if source DUT tries
reauthentication following a Content Stream Management
failure.
Fixing this broken test.

Cc: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 .../drm/i915/display/intel_display_types.h    |  3 ++
 drivers/gpu/drm/i915/display/intel_hdcp.c     | 32 ++++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)

Comments

Ramalingam C Feb. 6, 2020, 5:13 p.m. UTC | #1
On 2020-02-06 at 20:34:42 +0530, Anshuman Gupta wrote:
> 1B-10 HDCP Comp test verifies that source DUT reattempts
> Content Stream Management following a failure of Content
> Stream Management, 1B-10 test fail if source DUT tries
> reauthentication following a Content Stream Management
> failure.
> Fixing this broken test.
We could explain what we do in brief?
> 
> Cc: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  .../drm/i915/display/intel_display_types.h    |  3 ++
>  drivers/gpu/drm/i915/display/intel_hdcp.c     | 32 ++++++++++++++++---
>  2 files changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 2ae540e986ba..9232c4e0e42e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -363,6 +363,9 @@ struct intel_hdcp {
>  	/* Flag indicate if it is a first ReceiverID_List msg after AKE_Init */
>  	bool first_recvid_msg;
>  
> +	/* Flag indicate whether reauth retries req */
> +	bool reauth_req;
Personally I would try to avoid extra flags here. See if you could.
> +
>  	/*
>  	 * Content Stream Type defined by content owner. TYPE0(0x0) content can
>  	 * flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1)
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 3e24a6df503a..ed523de20eac 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -1507,13 +1507,35 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)
>  
>  static int hdcp2_authenticate_repeater(struct intel_connector *connector)
>  {
> -	int ret;
> +	int ret, i, tries = 3;
> +	struct intel_hdcp *hdcp = &connector->hdcp;
> +	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
Preferred to sort the lengthiest line first.
>  
>  	ret = hdcp2_authenticate_repeater_topology(connector);
>  	if (ret < 0)
>  		return ret;
>  
> -	return hdcp2_propagate_stream_management_info(connector);
> +	/*
> +	 * HDCP 2.2 HDCP Spec Stream Managemnt pass/fail transition
> +	 * to HDCP authticate state i.e. A9->A5.
> +	 * if it fails, retry for stream managemnt again and skip the reauth.
> +	 */
> +	for (i = 0; i < tries; i++) {
> +		ret = hdcp2_propagate_stream_management_info(connector);
> +		if (!ret) {
> +			hdcp->reauth_req  = true;
this is not required. hence {}.
> +			break;
> +		}
> +
> +		hdcp->seq_num_m++;
> +		drm_dbg_kms(&dev_priv->drm, "HDCP2.2 stream management %d of %d Failed.(%d)\n",
This can be wrapped to 80char without any loss of readability.

-Ram
> +			    i + 1, tries, ret);
> +	}
> +
> +	if (ret)
> +		hdcp->reauth_req  = false;
> +
> +	return ret;
>  }
>  
>  static int hdcp2_authenticate_sink(struct intel_connector *connector)
> @@ -1642,10 +1664,11 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)
>  static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
>  {
>  	int ret, i, tries = 3;
> +	struct intel_hdcp *hdcp = &connector->hdcp;
>  
>  	for (i = 0; i < tries; i++) {
>  		ret = hdcp2_authenticate_sink(connector);
> -		if (!ret)
> +		if (!ret || !hdcp->reauth_req)
>  			break;
>  
>  		/* Clearing the mei hdcp session */
> @@ -1655,7 +1678,7 @@ static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
>  			DRM_DEBUG_KMS("Port deauth failed.\n");
>  	}
>  
> -	if (i != tries) {
> +	if (!ret) {
>  		/*
>  		 * Ensuring the required 200mSec min time interval between
>  		 * Session Key Exchange and encryption.
> @@ -1681,6 +1704,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
>  		      connector->base.name, connector->base.base.id,
>  		      hdcp->content_type);
>  
> +	hdcp->reauth_req  = true;
>  	ret = hdcp2_authenticate_and_encrypt(connector);
>  	if (ret) {
>  		DRM_DEBUG_KMS("HDCP2 Type%d  Enabling Failed. (%d)\n",
> -- 
> 2.24.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 2ae540e986ba..9232c4e0e42e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -363,6 +363,9 @@  struct intel_hdcp {
 	/* Flag indicate if it is a first ReceiverID_List msg after AKE_Init */
 	bool first_recvid_msg;
 
+	/* Flag indicate whether reauth retries req */
+	bool reauth_req;
+
 	/*
 	 * Content Stream Type defined by content owner. TYPE0(0x0) content can
 	 * flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1)
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 3e24a6df503a..ed523de20eac 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -1507,13 +1507,35 @@  int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)
 
 static int hdcp2_authenticate_repeater(struct intel_connector *connector)
 {
-	int ret;
+	int ret, i, tries = 3;
+	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 
 	ret = hdcp2_authenticate_repeater_topology(connector);
 	if (ret < 0)
 		return ret;
 
-	return hdcp2_propagate_stream_management_info(connector);
+	/*
+	 * HDCP 2.2 HDCP Spec Stream Managemnt pass/fail transition
+	 * to HDCP authticate state i.e. A9->A5.
+	 * if it fails, retry for stream managemnt again and skip the reauth.
+	 */
+	for (i = 0; i < tries; i++) {
+		ret = hdcp2_propagate_stream_management_info(connector);
+		if (!ret) {
+			hdcp->reauth_req  = true;
+			break;
+		}
+
+		hdcp->seq_num_m++;
+		drm_dbg_kms(&dev_priv->drm, "HDCP2.2 stream management %d of %d Failed.(%d)\n",
+			    i + 1, tries, ret);
+	}
+
+	if (ret)
+		hdcp->reauth_req  = false;
+
+	return ret;
 }
 
 static int hdcp2_authenticate_sink(struct intel_connector *connector)
@@ -1642,10 +1664,11 @@  static int hdcp2_disable_encryption(struct intel_connector *connector)
 static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
 {
 	int ret, i, tries = 3;
+	struct intel_hdcp *hdcp = &connector->hdcp;
 
 	for (i = 0; i < tries; i++) {
 		ret = hdcp2_authenticate_sink(connector);
-		if (!ret)
+		if (!ret || !hdcp->reauth_req)
 			break;
 
 		/* Clearing the mei hdcp session */
@@ -1655,7 +1678,7 @@  static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
 			DRM_DEBUG_KMS("Port deauth failed.\n");
 	}
 
-	if (i != tries) {
+	if (!ret) {
 		/*
 		 * Ensuring the required 200mSec min time interval between
 		 * Session Key Exchange and encryption.
@@ -1681,6 +1704,7 @@  static int _intel_hdcp2_enable(struct intel_connector *connector)
 		      connector->base.name, connector->base.base.id,
 		      hdcp->content_type);
 
+	hdcp->reauth_req  = true;
 	ret = hdcp2_authenticate_and_encrypt(connector);
 	if (ret) {
 		DRM_DEBUG_KMS("HDCP2 Type%d  Enabling Failed. (%d)\n",