drm/i915/hdcp: update cp_irq_count_cached in intel_dp_hdcp2_read_msg()
PATCH 1/3 drm/i915/hdcp: update cp_irq_count_cached in intel_dp_hdcp2_read_msg()
Update cp_irq_count_cached when we handle reading the messages rather than writing a message to make sure the value is up to date and not stale from a previously handled CP_IRQ. AKE flow doesn't always respond to a read with a write msg.
E.g. currently AKE_Send_Pairing_Info will "timeout" because we received a CP_IRQ for reading AKE_Send_H_Prime but no write occurred between that and reading AKE_Send_Pairing_Info so cp_irq_count_cached is stale causing the wait to return right away rather than waiting for a new CP_IRQ.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +4 -4
@@ -442,8 +442,6 @@ staticint intel_dp_hdcp2_write_msg (struct intel_digital_port *dig_port,void *buf,size_t size) { -struct intel_dp *dp = &dig_port->dp; -struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_write, len;
@@ -459,8 +457,6 @@ int intel_dp_hdcp2_write_msg(struct intel_digital_port *dig_port, bytes_to_write = size -1 ; byte++; - hdcp->cp_irq_count_cached =atomic_read (&hdcp->cp_irq_count); -while (bytes_to_write) { len = bytes_to_write >DP_AUX_MAX_PAYLOAD_BYTES ?DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_write;
@@ -508,6 +504,8 @@ staticint intel_dp_hdcp2_read_msg (struct intel_digital_port *dig_port,u8 msg_id,void *buf,size_t size) { +struct intel_dp *dp = &dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev);unsigned int offset;u8 *byte = buf;
@@ -523,6 +521,8 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port,if (ret <0 )return ret; + hdcp->cp_irq_count_cached =atomic_read (&hdcp->cp_irq_count); +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { ret =get_receiver_id_list_size (dig_port);if (ret <0 )
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915/hdcp: read RxInfo once when reading Send_Pairing_Info
Previously when reading Send_Pairing_Info, RxInfo by itself was read once to retrieve the DEVICE_COUNT and then a second time when reading the RepeaterAuth_Send_ReceiverID_List which contains RxInfo.
On a couple HDCP 2.2 docks, this second read attempt on RxInfo fails due to no Ack response. This behavior doesn't seem to be defined but regardless we can fix it by reading RxInfo once and storing it before reading the rest of RepeaterAuth_Send_ReceiverID_List once we know the size.
Modify get_receiver_id_list_size() to read and store RxInfo in the message buffer and also parse DEVICE_COUNT so we know the size of RepeaterAuth_Send_ReceiverID_List.
Afterwards, retrieve the rest of the message at the offset for seq_num_V.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 31 ++++++++++---------- include/drm/drm_dp_helper.h | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +16 -15
@@ -475,11 +475,10 @@ int intel_dp_hdcp2_write_msg(struct intel_digital_port *dig_port, }static -ssize_t get_receiver_id_list_size (struct intel_digital_port *dig_port) +ssize_t get_receiver_id_list_rx_info (struct intel_digital_port *dig_port,u32 *dev_cnt,u8 *byte) { -u8 rx_info[HDCP_2_2_RXINFO_LEN ]; -u32 dev_cnt;ssize_t ret; +u8 *rx_info = byte; ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_HDCP_2_2_REG_RXINFO_OFFSET,
@@ -487,15 +486,11 @@ ssize_t get_receiver_id_list_size(struct intel_digital_port *dig_port)if (ret !=HDCP_2_2_RXINFO_LEN )return ret >=0 ? -EIO : ret; - dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 | + *dev_cnt = (HDCP_2_2_DEV_COUNT_HI (rx_info[0 ]) <<4 |HDCP_2_2_DEV_COUNT_LO (rx_info[1 ])); -if (dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) - dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ; - - ret =sizeof (struct hdcp2_rep_send_receiverid_list ) - -HDCP_2_2_RECEIVER_IDS_MAX_LEN + - (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); +if (*dev_cnt >HDCP_2_2_MAX_DEVICE_COUNT ) + *dev_cnt =HDCP_2_2_MAX_DEVICE_COUNT ;return ret; }
@@ -504,13 +499,14 @@ staticint intel_dp_hdcp2_read_msg (struct intel_digital_port *dig_port,u8 msg_id,void *buf,size_t size) { +struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev);struct intel_dp *dp = &dig_port->dp;struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; -struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev);unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_recv, len;const struct hdcp2_dp_msg_data *hdcp2_msg_data; +u32 dev_cnt; hdcp2_msg_data =get_hdcp2_dp_msg_data (msg_id);if (!hdcp2_msg_data)
@@ -523,17 +519,22 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port, hdcp->cp_irq_count_cached =atomic_read (&hdcp->cp_irq_count); +/* DP adaptation msgs has no msg_id */ + byte++; +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { - ret =get_receiver_id_list_size (dig_port); + ret =get_receiver_id_list_rx_info (dig_port, &dev_cnt, byte);if (ret <0 )return ret; - size = ret; + byte += ret; + size =sizeof (struct hdcp2_rep_send_receiverid_list ) - +HDCP_2_2_RXINFO_LEN -HDCP_2_2_RECEIVER_IDS_MAX_LEN + + (dev_cnt *HDCP_2_2_RECEIVER_ID_LEN ); } - bytes_to_recv = size -1 ;/* DP adaptation msgs has no msg_id */ - byte++; + bytes_to_recv = size -1 ;while (bytes_to_recv) { len = bytes_to_recv > DP_AUX_MAX_PAYLOAD_BYTES ?
include/drm/drm_dp_helper.h +1 -1
@@ -1388,7 +1388,7 @@ enum drm_dp_phy {#define DP_HDCP_2_2_LC_INIT_OFFSET DP_HDCP_2_2_REG_RN_OFFSET#define DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET DP_HDCP_2_2_REG_LPRIME_OFFSET#define DP_HDCP_2_2_SKE_SEND_EKS_OFFSET DP_HDCP_2_2_REG_EDKEY_KS_OFFSET -#define DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET DP_HDCP_2_2_REG_RXINFO_OFFSET +#define DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET DP_HDCP_2_2_REG_SEQ_NUM_V_OFFSET#define DP_HDCP_2_2_REP_SEND_ACK_OFFSET DP_HDCP_2_2_REG_V_OFFSET#define DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET DP_HDCP_2_2_REG_SEQ_NUM_M_OFFSET#define DP_HDCP_2_2_REP_STREAM_READY_OFFSET DP_HDCP_2_2_REG_MPRIME_OFFSET
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 drm/i915/hdcp: disable the QSES check for HDCP2.2 over MST
In reply to Juston LiLike the patch to disable QSES for HDCP 1.4 over MST
https://patchwork.freedesktop.org/patch/415297/ the HDCP2.2 spec doesn't require QSES as well and we've seen QSES not supported on a couple HDCP2.2 docks so far (Dell WD19 and Lenovo LDC-G2)
Remove it for now until we get a better idea of how widely supported QSES is and how to support it optionally.
--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 31 +------------------- 1 file changed, 1 insertion(+), 30 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_hdcp.c +1 -30
@@ -699,30 +699,6 @@ intel_dp_mst_hdcp_stream_encryption(struct intel_connector *connector,return 0 ; } -static bool intel_dp_mst_get_qses_status (struct intel_digital_port *dig_port, -struct intel_connector *connector) -{ -struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev); -struct drm_dp_query_stream_enc_status_ack_reply reply; -struct intel_dp *intel_dp = &dig_port->dp; -int ret; - - ret =drm_dp_send_query_stream_enc_status (&intel_dp->mst_mgr, - connector->port, &reply); -if (ret) { -drm_dbg_kms (&i915->drm, -"[%s:%d] failed QSES ret=%d\n" , - connector->base.name, connector->base.base.id, ret); -return false; - } - -drm_dbg_kms (&i915->drm,"[%s:%d] QSES stream auth: %d stream enc: %d\n" , - connector->base.name, connector->base.base.id, - reply.auth_completed, reply.encryption_enabled); - -return reply.auth_completed && reply.encryption_enabled; -} -static bool intel_dp_mst_hdcp_check_link (struct intel_digital_port *dig_port,struct intel_connector *connector)
@@ -768,11 +744,6 @@ intel_dp_mst_hdcp2_stream_encryption(struct intel_connector *connector,return 0 ; } -/* -* DP v2.0 I.3.3 ignore the stream signature L' in QSES reply msg reply. -* I.3.5 MST source device may use a QSES msg to query downstream status -* for a particular stream. -*/ static int intel_dp_mst_hdcp2_check_link (struct intel_digital_port *dig_port,struct intel_connector *connector)
@@ -792,7 +763,7 @@ int intel_dp_mst_hdcp2_check_link(struct intel_digital_port *dig_port,return ret; } -return intel_dp_mst_get_qses_status (dig_port, connector) ?0 : -EINVAL ; +return 0 ; }static const struct intel_hdcp_shim intel_dp_mst_hdcp_shim = {
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
kernel test robot
build botRe: [Intel-gfx] [PATCH 3/3] drm/i915/hdcp: disable the QSES check for HDCP2.2 over MST
Thank you for the patch! Yet something to improve:
Hi Juston,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip next-20210125] [cannot apply to v5.11-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Juston-Li/drm-i915-hdcp-update-cp_irq_count_cached-in-intel_dp_hdcp2_read_msg/20210127-082615 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-a003-20210126 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 74784a5aa47bb8967e5868831e359fa631abe465)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/46e1277aaec81a0c1a754855cc0f077f4ef866e0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Juston-Li/drm-i915-hdcp-update-cp_irq_count_cached-in-intel_dp_hdcp2_read_msg/20210127-082615 git checkout 46e1277aaec81a0c1a754855cc0f077f4ef866e0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/i915/display/intel_dp_hdcp.c:709:9: error: implicit declaration of function 'intel_dp_mst_get_qses_status' [-Werror,-Wimplicit-function-declaration]
return intel_dp_mst_get_qses_status(dig_port, connector);
^1 error generated.
vim +/intel_dp_mst_get_qses_status +709 drivers/gpu/drm/i915/display/intel_dp_hdcp.c
1a67a168f57b68 Anshuman Gupta 2021-01-11 701
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 702 static
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 703 bool intel_dp_mst_hdcp_check_link(struct intel_digital_port *dig_port,
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 704 struct intel_connector *connector)
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 705 {
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 706 if (!intel_dp_hdcp_check_link(dig_port, connector))
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 707 return false;
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 708 e9fd05c3e4f21a Anshuman Gupta 2021-01-11 @709 return intel_dp_mst_get_qses_status(dig_port, connector);e9fd05c3e4f21a Anshuman Gupta 2021-01-11 710 }e9fd05c3e4f21a Anshuman Gupta 2021-01-11 711
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [Intel-gfx] [PATCH 3/3] drm/i915/hdcp: disable the QSES check for HDCP2.2 over MST
In reply to Juston LiThank you for the patch! Yet something to improve:
Hi Juston,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip next-20210125] [cannot apply to v5.11-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Juston-Li/drm-i915-hdcp-update-cp_irq_count_cached-in-intel_dp_hdcp2_read_msg/20210127-082615 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/46e1277aaec81a0c1a754855cc0f077f4ef866e0 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Juston-Li/drm-i915-hdcp-update-cp_irq_count_cached-in-intel_dp_hdcp2_read_msg/20210127-082615 git checkout 46e1277aaec81a0c1a754855cc0f077f4ef866e0 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/gpu/drm/i915/display/intel_dp_hdcp.c: In function 'intel_dp_mst_hdcp_check_link':
>> drivers/gpu/drm/i915/display/intel_dp_hdcp.c:709:9: error: implicit declaration of function 'intel_dp_mst_get_qses_status'; did you mean 'intel_dpll_get_hw_state'? [-Werror=implicit-function-declaration]
709 | return intel_dp_mst_get_qses_status(dig_port, connector);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| intel_dpll_get_hw_statecc1: some warnings being treated as errors
vim +709 drivers/gpu/drm/i915/display/intel_dp_hdcp.c
1a67a168f57b68 Anshuman Gupta 2021-01-11 701
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 702 static
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 703 bool intel_dp_mst_hdcp_check_link(struct intel_digital_port *dig_port,
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 704 struct intel_connector *connector)
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 705 {
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 706 if (!intel_dp_hdcp_check_link(dig_port, connector))
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 707 return false;
e9fd05c3e4f21a Anshuman Gupta 2021-01-11 708 e9fd05c3e4f21a Anshuman Gupta 2021-01-11 @709 return intel_dp_mst_get_qses_status(dig_port, connector);e9fd05c3e4f21a Anshuman Gupta 2021-01-11 710 }e9fd05c3e4f21a Anshuman Gupta 2021-01-11 711
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [1/3] drm/i915/hdcp: update cp_irq_count_cached in intel_dp_hdcp2_read_msg()
In reply to Juston Li== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915/hdcp: update cp_irq_count_cached in intel_dp_hdcp2_read_msg()
URL : https://patchwork.freedesktop.org/series/86310/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/display/intel_dp_hdcp.odrivers/gpu/drm/i915/display/intel_dp_hdcp.c: In function ‘intel_dp_mst_hdcp_check_link’:drivers/gpu/drm/i915/display/intel_dp_hdcp.c:709:9: error: implicit declaration of function ‘intel_dp_mst_get_qses_status’; did you mean ‘intel_dpll_get_hw_state’? [-Werror=implicit-function-declaration]
return intel_dp_mst_get_qses_status(dig_port, connector);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
intel_dpll_get_hw_statecc1: all warnings being treated as errorsscripts/Makefile.build:279: recipe for target 'drivers/gpu/drm/i915/display/intel_dp_hdcp.o' failed make[4]: *** [drivers/gpu/drm/i915/display/intel_dp_hdcp.o] Error 1 scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:496: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1805: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Build is failing .
Please send patches again after fixing it.
Quoted 66 lines
-----Original Message-----
From: Li, Juston <[email protected]>
Sent: Wednesday, January 27, 2021 1:38 AM
To: [email protected]
Cc: [email protected]; Gupta, Anshuman <[email protected]>; C, Ramalingam <[email protected]>; Li, Juston <[email protected]>
Subject: [PATCH 1/3] drm/i915/hdcp: updatecp_irq_count_cachedinintel_dp_hdcp2_read_msg()Update
cp_irq_count_cachedwhen we handle reading the messages rather than writing a message to make sure the value is up to date and not stale from a previously handledCP_IRQ. AKE flow doesn't always respond to a read with a write msg.E.g. currently
AKE_Send_Pairing_Infowill "timeout" because we received aCP_IRQfor readingAKE_Send_H_Primebut no write occurred between that and readingAKE_Send_Pairing_Infosocp_irq_count_cachedis stale causing the wait to return right away rather than waiting for a newCP_IRQ.Signed-off-by Juston Li <[email protected]>--- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/display/intel_dp_hdcp.c +0
-4@@ -442,8 +442,6 @@ staticint intel_dp_hdcp2_write_msg (struct intel_digital_port *dig_port,void *buf,size_t size) { -struct intel_dp *dp = &dig_port->dp; -struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;unsigned int offset;u8 *byte = buf;ssize_t ret, bytes_to_write, len;@@ -459,8 +457,6 @@ int intel_dp_hdcp2_write_msg(structintel_digital_port *dig_port, bytes_to_write = size -1 ; byte++; - hdcp->cp_irq_count_cached =atomic_read (&hdcp->cp_irq_count); -while (bytes_to_write) { len = bytes_to_write > DP_AUX_MAX_PAYLOAD_BYTES ?
DP_AUX_MAX_PAYLOAD_BYTES:bytes_to_write; @@ -508,6 +504,8 @@ static int intel_dp_hdcp2_read_msg(structintel_digital_port*dig_port,drivers/gpu/drm/i915/display/intel_dp_hdcp.c +4
-0u8 msg_id, void *buf, size_t size) { + struct intel_dp *dp = &dig_port->dp; +struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;struct drm_i915_private *i915 =to_i915 (dig_port->base.base.dev);unsigned int offset;u8 *byte = buf;@@ -523,6 +521,8 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port, if (ret < 0)return ret; + hdcp->cp_irq_count_cached =atomic_read (&hdcp->cp_irq_count); +if (msg_id ==HDCP_2_2_REP_SEND_RECVID_LIST ) { ret =get_receiver_id_list_size (dig_port);
Quoted 3 lines
if (ret < 0)
--
2.29.2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx