All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec
@ 2018-02-02 20:11 Ramalingam C
  2018-02-02 20:11 ` [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

This series is developed to address the expectations from HDCP compliance
test specification.

6/8 patches are for fixing failures in one or more compliance test cases
2 patches are Good to have kind. Not related to compliance.

Thanks to Seanpaul for immediate review comments on v1.

Ramalingam C (8):
  drm/i915: Handle failure from 2nd stage HDCP auth
  drm/i915: Stop encryption for repeater with no sink
  drm/i915: Connector info in HDCP debug msgs
  drm/i915: Retry HDCP bksv read
  drm/i915: Optimize HDCP key load
  drm/i915: Detect panel's hdcp capability
  drm/i915: Reauthenticate HDCP on failure
  drm/i915: fix misalignment in HDCP register def

 drivers/gpu/drm/i915/i915_reg.h   | 58 +++++++++++++-------------
 drivers/gpu/drm/i915/intel_dp.c   | 39 ++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h  |  4 ++
 drivers/gpu/drm/i915/intel_hdcp.c | 87 ++++++++++++++++++++++++++++++---------
 drivers/gpu/drm/i915/intel_hdmi.c |  1 +
 5 files changed, 137 insertions(+), 52 deletions(-)

-- 
2.7.4

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:52   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink Ramalingam C
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

We enable the HDCP encryption as a part of first stage authentication.
So when second stage authentication fails, we need to disable the HDCP
encryption and signalling.

This patch ensures that, when hdcp authentication fails, HDCP encryption
and signalling is turned off.

v2:
  Dropped connector ref passing to auth [Seanpaul]
  Moved the call to disable_hdcp() to enable_hdcp() [Seanpaul]

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index b97184eccd9c..de9a925c122d 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -562,6 +562,9 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 			      connector->hdcp_shim);
 	if (ret) {
 		DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
+
+		/* Ensuring HDCP encryption and signalling are stopped. */
+		_intel_hdcp_disable(connector);
 		return ret;
 	}
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
  2018-02-02 20:11 ` [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:52   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs Ramalingam C
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

If a HDCP repeater is detected with zero downstream devices,
HDCP spec approves either of below actions:

1. Dont continue on second stage authentication. Disable encryption.
2. Continue with second stage authentication excluding the KSV list and
   on success, continue encryption.

Since disable encryption is agreed, repeater is not expected to have its
own display. So there is no consumption of the display content in such
setup.

Hence, incase of repeater with zero device count, this patch fails the
HDCP authentication and stops the HDCP encryption.

v2:
  Rephrased commit msg and added comments in code [Seanpaul]

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index de9a925c122d..0a1ef82c77a2 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -166,10 +166,16 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port,
 		return -EPERM;
 	}
 
-	/* If there are no downstream devices, we're all done. */
+	/*
+	 * When repeater reports 0 device count, HDCP1.4 spec allows disabling
+	 * the HDCP encryption. That implies that repeater can't have its own
+	 * display. As there is no consumption of encrypted content in the
+	 * repeater with 0 downstream devices, we are failing the
+	 * authentication.
+	 */
 	num_downstream = DRM_HDCP_NUM_DOWNSTREAM(bstatus[0]);
 	if (num_downstream == 0)
-		return 0;
+		return -EINVAL;
 
 	ksv_fifo = kzalloc(num_downstream * DRM_HDCP_KSV_LEN, GFP_KERNEL);
 	if (!ksv_fifo)
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
  2018-02-02 20:11 ` [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
  2018-02-02 20:11 ` [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:52   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 4/8] drm/i915: Retry HDCP bksv read Ramalingam C
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

When HDCP authentication is triggered on multiple connector, having
connector name and ID in debug message will be more informative.

v2:
  Added logs with connector info at the start of en/disable [Seanpaul]
  Added the connector info into Check link failure msgs too.

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 0a1ef82c77a2..cfd13ee8c534 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -524,6 +524,9 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
 	enum port port = intel_dig_port->base.port;
 	int ret;
 
+	DRM_DEBUG_KMS("[%s:%d] HDCP is being disabled...\n",
+		      connector->base.name, connector->base.base.id);
+
 	I915_WRITE(PORT_HDCP_CONF(port), 0);
 	if (intel_wait_for_register(dev_priv, PORT_HDCP_STATUS(port), ~0, 0,
 				    20)) {
@@ -548,6 +551,9 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
 	int i, ret;
 
+	DRM_DEBUG_KMS("[%s:%d] HDCP is being enabled...\n",
+		      connector->base.name, connector->base.base.id);
+
 	if (!(I915_READ(SKL_FUSE_STATUS) & SKL_FUSE_PG_DIST_STATUS(1))) {
 		DRM_ERROR("PG1 is disabled, cannot load keys\n");
 		return -ENXIO;
@@ -727,8 +733,9 @@ int intel_hdcp_check_link(struct intel_connector *connector)
 		goto out;
 
 	if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) {
-		DRM_ERROR("HDCP check failed: link is not encrypted, %x\n",
-			   I915_READ(PORT_HDCP_STATUS(port)));
+		DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n",
+			  connector->base.name, connector->base.base.id,
+			  I915_READ(PORT_HDCP_STATUS(port)));
 		ret = -ENXIO;
 		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
 		schedule_work(&connector->hdcp_prop_work);
@@ -745,7 +752,8 @@ int intel_hdcp_check_link(struct intel_connector *connector)
 		goto out;
 	}
 
-	DRM_DEBUG_KMS("HDCP link failed, retrying authentication\n");
+	DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n",
+		      connector->base.name, connector->base.base.id);
 
 	ret = _intel_hdcp_disable(connector);
 	if (ret) {
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/8] drm/i915: Retry HDCP bksv read
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (2 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:44   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 5/8] drm/i915: Optimize HDCP key load Ramalingam C
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

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]

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index cfd13ee8c534..40d0c5e73cc6 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, retry = 1;
 	union {
 		u32 reg[2];
 		u8 shim[DRM_HDCP_AN_LEN];
@@ -438,11 +438,16 @@ 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);
+
+	do {
+		ret = shim->read_bksv(intel_dig_port, bksv.shim);
+		if (!ret)
+			if (!intel_hdcp_is_ksv_valid(bksv.shim))
+				ret = -ENODEV;
+	} while (ret && retry--);
+
 	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

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 5/8] drm/i915: Optimize HDCP key load
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (3 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 4/8] drm/i915: Retry HDCP bksv read Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:11 ` [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability Ramalingam C
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

HDCP key need not be cleared on each hdcp disable. And HDCP key Load
is skipped if key is already loaded.

v2:
  No change. Added Reviewed-by tag.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 40d0c5e73cc6..0cee79c86d7e 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -49,6 +49,10 @@ static int intel_hdcp_load_keys(struct drm_i915_private *dev_priv)
 	int ret;
 	u32 val;
 
+	val = I915_READ(HDCP_KEY_STATUS);
+	if ((val & HDCP_KEY_LOAD_DONE) && (val & HDCP_KEY_LOAD_STATUS))
+		return 0;
+
 	/*
 	 * On HSW and BDW HW loads the HDCP1.4 Key when Display comes
 	 * out of reset. So if Key is not already loaded, its an error state.
@@ -539,8 +543,6 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
 		return -ETIMEDOUT;
 	}
 
-	intel_hdcp_clear_keys(dev_priv);
-
 	ret = connector->hdcp_shim->toggle_signalling(intel_dig_port, false);
 	if (ret) {
 		DRM_ERROR("Failed to disable HDCP signalling\n");
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (4 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 5/8] drm/i915: Optimize HDCP key load Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:46   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure Ramalingam C
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

DP HDCP1.4 spec mandates that An can be written to panel only after
detecting the panel's hdcp capability.

For DP 0th Bit of Bcaps register indicates the panel's hdcp capability
For HDMI valid BKSV indicates the panel's hdcp capability.

For HDMI it is optional to detect the panel's hdcp capability before
An Write.

v2:
  Added comments explaining the need for action [Seanpaul].
  Made panel's hdcp capability detection optional for hdmi [Seanpaul].
  Defined a func for reading bcaps for DP [Seanpaul].

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c   | 39 +++++++++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_hdcp.c | 18 +++++++++++++++++-
 drivers/gpu/drm/i915/intel_hdmi.c |  1 +
 4 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 03d86ff9b805..5fa6bb7dbb7a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5107,17 +5107,32 @@ static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port,
 }
 
 static
-int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port,
-				   bool *repeater_present)
+int intel_dp_hdcp_read_bcaps(struct intel_digital_port *intel_dig_port,
+			     u8 *bcaps)
 {
 	ssize_t ret;
-	u8 bcaps;
+
 	ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, DP_AUX_HDCP_BCAPS,
-			       &bcaps, 1);
+			       bcaps, 1);
 	if (ret != 1) {
 		DRM_ERROR("Read bcaps from DP/AUX failed (%zd)\n", ret);
 		return ret >= 0 ? -EIO : ret;
 	}
+
+	return 0;
+}
+
+static
+int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port,
+				   bool *repeater_present)
+{
+	ssize_t ret;
+	u8 bcaps;
+
+	ret = intel_dp_hdcp_read_bcaps(intel_dig_port, &bcaps);
+	if (ret)
+		return ret;
+
 	*repeater_present = bcaps & DP_BCAPS_REPEATER_PRESENT;
 	return 0;
 }
@@ -5218,6 +5233,21 @@ bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port)
 	return !(bstatus & (DP_BSTATUS_LINK_FAILURE | DP_BSTATUS_REAUTH_REQ));
 }
 
+static
+int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,
+			  bool *hdcp_capable)
+{
+	ssize_t ret;
+	u8 bcaps;
+
+	ret = intel_dp_hdcp_read_bcaps(intel_dig_port, &bcaps);
+	if (ret)
+		return ret;
+
+	*hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE;
+	return 0;
+}
+
 static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
 	.write_an_aksv = intel_dp_hdcp_write_an_aksv,
 	.read_bksv = intel_dp_hdcp_read_bksv,
@@ -5229,6 +5259,7 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
 	.read_v_prime_part = intel_dp_hdcp_read_v_prime_part,
 	.toggle_signalling = intel_dp_hdcp_toggle_signalling,
 	.check_link = intel_dp_hdcp_check_link,
+	.hdcp_capable = intel_dp_hdcp_capable,
 };
 
 static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d6a808374dfb..468ec1e90e16 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -369,6 +369,10 @@ struct intel_hdcp_shim {
 
 	/* Ensures the link is still protected */
 	bool (*check_link)(struct intel_digital_port *intel_dig_port);
+
+	/* Detects panel's hdcp capability. This is optional for HDMI. */
+	int (*hdcp_capable)(struct intel_digital_port *intel_dig_port,
+			    bool *hdcp_capable);
 };
 
 struct intel_connector {
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 0cee79c86d7e..4b2821feb4b4 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -414,12 +414,28 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
 		u32 reg;
 		u8 shim[DRM_HDCP_RI_LEN];
 	} ri;
-	bool repeater_present;
+	bool repeater_present, hdcp_capable;
 
 	dev_priv = intel_dig_port->base.base.dev->dev_private;
 
 	port = intel_dig_port->base.port;
 
+	/*
+	 * Detects whether the display is HDCP capable. Although we check for
+	 * valid Bksv below, the HDCP over DP spec requires that we check
+	 * whether the display supports HDCP before we write An. For HDMI
+	 * displays, this is not necessary.
+	 */
+	if (shim->hdcp_capable) {
+		ret = shim->hdcp_capable(intel_dig_port, &hdcp_capable);
+		if (ret)
+			return ret;
+		if (!hdcp_capable) {
+			DRM_ERROR("Panel is not HDCP capable\n");
+			return -EINVAL;
+		}
+	}
+
 	/* Initialize An with 2 random values and acquire it */
 	for (i = 0; i < 2; i++)
 		I915_WRITE(PORT_HDCP_ANINIT(port), get_random_u32());
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f5d7bfb43006..1a05a4bf442e 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1117,6 +1117,7 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = {
 	.read_v_prime_part = intel_hdmi_hdcp_read_v_prime_part,
 	.toggle_signalling = intel_hdmi_hdcp_toggle_signalling,
 	.check_link = intel_hdmi_hdcp_check_link,
+	.hdcp_capable = NULL,
 };
 
 static void intel_hdmi_prepare(struct intel_encoder *encoder,
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (5 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 20:51   ` Sean Paul
  2018-02-02 20:11 ` [PATCH v2 8/8] drm/i915: fix misalignment in HDCP register def Ramalingam C
  2018-02-02 21:20 ` ✗ Fi.CI.BAT: warning for Adhering to HDCP1.4 Compliance Test Spec (rev2) Patchwork
  8 siblings, 1 reply; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

