Re: [PATCH v3 4/8] drm/i915: Retry HDCP bksv read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 03, 2018 at 03:39:06AM +0530, Ramalingam C wrote:
> HDCP specification says that when bksv is identified as invalid
> (not with 20 1s), bksv should be re-read and verified.
> 
> This patch adds the above mentioned re-read for bksv.
> 
> v2:
>   Rephrased the commit msg [Seanpaul]
> 
> v3:
>   do-while to for-loop [Seanpaul]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index cfd13ee8c534..b1047dbf3393 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -397,7 +397,7 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
>  	struct drm_i915_private *dev_priv;
>  	enum port port;
>  	unsigned long r0_prime_gen_start;
> -	int ret, i;
> +	int ret, i, tries = 2;
>  	union {
>  		u32 reg[2];
>  		u8 shim[DRM_HDCP_AN_LEN];
> @@ -438,11 +438,22 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
>  	r0_prime_gen_start = jiffies;
>  
>  	memset(&bksv, 0, sizeof(bksv));
> -	ret = shim->read_bksv(intel_dig_port, bksv.shim);
> +
> +	/* When bksv is invalid, HDCP spec expects a re-read for bksv */
> +	for (i = 0; i < tries; i++) {
> +		ret = shim->read_bksv(intel_dig_port, bksv.shim);
> +		if (!ret) {
> +			if (intel_hdcp_is_ksv_valid(bksv.shim)) {
> +				break;
> +			} else {
> +				DRM_ERROR("Invalid BKSV\n");
> +				ret = -ENODEV;
> +			}
> +		}
> +	}

Hmm, this is different from what I proposed in a couple of ways:
- This will print an ERROR for each failed attempt, which I don't think is
  needed
- If shim->read_bksv fails, we shouldn't need to retry. The retry here should
  only catch invalid ksv. The shim implementation is responsible for retrying if
  the link is prone to failure.


For a refresher, this is what I proposed in the first review (I added an error):

	/* HDCP spec states that we must retry the bksv if it is invalid */
        for (i = 0; i < bksv_tries; i++) {
                ret = shim->read_bksv(intel_dig_port, bksv.shim);
                if (ret)
                        return ret;
                if (intel_hdcp_is_ksv_valid(bksv.shim))
                        break;
        }
        if (i == bksv_tries) {
		DRM_ERROR("HDCP failed, Bksv is invalid\n");
                return -ENODEV;
	}
  

> +
>  	if (ret)
>  		return ret;
> -	else if (!intel_hdcp_is_ksv_valid(bksv.shim))
> -		return -ENODEV;
>  
>  	I915_WRITE(PORT_HDCP_BKSVLO(port), bksv.reg[0]);
>  	I915_WRITE(PORT_HDCP_BKSVHI(port), bksv.reg[1]);
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux