drm/amdgpu: Add secure display v2 command
authorJinzhou Su <jinzhou.su@amd.com>
Thu, 28 Nov 2024 02:58:45 +0000 (10:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 10 Dec 2024 15:26:49 +0000 (10:26 -0500)
Add secure display v2 command to support multiple ROI instances per
display.

v2: fix typo and coding style issue

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Jinzhou Su <jinzhou.su@amd.com>
Reviewed-by: Lang Yu <lang.yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h

index e0efbb6aecdad78064ad094065072df722d4867c..e08fd07ce707e6f2b274857801f6668d9625e46c 100644 (file)
@@ -2264,7 +2264,8 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
                return -EINVAL;
 
        if (ta_cmd_id != TA_SECUREDISPLAY_COMMAND__QUERY_TA &&
-           ta_cmd_id != TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC)
+           ta_cmd_id != TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC &&
+           ta_cmd_id != TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC_V2)
                return -EINVAL;
 
        ret = psp_ta_invoke(psp, ta_cmd_id, &psp->securedisplay_context.context);
index 00d8bdb8254fb5d8e7aafc3a10867b5fb95d70d4..9ec2e03d41c72d312d7947d1671b4b3b5df435dd 100644 (file)
  *    Secure Display Command ID
  */
 enum ta_securedisplay_command {
-       /* Query whether TA is responding used only for validation purpose */
+       /* Query whether TA is responding. It is used only for validation purpose */
        TA_SECUREDISPLAY_COMMAND__QUERY_TA              = 1,
        /* Send region of Interest and CRC value to I2C */
        TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC          = 2,
+       /* V2 to send multiple regions of Interest and CRC value to I2C */
+       TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC_V2       = 3,
        /* Maximum Command ID */
        TA_SECUREDISPLAY_COMMAND__MAX_ID                = 0x7FFFFFFF,
 };
@@ -83,6 +85,8 @@ enum ta_securedisplay_ta_query_cmd_ret {
 enum ta_securedisplay_buffer_size {
        /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) */
        TA_SECUREDISPLAY_I2C_BUFFER_SIZE                = 15,
+       /* 16 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) + 1 byte(roi_idx) */
+       TA_SECUREDISPLAY_V2_I2C_BUFFER_SIZE             = 16,
 };
 
 /** Input/output structures for Secure Display commands */
@@ -95,7 +99,15 @@ enum ta_securedisplay_buffer_size {
  *    Physical ID to determine which DIO scratch register should be used to get ROI
  */
 struct ta_securedisplay_send_roi_crc_input {
-       uint32_t  phy_id;  /* Physical ID */
+       /* Physical ID */
+       uint32_t  phy_id;
+};
+
+struct ta_securedisplay_send_roi_crc_v2_input {
+       /* Physical ID */
+       uint32_t phy_id;
+       /* Region of interest index */
+       uint8_t  roi_idx;
 };
 
 /** @union ta_securedisplay_cmd_input
@@ -104,6 +116,8 @@ struct ta_securedisplay_send_roi_crc_input {
 union ta_securedisplay_cmd_input {
        /* send ROI and CRC input buffer format */
        struct ta_securedisplay_send_roi_crc_input        send_roi_crc;
+       /* send ROI and CRC input buffer format, v2 adds a ROI index */
+       struct ta_securedisplay_send_roi_crc_v2_input     send_roi_crc_v2;
        uint32_t                                          reserved[4];
 };
 
@@ -128,6 +142,10 @@ struct ta_securedisplay_send_roi_crc_output {
        uint8_t  reserved;
 };
 
+struct ta_securedisplay_send_roi_crc_v2_output {
+       uint8_t  i2c_buf[TA_SECUREDISPLAY_V2_I2C_BUFFER_SIZE];  /* I2C buffer */
+};
+
 /** @union ta_securedisplay_cmd_output
  *    Output buffer
  */
@@ -136,6 +154,8 @@ union ta_securedisplay_cmd_output {
        struct ta_securedisplay_query_ta_output            query_ta;
        /* Send ROI CRC output buffer format used only for validation purpose */
        struct ta_securedisplay_send_roi_crc_output        send_roi_crc;
+       /* Send ROI CRC output buffer format used only for validation purpose */
+       struct ta_securedisplay_send_roi_crc_v2_output     send_roi_crc_v2;
        uint32_t                                           reserved[4];
 };