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

drm/amd/display: add mod hdcp interface for supporting encryption state query

Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Reviewed-by: George Shen <George.Shen@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenjing Liu and committed by
Alex Deucher
45f673e6 4fe1fdcc

+54 -29
+6
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c
··· 314 314 goto out; 315 315 } 316 316 317 + /* save current encryption states to restore after next authentication */ 318 + mod_hdcp_save_current_encryption_states(hdcp); 319 + 317 320 /* reset existing authentication status */ 318 321 status = reset_authentication(hdcp, output); 319 322 if (status != MOD_HDCP_STATUS_SUCCESS) ··· 362 359 status = MOD_HDCP_STATUS_SUCCESS; 363 360 goto out; 364 361 } 362 + 363 + /* save current encryption states to restore after next authentication */ 364 + mod_hdcp_save_current_encryption_states(hdcp); 365 365 366 366 /* stop current authentication */ 367 367 status = reset_authentication(hdcp, output);
+2 -2
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h
··· 331 331 struct mod_hdcp *hdcp, struct mod_hdcp_display *display); 332 332 enum mod_hdcp_status mod_hdcp_remove_display_from_topology( 333 333 struct mod_hdcp *hdcp, uint8_t index); 334 + bool mod_hdcp_is_link_encryption_enabled(struct mod_hdcp *hdcp); 335 + void mod_hdcp_save_current_encryption_states(struct mod_hdcp *hdcp); 334 336 enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp); 335 337 enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp); 336 338 enum mod_hdcp_status mod_hdcp_hdcp1_validate_rx(struct mod_hdcp *hdcp); ··· 341 339 enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption( 342 340 struct mod_hdcp *hdcp); 343 341 enum mod_hdcp_status mod_hdcp_hdcp1_link_maintenance(struct mod_hdcp *hdcp); 344 - enum mod_hdcp_status mod_hdcp_hdcp1_get_link_encryption_status(struct mod_hdcp *hdcp, 345 - enum mod_hdcp_encryption_status *encryption_status); 346 342 enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp); 347 343 enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp); 348 344 enum mod_hdcp_status mod_hdcp_hdcp2_prepare_ake_init(struct mod_hdcp *hdcp);
+22 -15
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
··· 256 256 goto out; 257 257 } 258 258 259 - if (!mod_hdcp_execute_and_set(mod_hdcp_hdcp1_link_maintenance, 259 + mod_hdcp_execute_and_set(mod_hdcp_hdcp1_link_maintenance, 260 260 &input->link_maintenance, &status, 261 - hdcp, "link_maintenance")) 262 - goto out; 261 + hdcp, "link_maintenance"); 262 + 263 + if (status != MOD_HDCP_STATUS_SUCCESS) 264 + mod_hdcp_save_current_encryption_states(hdcp); 263 265 out: 264 266 return status; 265 267 } ··· 427 425 event_ctx->unexpected_event = 1; 428 426 goto out; 429 427 } 428 + if (!mod_hdcp_is_link_encryption_enabled(hdcp)) 429 + goto out; 430 430 431 - if (!mod_hdcp_execute_and_set(mod_hdcp_read_bstatus, 432 - &input->bstatus_read, &status, 433 - hdcp, "bstatus_read")) 434 - goto out; 435 - if (!mod_hdcp_execute_and_set(check_link_integrity_dp, 436 - &input->link_integrity_check, &status, 437 - hdcp, "link_integrity_check")) 438 - goto out; 439 - if (!mod_hdcp_execute_and_set(check_no_reauthentication_request_dp, 440 - &input->reauth_request_check, &status, 441 - hdcp, "reauth_request_check")) 442 - goto out; 431 + if (status == MOD_HDCP_STATUS_SUCCESS) 432 + mod_hdcp_execute_and_set(mod_hdcp_read_bstatus, 433 + &input->bstatus_read, &status, 434 + hdcp, "bstatus_read"); 435 + if (status == MOD_HDCP_STATUS_SUCCESS) 436 + mod_hdcp_execute_and_set(check_link_integrity_dp, 437 + &input->link_integrity_check, &status, 438 + hdcp, "link_integrity_check"); 439 + if (status == MOD_HDCP_STATUS_SUCCESS) 440 + mod_hdcp_execute_and_set(check_no_reauthentication_request_dp, 441 + &input->reauth_request_check, &status, 442 + hdcp, "reauth_request_check"); 443 + 444 + if (status != MOD_HDCP_STATUS_SUCCESS) 445 + mod_hdcp_save_current_encryption_states(hdcp); 443 446 out: 444 447 return status; 445 448 }
+3 -3
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_transition.c
··· 93 93 } 94 94 break; 95 95 case H1_A45_AUTHENTICATED: 96 - if (input->link_maintenance != PASS) { 96 + if (input->link_maintenance == FAIL) { 97 97 /* 1A-07: consider invalid ri' a failure */ 98 98 /* 1A-07a: consider read ri' not returned a failure */ 99 99 fail_and_restart_in_ms(0, &status, output); ··· 243 243 } 244 244 break; 245 245 case D1_A4_AUTHENTICATED: 246 - if (input->link_integrity_check != PASS || 247 - input->reauth_request_check != PASS) { 246 + if (input->link_integrity_check == FAIL || 247 + input->reauth_request_check == FAIL) { 248 248 /* 1A-07: restart hdcp on a link integrity failure */ 249 249 fail_and_restart_in_ms(0, &status, output); 250 250 break;
+6 -4
drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c
··· 564 564 event_ctx->unexpected_event = 1; 565 565 goto out; 566 566 } 567 + if (!mod_hdcp_is_link_encryption_enabled(hdcp)) 568 + goto out; 567 569 568 - if (!process_rxstatus(hdcp, event_ctx, input, &status)) 569 - goto out; 570 - if (event_ctx->rx_id_list_ready) 571 - goto out; 570 + process_rxstatus(hdcp, event_ctx, input, &status); 571 + 572 + if (status != MOD_HDCP_STATUS_SUCCESS) 573 + mod_hdcp_save_current_encryption_states(hdcp); 572 574 out: 573 575 return status; 574 576 }
+5 -5
drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_transition.c
··· 245 245 HDCP_FULL_DDC_TRACE(hdcp); 246 246 break; 247 247 case H2_A5_AUTHENTICATED: 248 - if (input->rxstatus_read != PASS || 249 - input->reauth_request_check != PASS) { 248 + if (input->rxstatus_read == FAIL || 249 + input->reauth_request_check == FAIL) { 250 250 fail_and_restart_in_ms(0, &status, output); 251 251 break; 252 252 } else if (event_ctx->rx_id_list_ready && conn->is_repeater) { ··· 562 562 HDCP_FULL_DDC_TRACE(hdcp); 563 563 break; 564 564 case D2_A5_AUTHENTICATED: 565 - if (input->rxstatus_read != PASS || 566 - input->reauth_request_check != PASS) { 565 + if (input->rxstatus_read == FAIL || 566 + input->reauth_request_check == FAIL) { 567 567 fail_and_restart_in_ms(0, &status, output); 568 568 break; 569 - } else if (input->link_integrity_check_dp != PASS) { 569 + } else if (input->link_integrity_check_dp == FAIL) { 570 570 if (hdcp->connection.hdcp2_retry_count >= 1) 571 571 adjust->hdcp2.force_type = MOD_HDCP_FORCE_TYPE_0; 572 572 fail_and_restart_in_ms(0, &status, output);
+10
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
··· 914 914 return status; 915 915 } 916 916 917 + bool mod_hdcp_is_link_encryption_enabled(struct mod_hdcp *hdcp) 918 + { 919 + /* unsupported */ 920 + return true; 921 + } 922 + 923 + void mod_hdcp_save_current_encryption_states(struct mod_hdcp *hdcp) 924 + { 925 + /* unsupported */ 926 + }