Adhering to HDCP1.4 Compliance Test Spec
Subsystems (2)
v2 cover Adhering to HDCP1.4 Compliance Test Spec
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(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/8 drm/i915: Handle failure from 2nd stage HDCP auth
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]
--- drivers/gpu/drm/i915/intel_hdcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_hdcp.c +3 -0
@@ -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; }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 1/8] drm/i915: Handle failure from 2nd stage HDCP auth
Quoted 4 lines · Ramalingam C
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.
Quoted 8 lines
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 todisable_hdcp()toenable_hdcp()[Seanpaul]Signed-off-by Ramalingam C <[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/i915/intel_hdcp.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/i915/intel_hdcp.c +3
-0@@ -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; }Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/8 drm/i915: Stop encryption for repeater with no sink
In reply to Ramalingam CIf 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]
--- drivers/gpu/drm/i915/intel_hdcp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +8 -2
@@ -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)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/8] drm/i915: Stop encryption for repeater with no sink
Quoted 11 lines · Ramalingam C
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.
Quoted 7 lines
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 <[email protected]>
Quoted 30 lines
--- drivers/gpu/drm/i915/intel_hdcp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_hdcp.c +8
-2@@ -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)Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/8 drm/i915: Connector info in HDCP debug msgs
In reply to Ramalingam CWhen 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.
--- drivers/gpu/drm/i915/intel_hdcp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +11 -3
@@ -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) {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 3/8] drm/i915: Connector info in HDCP debug msgs
Quoted 8 lines · Ramalingam C
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 <[email protected]>
Quoted 53 lines
--- drivers/gpu/drm/i915/intel_hdcp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_hdcp.c +11
-3@@ -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) {Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/8 drm/i915: Retry HDCP bksv read
In reply to Ramalingam CHDCP 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]
--- drivers/gpu/drm/i915/intel_hdcp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +9 -4
@@ -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 ]);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 4/8] drm/i915: Retry HDCP bksv read
Quoted 28 lines · Ramalingam C
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 <[email protected]>--- drivers/gpu/drm/i915/intel_hdcp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_hdcp.c +1
-1@@ -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;
drivers/gpu/drm/i915/intel_hdcp.c static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port, · line 447
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +7
-1memset (&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
Quoted 11 lines
drivers/gpu/drm/i915/intel_hdcp.c +1
-2+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 ]);Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/8 drm/i915: Optimize HDCP key load
In reply to Ramalingam CHDCP 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.
--- drivers/gpu/drm/i915/intel_hdcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +4 -2
@@ -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" );
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/8 drm/i915: Detect panel's hdcp capability
In reply to Ramalingam CDP 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].
--- 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(-)
drivers/gpu/drm/i915/intel_dp.c +35 -4
@@ -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)
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -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 {
drivers/gpu/drm/i915/intel_hdcp.c +17 -1
@@ -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 ());
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
@@ -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,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 6/8] drm/i915: Detect panel's hdcp capability
Quoted 147 lines · Ramalingam C
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 <[email protected]>--- 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(-)drivers/gpu/drm/i915/intel_dp.c +35
-4@@ -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)drivers/gpu/drm/i915/intel_drv.h +4
-0@@ -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 {drivers/gpu/drm/i915/intel_hdcp.c +17
-1@@ -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 ());drivers/gpu/drm/i915/intel_hdmi.c +0
-0
drivers/gpu/drm/i915/intel_hdmi.c static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = { · line 1120
Quoted 4 lines
drivers/gpu/drm/i915/intel_hdmi.c +1
-0@@ -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:
Quoted 6 lines
drivers/gpu/drm/i915/intel_hdmi.c +0
-0}; static void intel_hdmi_prepare(struct intel_encoder *encoder,Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/8 drm/i915: Reauthenticate HDCP on failure
In reply to Ramalingam CIncase 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].
--- drivers/gpu/drm/i915/intel_hdcp.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_hdcp.c +16 -7
@@ -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)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 7/8] drm/i915: Reauthenticate HDCP on failure
Quoted 37 lines · Ramalingam C
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 <[email protected]>--- drivers/gpu/drm/i915/intel_hdcp.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_hdcp.c +5
-5@@ -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",
drivers/gpu/drm/i915/intel_hdcp.c static int _intel_hdcp_enable(struct intel_connector *connector) · line 609
Quoted 10 lines
drivers/gpu/drm/i915/intel_hdcp.c +10
-0+ 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
Quoted 14 lines
drivers/gpu/drm/i915/intel_hdcp.c +1
-2/* 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)Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 8/8 drm/i915: fix misalignment in HDCP register def
In reply to Ramalingam CThis patch aligns all definitions of hdcp registers and their bits.
v2:
No changes. Added reviewed-by tag.
--- drivers/gpu/drm/i915/i915_reg.h | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +29 -29
@@ -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)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for Adhering to HDCP1.4 Compliance Test Spec (rev2)
In reply to Ramalingam C== Series Details ==
== 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 defa7d2d95a6d4c drm/i915: Reauthenticate HDCP on failurecc97a0bd0632 drm/i915: Detect panel's hdcp capability3a341f86d9ff drm/i915: Optimize HDCP key load305d2e473304 drm/i915: Retry HDCP bksv read8e90c38454d8 drm/i915: Connector info in HDCP debug msgs9c11e3f71d69 drm/i915: Stop encryption for repeater with no sink045ac0c60193 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx