Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: add additional hdcp traces

[why]
Current hdcp trace only tracks hdcp errors. We need to expand the trace
structure for more tracing information.

[how]
Add following traces for hdcp1:
- attempt_count
- downstream_device_count
Add following traces for hdcp2:
- attempt_count
- downstream_device_count
- hdcp1_device_downstream
- hdcp2_legacy_device_downstream

Reviewed-by: Sung Lee <sung.lee@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenjing Liu and committed by
Alex Deucher
8c6a0234 bf95cf7f

+51 -9
+3 -3
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
··· 354 354 /* reset retry counters */ 355 355 reset_retry_counts(hdcp); 356 356 357 - /* reset error trace */ 357 + /* reset trace */ 358 358 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); 359 359 360 360 /* add display to connection */ ··· 400 400 /* clear retry counters */ 401 401 reset_retry_counts(hdcp); 402 402 403 - /* reset error trace */ 403 + /* reset trace */ 404 404 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); 405 405 406 406 /* remove display */ ··· 464 464 /* clear retry counters */ 465 465 reset_retry_counts(hdcp); 466 466 467 - /* reset error trace */ 467 + /* reset trace */ 468 468 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); 469 469 470 470 /* set new adjustment */
+1 -1
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h
··· 508 508 struct mod_hdcp_output *output) 509 509 { 510 510 output->auth_complete = 1; 511 - mod_hdcp_log_ddc_trace(hdcp); 511 + HDCP_AUTH_COMPLETE_TRACE(hdcp); 512 512 } 513 513 514 514 /* connection topology helpers */
+11 -2
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
··· 29 29 { 30 30 uint64_t n = 0; 31 31 uint8_t count = 0; 32 + enum mod_hdcp_status status; 32 33 u8 bksv[sizeof(n)] = { }; 33 34 34 35 memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv)); ··· 39 38 count++; 40 39 n &= (n - 1); 41 40 } 42 - return (count == 20) ? MOD_HDCP_STATUS_SUCCESS : 43 - MOD_HDCP_STATUS_HDCP1_INVALID_BKSV; 41 + 42 + if (count == 20) { 43 + hdcp->connection.trace.hdcp1.attempt_count++; 44 + status = MOD_HDCP_STATUS_SUCCESS; 45 + } else { 46 + status = MOD_HDCP_STATUS_HDCP1_INVALID_BKSV; 47 + } 48 + return status; 44 49 } 45 50 46 51 static inline enum mod_hdcp_status check_ksv_ready(struct mod_hdcp *hdcp) ··· 141 134 /* Avoid device count == 0 to do authentication */ 142 135 if (get_device_count(hdcp) == 0) 143 136 return MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE; 137 + 138 + hdcp->connection.trace.hdcp1.downstream_device_count = get_device_count(hdcp); 144 139 145 140 /* Some MST display may choose to report the internal panel as an HDCP RX. 146 141 * To update this condition with 1(because the immediate repeater's internal
+16 -3
drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c
··· 48 48 static inline enum mod_hdcp_status check_hdcp2_capable(struct mod_hdcp *hdcp) 49 49 { 50 50 enum mod_hdcp_status status; 51 + struct mod_hdcp_trace *trace = &hdcp->connection.trace; 51 52 52 53 if (is_dp_hdcp(hdcp)) 53 54 status = (hdcp->auth.msg.hdcp2.rxcaps_dp[0] == HDCP_2_2_RX_CAPS_VERSION_VAL) && ··· 56 55 MOD_HDCP_STATUS_SUCCESS : 57 56 MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE; 58 57 else 59 - status = (hdcp->auth.msg.hdcp2.hdcp2version_hdmi & HDCP_2_2_HDMI_SUPPORT_MASK) ? 60 - MOD_HDCP_STATUS_SUCCESS : 61 - MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE; 58 + status = (hdcp->auth.msg.hdcp2.hdcp2version_hdmi 59 + & HDCP_2_2_HDMI_SUPPORT_MASK) 60 + ? MOD_HDCP_STATUS_SUCCESS 61 + : MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE; 62 + 63 + if (status == MOD_HDCP_STATUS_SUCCESS) 64 + trace->hdcp2.attempt_count++; 65 + 62 66 return status; 63 67 } 64 68 ··· 207 201 208 202 static enum mod_hdcp_status check_device_count(struct mod_hdcp *hdcp) 209 203 { 204 + struct mod_hdcp_trace *trace = &hdcp->connection.trace; 205 + 210 206 /* Avoid device count == 0 to do authentication */ 211 207 if (get_device_count(hdcp) == 0) 212 208 return MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE; 213 209 210 + trace->hdcp2.downstream_device_count = get_device_count(hdcp); 211 + trace->hdcp2.hdcp1_device_downstream = 212 + HDCP_2_2_HDCP1_DEVICE_CONNECTED(hdcp->auth.msg.hdcp2.rx_id_list[2]); 213 + trace->hdcp2.hdcp2_legacy_device_downstream = 214 + HDCP_2_2_HDCP_2_0_REP_CONNECTED(hdcp->auth.msg.hdcp2.rx_id_list[2]); 214 215 /* Some MST display may choose to report the internal panel as an HDCP RX. */ 215 216 /* To update this condition with 1(because the immediate repeater's internal */ 216 217 /* panel is possibly not included in DEVICE_COUNT) + get_device_count(hdcp). */
+6
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.h
··· 31 31 #define HDCP_LOG_FSM(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__) 32 32 #define HDCP_LOG_TOP(hdcp, ...) pr_debug("[HDCP_TOP]:"__VA_ARGS__) 33 33 #define HDCP_LOG_DDC(hdcp, ...) pr_debug("[HDCP_DDC]:"__VA_ARGS__) 34 + #define HDCP_LOG_TRA(hdcp) do {} while (0) 34 35 35 36 /* default logs */ 36 37 #define HDCP_ERROR_TRACE(hdcp, status) \ ··· 130 129 #define HDCP_TOP_INTERFACE_TRACE_WITH_INDEX(hdcp, i) do { \ 131 130 HDCP_LOG_TOP(hdcp, "\n"); \ 132 131 HDCP_LOG_TOP(hdcp, "[Link %d] %s display %d", hdcp->config.index, __func__, i); \ 132 + } while (0) 133 + 134 + #define HDCP_AUTH_COMPLETE_TRACE(hdcp) do { \ 135 + mod_hdcp_log_ddc_trace(hdcp); \ 136 + HDCP_LOG_TRA(hdcp); \ 133 137 } while (0) 134 138 135 139 #endif // MOD_HDCP_LOG_H_
+14
drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h
··· 230 230 uint8_t state_id; 231 231 }; 232 232 233 + struct mod_hdcp1_trace { 234 + uint8_t attempt_count; 235 + uint8_t downstream_device_count; 236 + }; 237 + 238 + struct mod_hdcp2_trace { 239 + uint8_t attempt_count; 240 + uint8_t downstream_device_count; 241 + uint8_t hdcp1_device_downstream; 242 + uint8_t hdcp2_legacy_device_downstream; 243 + }; 244 + 233 245 struct mod_hdcp_trace { 234 246 struct mod_hdcp_error errors[MAX_NUM_OF_ERROR_TRACE]; 235 247 uint8_t error_count; 248 + struct mod_hdcp1_trace hdcp1; 249 + struct mod_hdcp2_trace hdcp2; 236 250 }; 237 251 238 252 enum mod_hdcp_encryption_status {