Re: [PATCH 7/8] drm/i915: Reauthenticate HDCP on failure

Sean Paul
2018-02-02T14:37:16Z

On Fri, Feb 02, 2018 at 04:15:19PM +0530, Ramalingam C wrote:
> When HDCP authentication fails, we add two more reauthentication.
> This will address all reauth expectation from compliance perspective.
>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
> drivers/gpu/drm/i915/intel_hdcp.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index a3463557f0f6..3caa548a9cad 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -566,7 +566,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
> static int _intel_hdcp_enable(struct intel_connector *connector)
> {
> struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
> - int i, ret;
> + int i, ret, reauth = 1;
>
> if (!(I915_READ(SKL_FUSE_STATUS) & SKL_FUSE_PG_DIST_STATUS(1))) {
> DRM_ERROR("PG1 is disabled, cannot load keys\n");
> @@ -584,13 +584,17 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
> return ret;
> }
>
> - ret = intel_hdcp_auth(connector);
> - if (ret) {
> - DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
> - return ret;
> - }
> + do {
> + ret = intel_hdcp_auth(connector);
> + if (ret)
> + DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
> + if (ret && reauth)
> + DRM_DEBUG_KMS("[%s:%d] HDCP Reauth... %d/1\n",
> + connector->base.name,
> + connector->base.base.id, reauth);
> + } while (ret && reauth--);
>
> - return 0;
> + return ret;

I think we can do something a little more straightforward, like:

int i, ret, tries = 2;

for (i = 0; i < tries; i++) {
ret = intel_hdcp_auth(...);
if (!ret)
return 0;

DRM_DEBUG_KMS("[%s:%d] HDCP Auth failure (%d)\n",
connector->base.name, connector->base.base.id,
ret);
}

DRM_ERROR("[%s:%d] HDCP authentication failed (%d tries/%d)\n",
connector->base.name, connector->base.base.id, tries, ret);
_intel_hdcp_disable(...);
return ret;

> }
>
> static void intel_hdcp_check_work(struct work_struct *work)
> --
> 2.7.4
>

--
Sean Paul, Software Engineer, Google / Chromium OS