All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: seanpaul@chromium.org, intel-gfx@lists.freedesktop.org
Subject: [PATCH v5] drm/i915: Retry HDCP bksv read
Date: Mon,  5 Feb 2018 23:02:02 +0530	[thread overview]
Message-ID: <1517851922-30547-1-git-send-email-ramalingam.c@intel.com> (raw)
In-Reply-To: <1517850881-31333-1-git-send-email-ramalingam.c@intel.com>

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]

v4:
  retry only if bksv is invalid and no error msg on each attempt
  [Seanpaul]

v5:
  Correcting the return value [Seanpaul].

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index cfd13ee8c534..d7ddd6b28cd7 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,19 @@ 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);
-	if (ret)
-		return ret;
-	else if (!intel_hdcp_is_ksv_valid(bksv.shim))
+
+	/* HDCP spec states that we must retry the bksv if it is invalid */
+	for (i = 0; i < 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 == tries) {
+		DRM_ERROR("HDCP failed, Bksv is invalid\n");
 		return -ENODEV;
+	}
 
 	I915_WRITE(PORT_HDCP_BKSVLO(port), bksv.reg[0]);
 	I915_WRITE(PORT_HDCP_BKSVHI(port), bksv.reg[1]);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-02-05 17:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 22:09 [PATCH v3 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
2018-02-02 22:09 ` [PATCH v3 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
2018-02-02 22:09 ` [PATCH v3 2/8] drm/i915: Stop encryption for repeater with no sink Ramalingam C
2018-02-02 22:09 ` [PATCH v3 3/8] drm/i915: Connector info in HDCP debug msgs Ramalingam C
2018-02-02 22:09 ` [PATCH v3 4/8] drm/i915: Retry HDCP bksv read Ramalingam C
2018-02-05 16:47   ` Sean Paul
2018-02-05 17:14   ` [PATCH v4] " Ramalingam C
2018-02-05 17:24     ` Sean Paul
2018-02-05 17:24       ` Ramalingam C
2018-02-05 17:32     ` Ramalingam C [this message]
2018-02-02 22:09 ` [PATCH v3 5/8] drm/i915: Optimize HDCP key load Ramalingam C
2018-02-02 22:09 ` [PATCH v3 6/8] drm/i915: Detect panel's hdcp capability Ramalingam C
2018-02-02 22:09 ` [PATCH v3 7/8] drm/i915: Reauthenticate HDCP on failure Ramalingam C
2018-02-02 22:09 ` [PATCH v3 8/8] drm/i915: fix misalignment in HDCP register def Ramalingam C
2018-02-03  5:37 ` ✓ Fi.CI.BAT: success for Adhering to HDCP1.4 Compliance Test Spec (rev3) Patchwork
2018-02-03  8:46 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-02-05 16:50 ` [PATCH v3 0/8] Adhering to HDCP1.4 Compliance Test Spec Sean Paul
2018-02-05 17:13   ` C, Ramalingam
2018-02-05 18:39 ` Sean Paul
2018-02-05 19:00 ` ✓ Fi.CI.BAT: success for Adhering to HDCP1.4 Compliance Test Spec (rev5) Patchwork
2018-02-05 21:51 ` ✗ Fi.CI.IGT: warning " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517851922-30547-1-git-send-email-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.