Incase of HDCP authentication failure, HDCP spec expects
reauthentication. Hence this patch adds the reauthentications
to be compliance with spec.

v2:
  do-while to for loop for simplicity. [Seanpaul].

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

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 4b2821feb4b4..4a3db5de229e 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -572,7 +572,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, tries = 3;
 
 	DRM_DEBUG_KMS("[%s:%d] HDCP is being enabled...\n",
 		      connector->base.name, connector->base.base.id);
@@ -593,17 +593,26 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
 		return ret;
 	}
 
-	ret = intel_hdcp_auth(conn_to_dig_port(connector),
-			      connector->hdcp_shim);
-	if (ret) {
-		DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
+	/* Incase of authentication failures, HDCP spec expects reauth. */
+	for (i = 0; i < tries; i++) {
+		if (i)
+			DRM_DEBUG_KMS("[%s:%d] HDCP Reauth...\n",
+				      connector->base.name,
+				      connector->base.base.id);
+
+		ret = intel_hdcp_auth(conn_to_dig_port(connector),
+				      connector->hdcp_shim);
+		if (!ret)
+			return 0;
+
+		DRM_ERROR("[%s:%d] Failed to authenticate HDCP (%d)\n",
+			  connector->base.name, connector->base.base.id, ret);
 
 		/* Ensuring HDCP encryption and signalling are stopped. */
 		_intel_hdcp_disable(connector);
-		return ret;
 	}
 
-	return 0;
+	return ret;
 }
 
 static void intel_hdcp_check_work(struct work_struct *work)
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 8/8] drm/i915: fix misalignment in HDCP register def
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (6 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure Ramalingam C
@ 2018-02-02 20:11 ` Ramalingam C
  2018-02-02 21:20 ` ✗ Fi.CI.BAT: warning for Adhering to HDCP1.4 Compliance Test Spec (rev2) Patchwork
  8 siblings, 0 replies; 16+ messages in thread
From: Ramalingam C @ 2018-02-02 20:11 UTC (permalink / raw)
  To: intel-gfx, seanpaul; +Cc: daniel.vetter, rodrigo.vivi

This patch aligns all definitions of hdcp registers and their bits.

v2:
  No changes. Added reviewed-by tag.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/i915/i915_reg.h | 58 ++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 65ba10ad1fe5..e9c79b560823 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -8483,34 +8483,34 @@ enum skl_power_gate {
 #define   CNL_AUX_ANAOVRD1_LDO_BYPASS	(1<<23)
 
 /* HDCP Key Registers */
-#define HDCP_KEY_CONF		_MMIO(0x66c00)
+#define HDCP_KEY_CONF			_MMIO(0x66c00)
 #define  HDCP_AKSV_SEND_TRIGGER		BIT(31)
 #define  HDCP_CLEAR_KEYS_TRIGGER	BIT(30)
 #define  HDCP_KEY_LOAD_TRIGGER		BIT(8)
-#define HDCP_KEY_STATUS		_MMIO(0x66c04)
-#define  HDCP_FUSE_IN_PROGRESS	BIT(7)
+#define HDCP_KEY_STATUS			_MMIO(0x66c04)
+#define  HDCP_FUSE_IN_PROGRESS		BIT(7)
 #define  HDCP_FUSE_ERROR		BIT(6)
-#define  HDCP_FUSE_DONE		BIT(5)
-#define  HDCP_KEY_LOAD_STATUS	BIT(1)
+#define  HDCP_FUSE_DONE			BIT(5)
+#define  HDCP_KEY_LOAD_STATUS		BIT(1)
 #define  HDCP_KEY_LOAD_DONE		BIT(0)
-#define HDCP_AKSV_LO		_MMIO(0x66c10)
-#define HDCP_AKSV_HI		_MMIO(0x66c14)
+#define HDCP_AKSV_LO			_MMIO(0x66c10)
+#define HDCP_AKSV_HI			_MMIO(0x66c14)
 
 /* HDCP Repeater Registers */
-#define HDCP_REP_CTL		_MMIO(0x66d00)
-#define  HDCP_DDIB_REP_PRESENT	BIT(30)
-#define  HDCP_DDIA_REP_PRESENT	BIT(29)
-#define  HDCP_DDIC_REP_PRESENT	BIT(28)
-#define  HDCP_DDID_REP_PRESENT	BIT(27)
-#define  HDCP_DDIF_REP_PRESENT	BIT(26)
-#define  HDCP_DDIE_REP_PRESENT	BIT(25)
+#define HDCP_REP_CTL			_MMIO(0x66d00)
+#define  HDCP_DDIB_REP_PRESENT		BIT(30)
+#define  HDCP_DDIA_REP_PRESENT		BIT(29)
+#define  HDCP_DDIC_REP_PRESENT		BIT(28)
+#define  HDCP_DDID_REP_PRESENT		BIT(27)
+#define  HDCP_DDIF_REP_PRESENT		BIT(26)
+#define  HDCP_DDIE_REP_PRESENT		BIT(25)
 #define  HDCP_DDIB_SHA1_M0		(1 << 20)
 #define  HDCP_DDIA_SHA1_M0		(2 << 20)
 #define  HDCP_DDIC_SHA1_M0		(3 << 20)
 #define  HDCP_DDID_SHA1_M0		(4 << 20)
 #define  HDCP_DDIF_SHA1_M0		(5 << 20)
 #define  HDCP_DDIE_SHA1_M0		(6 << 20) /* Bspec says 5? */
-#define  HDCP_SHA1_BUSY		BIT(16)
+#define  HDCP_SHA1_BUSY			BIT(16)
 #define  HDCP_SHA1_READY		BIT(17)
 #define  HDCP_SHA1_COMPLETE		BIT(18)
 #define  HDCP_SHA1_V_MATCH		BIT(19)
@@ -8526,7 +8526,7 @@ enum skl_power_gate {
 #define HDCP_SHA_V_PRIME_H3		_MMIO(0x66d10)
 #define HDCP_SHA_V_PRIME_H4		_MMIO(0x66d14)
 #define HDCP_SHA_V_PRIME(h)		_MMIO((0x66d04 + h * 4))
-#define HDCP_SHA_TEXT		_MMIO(0x66d18)
+#define HDCP_SHA_TEXT			_MMIO(0x66d18)
 
 /* HDCP Auth Registers */
 #define _PORTA_HDCP_AUTHENC		0x66800
@@ -8542,25 +8542,25 @@ enum skl_power_gate {
 					  _PORTD_HDCP_AUTHENC, \
 					  _PORTE_HDCP_AUTHENC, \
 					  _PORTF_HDCP_AUTHENC) + x)
-#define PORT_HDCP_CONF(port)	_PORT_HDCP_AUTHENC(port, 0x0)
-#define  HDCP_CONF_CAPTURE_AN	BIT(0)
-#define  HDCP_CONF_AUTH_AND_ENC	(BIT(1) | BIT(0))
-#define PORT_HDCP_ANINIT(port)	_PORT_HDCP_AUTHENC(port, 0x4)
-#define PORT_HDCP_ANLO(port)	_PORT_HDCP_AUTHENC(port, 0x8)
-#define PORT_HDCP_ANHI(port)	_PORT_HDCP_AUTHENC(port, 0xC)
-#define PORT_HDCP_BKSVLO(port)	_PORT_HDCP_AUTHENC(port, 0x10)
-#define PORT_HDCP_BKSVHI(port)	_PORT_HDCP_AUTHENC(port, 0x14)
-#define PORT_HDCP_RPRIME(port)	_PORT_HDCP_AUTHENC(port, 0x18)
-#define PORT_HDCP_STATUS(port)	_PORT_HDCP_AUTHENC(port, 0x1C)
+#define PORT_HDCP_CONF(port)		_PORT_HDCP_AUTHENC(port, 0x0)
+#define  HDCP_CONF_CAPTURE_AN		BIT(0)
+#define  HDCP_CONF_AUTH_AND_ENC		(BIT(1) | BIT(0))
+#define PORT_HDCP_ANINIT(port)		_PORT_HDCP_AUTHENC(port, 0x4)
+#define PORT_HDCP_ANLO(port)		_PORT_HDCP_AUTHENC(port, 0x8)
+#define PORT_HDCP_ANHI(port)		_PORT_HDCP_AUTHENC(port, 0xC)
+#define PORT_HDCP_BKSVLO(port)		_PORT_HDCP_AUTHENC(port, 0x10)
+#define PORT_HDCP_BKSVHI(port)		_PORT_HDCP_AUTHENC(port, 0x14)
+#define PORT_HDCP_RPRIME(port)		_PORT_HDCP_AUTHENC(port, 0x18)
+#define PORT_HDCP_STATUS(port)		_PORT_HDCP_AUTHENC(port, 0x1C)
 #define  HDCP_STATUS_STREAM_A_ENC	BIT(31)
 #define  HDCP_STATUS_STREAM_B_ENC	BIT(30)
 #define  HDCP_STATUS_STREAM_C_ENC	BIT(29)
 #define  HDCP_STATUS_STREAM_D_ENC	BIT(28)
 #define  HDCP_STATUS_AUTH		BIT(21)
 #define  HDCP_STATUS_ENC		BIT(20)
-#define  HDCP_STATUS_RI_MATCH	BIT(19)
-#define  HDCP_STATUS_R0_READY	BIT(18)
-#define  HDCP_STATUS_AN_READY	BIT(17)
+#define  HDCP_STATUS_RI_MATCH		BIT(19)
+#define  HDCP_STATUS_R0_READY		BIT(18)
+#define  HDCP_STATUS_AN_READY		BIT(17)
 #define  HDCP_STATUS_CIPHER		BIT(16)
 #define  HDCP_STATUS_FRAME_CNT(x)	((x >> 8) & 0xff)
 
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/8] drm/i915: Retry HDCP bksv read
  2018-02-02 20:11 ` [PATCH v2 4/8] drm/i915: Retry HDCP bksv read Ramalingam C
@ 2018-02-02 20:44   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:44 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:32AM +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]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index cfd13ee8c534..40d0c5e73cc6 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, retry = 1;
>  	union {
>  		u32 reg[2];
>  		u8 shim[DRM_HDCP_AN_LEN];
> @@ -438,11 +438,16 @@ 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);
> +
> +	do {
> +		ret = shim->read_bksv(intel_dig_port, bksv.shim);
> +		if (!ret)
> +			if (!intel_hdcp_is_ksv_valid(bksv.shim))
> +				ret = -ENODEV;
> +	} while (ret && retry--);

I think you missed the second part of my review. I'd really like to clean this
part up as well to make it a bit more straightforward.

Sean

> +
>  	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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability
  2018-02-02 20:11 ` [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability Ramalingam C
@ 2018-02-02 20:46   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:46 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:34AM +0530, Ramalingam C wrote:
> DP HDCP1.4 spec mandates that An can be written to panel only after
> detecting the panel's hdcp capability.
> 
> For DP 0th Bit of Bcaps register indicates the panel's hdcp capability
> For HDMI valid BKSV indicates the panel's hdcp capability.
> 
> For HDMI it is optional to detect the panel's hdcp capability before
> An Write.
> 
> v2:
>   Added comments explaining the need for action [Seanpaul].
>   Made panel's hdcp capability detection optional for hdmi [Seanpaul].
>   Defined a func for reading bcaps for DP [Seanpaul].
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c   | 39 +++++++++++++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
>  drivers/gpu/drm/i915/intel_hdcp.c | 18 +++++++++++++++++-
>  drivers/gpu/drm/i915/intel_hdmi.c |  1 +
>  4 files changed, 57 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 03d86ff9b805..5fa6bb7dbb7a 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5107,17 +5107,32 @@ static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port,
>  }
>  
>  static
> -int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port,
> -				   bool *repeater_present)
> +int intel_dp_hdcp_read_bcaps(struct intel_digital_port *intel_dig_port,
> +			     u8 *bcaps)
>  {
>  	ssize_t ret;
> -	u8 bcaps;
> +
>  	ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, DP_AUX_HDCP_BCAPS,
> -			       &bcaps, 1);
> +			       bcaps, 1);
>  	if (ret != 1) {
>  		DRM_ERROR("Read bcaps from DP/AUX failed (%zd)\n", ret);
>  		return ret >= 0 ? -EIO : ret;
>  	}
> +
> +	return 0;
> +}
> +
> +static
> +int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port,
> +				   bool *repeater_present)
> +{
> +	ssize_t ret;
> +	u8 bcaps;
> +
> +	ret = intel_dp_hdcp_read_bcaps(intel_dig_port, &bcaps);
> +	if (ret)
> +		return ret;
> +
>  	*repeater_present = bcaps & DP_BCAPS_REPEATER_PRESENT;
>  	return 0;
>  }
> @@ -5218,6 +5233,21 @@ bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port)
>  	return !(bstatus & (DP_BSTATUS_LINK_FAILURE | DP_BSTATUS_REAUTH_REQ));
>  }
>  
> +static
> +int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port,
> +			  bool *hdcp_capable)
> +{
> +	ssize_t ret;
> +	u8 bcaps;
> +
> +	ret = intel_dp_hdcp_read_bcaps(intel_dig_port, &bcaps);
> +	if (ret)
> +		return ret;
> +
> +	*hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE;
> +	return 0;
> +}
> +
>  static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
>  	.write_an_aksv = intel_dp_hdcp_write_an_aksv,
>  	.read_bksv = intel_dp_hdcp_read_bksv,
> @@ -5229,6 +5259,7 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
>  	.read_v_prime_part = intel_dp_hdcp_read_v_prime_part,
>  	.toggle_signalling = intel_dp_hdcp_toggle_signalling,
>  	.check_link = intel_dp_hdcp_check_link,
> +	.hdcp_capable = intel_dp_hdcp_capable,
>  };
>  
>  static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index d6a808374dfb..468ec1e90e16 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -369,6 +369,10 @@ struct intel_hdcp_shim {
>  
>  	/* Ensures the link is still protected */
>  	bool (*check_link)(struct intel_digital_port *intel_dig_port);
> +
> +	/* Detects panel's hdcp capability. This is optional for HDMI. */
> +	int (*hdcp_capable)(struct intel_digital_port *intel_dig_port,
> +			    bool *hdcp_capable);
>  };
>  
>  struct intel_connector {
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 0cee79c86d7e..4b2821feb4b4 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -414,12 +414,28 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
>  		u32 reg;
>  		u8 shim[DRM_HDCP_RI_LEN];
>  	} ri;
> -	bool repeater_present;
> +	bool repeater_present, hdcp_capable;
>  
>  	dev_priv = intel_dig_port->base.base.dev->dev_private;
>  
>  	port = intel_dig_port->base.port;
>  
> +	/*
> +	 * Detects whether the display is HDCP capable. Although we check for
> +	 * valid Bksv below, the HDCP over DP spec requires that we check
> +	 * whether the display supports HDCP before we write An. For HDMI
> +	 * displays, this is not necessary.
> +	 */
> +	if (shim->hdcp_capable) {
> +		ret = shim->hdcp_capable(intel_dig_port, &hdcp_capable);
> +		if (ret)
> +			return ret;
> +		if (!hdcp_capable) {
> +			DRM_ERROR("Panel is not HDCP capable\n");
> +			return -EINVAL;
> +		}
> +	}
> +
>  	/* Initialize An with 2 random values and acquire it */
>  	for (i = 0; i < 2; i++)
>  		I915_WRITE(PORT_HDCP_ANINIT(port), get_random_u32());
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index f5d7bfb43006..1a05a4bf442e 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1117,6 +1117,7 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = {
>  	.read_v_prime_part = intel_hdmi_hdcp_read_v_prime_part,
>  	.toggle_signalling = intel_hdmi_hdcp_toggle_signalling,
>  	.check_link = intel_hdmi_hdcp_check_link,
> +	.hdcp_capable = NULL,

nit: This isn't needed, it will already be initialized to NULL.

With that fixed:

Reviewed-by: Sean Paul <seanpaul@chromium.org>

>  };
>  
>  static void intel_hdmi_prepare(struct intel_encoder *encoder,
> -- 
> 2.7.4
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure
  2018-02-02 20:11 ` [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure Ramalingam C
@ 2018-02-02 20:51   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:51 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:35AM +0530, Ramalingam C wrote:
> Incase of HDCP authentication failure, HDCP spec expects
> reauthentication. Hence this patch adds the reauthentications
> to be compliance with spec.
> 
> v2:
>   do-while to for loop for simplicity. [Seanpaul].
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 4b2821feb4b4..4a3db5de229e 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -572,7 +572,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, tries = 3;
>  
>  	DRM_DEBUG_KMS("[%s:%d] HDCP is being enabled...\n",
>  		      connector->base.name, connector->base.base.id);
> @@ -593,17 +593,26 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  		return ret;
>  	}
>  
> -	ret = intel_hdcp_auth(conn_to_dig_port(connector),
> -			      connector->hdcp_shim);
> -	if (ret) {
> -		DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
> +	/* Incase of authentication failures, HDCP spec expects reauth. */
> +	for (i = 0; i < tries; i++) {
> +		if (i)
> +			DRM_DEBUG_KMS("[%s:%d] HDCP Reauth...\n",
> +				      connector->base.name,
> +				      connector->base.base.id);
> +
> +		ret = intel_hdcp_auth(conn_to_dig_port(connector),
> +				      connector->hdcp_shim);
> +		if (!ret)
> +			return 0;
> +
> +		DRM_ERROR("[%s:%d] Failed to authenticate HDCP (%d)\n",
> +			  connector->base.name, connector->base.base.id, ret);

This wasn't quite what I had laid out. This code should be outside the loop
(it only runs if the number of tries is exceeded). Also, I intentionally did not
check i for the debug message since it's a debug message and we can assume it's
free. So that can go back below the if (!ret) return statement without the
conditional.

Further, let's try to be consistent with where we print the connector name/id.
Since you are now printing it at the start of the function, it's not needed in
any of these statements. I had also changed the wording of the retry message, so
it would be nice if you brought that forth (minus the connector info, ofc)

Sean

>  
>  		/* Ensuring HDCP encryption and signalling are stopped. */
>  		_intel_hdcp_disable(connector);
> -		return ret;
>  	}
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static void intel_hdcp_check_work(struct work_struct *work)
> -- 
> 2.7.4
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth
  2018-02-02 20:11 ` [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
@ 2018-02-02 20:52   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:52 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:29AM +0530, Ramalingam C wrote:
> We enable the HDCP encryption as a part of first stage authentication.
> So when second stage authentication fails, we need to disable the HDCP
> encryption and signalling.
> 
> This patch ensures that, when hdcp authentication fails, HDCP encryption
> and signalling is turned off.
> 
> v2:
>   Dropped connector ref passing to auth [Seanpaul]
>   Moved the call to disable_hdcp() to enable_hdcp() [Seanpaul]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index b97184eccd9c..de9a925c122d 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -562,6 +562,9 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  			      connector->hdcp_shim);
>  	if (ret) {
>  		DRM_ERROR("Failed to authenticate HDCP (%d)\n", ret);
> +
> +		/* Ensuring HDCP encryption and signalling are stopped. */
> +		_intel_hdcp_disable(connector);
>  		return ret;
>  	}
>  
> -- 
> 2.7.4
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink
  2018-02-02 20:11 ` [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink Ramalingam C
@ 2018-02-02 20:52   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:52 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:30AM +0530, Ramalingam C wrote:
> If a HDCP repeater is detected with zero downstream devices,
> HDCP spec approves either of below actions:
> 
> 1. Dont continue on second stage authentication. Disable encryption.
> 2. Continue with second stage authentication excluding the KSV list and
>    on success, continue encryption.
> 
> Since disable encryption is agreed, repeater is not expected to have its
> own display. So there is no consumption of the display content in such
> setup.
> 
> Hence, incase of repeater with zero device count, this patch fails the
> HDCP authentication and stops the HDCP encryption.
> 
> v2:
>   Rephrased commit msg and added comments in code [Seanpaul]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index de9a925c122d..0a1ef82c77a2 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -166,10 +166,16 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port,
>  		return -EPERM;
>  	}
>  
> -	/* If there are no downstream devices, we're all done. */
> +	/*
> +	 * When repeater reports 0 device count, HDCP1.4 spec allows disabling
> +	 * the HDCP encryption. That implies that repeater can't have its own
> +	 * display. As there is no consumption of encrypted content in the
> +	 * repeater with 0 downstream devices, we are failing the
> +	 * authentication.
> +	 */
>  	num_downstream = DRM_HDCP_NUM_DOWNSTREAM(bstatus[0]);
>  	if (num_downstream == 0)
> -		return 0;
> +		return -EINVAL;
>  
>  	ksv_fifo = kzalloc(num_downstream * DRM_HDCP_KSV_LEN, GFP_KERNEL);
>  	if (!ksv_fifo)
> -- 
> 2.7.4
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs
  2018-02-02 20:11 ` [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs Ramalingam C
@ 2018-02-02 20:52   ` Sean Paul
  0 siblings, 0 replies; 16+ messages in thread
From: Sean Paul @ 2018-02-02 20:52 UTC (permalink / raw)
  To: Ramalingam C; +Cc: daniel.vetter, intel-gfx, rodrigo.vivi

On Sat, Feb 03, 2018 at 01:41:31AM +0530, Ramalingam C wrote:
> When HDCP authentication is triggered on multiple connector, having
> connector name and ID in debug message will be more informative.
> 
> v2:
>   Added logs with connector info at the start of en/disable [Seanpaul]
>   Added the connector info into Check link failure msgs too.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 0a1ef82c77a2..cfd13ee8c534 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -524,6 +524,9 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>  	enum port port = intel_dig_port->base.port;
>  	int ret;
>  
> +	DRM_DEBUG_KMS("[%s:%d] HDCP is being disabled...\n",
> +		      connector->base.name, connector->base.base.id);
> +
>  	I915_WRITE(PORT_HDCP_CONF(port), 0);
>  	if (intel_wait_for_register(dev_priv, PORT_HDCP_STATUS(port), ~0, 0,
>  				    20)) {
> @@ -548,6 +551,9 @@ static int _intel_hdcp_enable(struct intel_connector *connector)
>  	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
>  	int i, ret;
>  
> +	DRM_DEBUG_KMS("[%s:%d] HDCP is being enabled...\n",
> +		      connector->base.name, connector->base.base.id);
> +
>  	if (!(I915_READ(SKL_FUSE_STATUS) & SKL_FUSE_PG_DIST_STATUS(1))) {
>  		DRM_ERROR("PG1 is disabled, cannot load keys\n");
>  		return -ENXIO;
> @@ -727,8 +733,9 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>  		goto out;
>  
>  	if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) {
> -		DRM_ERROR("HDCP check failed: link is not encrypted, %x\n",
> -			   I915_READ(PORT_HDCP_STATUS(port)));
> +		DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n",
> +			  connector->base.name, connector->base.base.id,
> +			  I915_READ(PORT_HDCP_STATUS(port)));
>  		ret = -ENXIO;
>  		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
>  		schedule_work(&connector->hdcp_prop_work);
> @@ -745,7 +752,8 @@ int intel_hdcp_check_link(struct intel_connector *connector)
>  		goto out;
>  	}
>  
> -	DRM_DEBUG_KMS("HDCP link failed, retrying authentication\n");
> +	DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n",
> +		      connector->base.name, connector->base.base.id);
>  
>  	ret = _intel_hdcp_disable(connector);
>  	if (ret) {
> -- 
> 2.7.4
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* ✗ Fi.CI.BAT: warning for Adhering to HDCP1.4 Compliance Test Spec (rev2)
  2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
                   ` (7 preceding siblings ...)
  2018-02-02 20:11 ` [PATCH v2 8/8] drm/i915: fix misalignment in HDCP register def Ramalingam C
@ 2018-02-02 21:20 ` Patchwork
  8 siblings, 0 replies; 16+ messages in thread
From: Patchwork @ 2018-02-02 21:20 UTC (permalink / raw)
  To: Ramalingam C; +Cc: intel-gfx

== Series Details ==

Series: Adhering to HDCP1.4 Compliance Test Spec (rev2)
URL   : https://patchwork.freedesktop.org/series/37539/
State : warning

== Summary ==

Series 37539v2 Adhering to HDCP1.4 Compliance Test Spec
https://patchwork.freedesktop.org/api/1.0/series/37539/revisions/2/mbox/

Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (fi-kbl-r)

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:417s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:422s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:370s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:482s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:483s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:479s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:464s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:453s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:562s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:410s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:280s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:511s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:388s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:397s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:408s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:455s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:418s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:457s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:493s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:498s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:571s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:507s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:528s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:490s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:472s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:414s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:429s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:521s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:394s
Blacklisted hosts:
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:464s

2e76a2952923eba64c4f9baf461613bc42ee997a drm-tip: 2018y-02m-02d-20h-33m-12s UTC integration manifest
f59e25b3bcf1 drm/i915: fix misalignment in HDCP register def
a7d2d95a6d4c drm/i915: Reauthenticate HDCP on failure
cc97a0bd0632 drm/i915: Detect panel's hdcp capability
3a341f86d9ff drm/i915: Optimize HDCP key load
305d2e473304 drm/i915: Retry HDCP bksv read
8e90c38454d8 drm/i915: Connector info in HDCP debug msgs
9c11e3f71d69 drm/i915: Stop encryption for repeater with no sink
045ac0c60193 drm/i915: Handle failure from 2nd stage HDCP auth

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7870/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-02-02 21:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 20:11 [PATCH v2 0/8] Adhering to HDCP1.4 Compliance Test Spec Ramalingam C
2018-02-02 20:11 ` [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth Ramalingam C
2018-02-02 20:52   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink Ramalingam C
2018-02-02 20:52   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs Ramalingam C
2018-02-02 20:52   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 4/8] drm/i915: Retry HDCP bksv read Ramalingam C
2018-02-02 20:44   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 5/8] drm/i915: Optimize HDCP key load Ramalingam C
2018-02-02 20:11 ` [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability Ramalingam C
2018-02-02 20:46   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure Ramalingam C
2018-02-02 20:51   ` Sean Paul
2018-02-02 20:11 ` [PATCH v2 8/8] drm/i915: fix misalignment in HDCP register def Ramalingam C
2018-02-02 21:20 ` ✗ Fi.CI.BAT: warning for Adhering to HDCP1.4 Compliance Test Spec (rev2) Patchwork

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.