Skip to contentSkip to conversation

drm/amdgpu: Add secure display v2 command

PATCH In review Jinzhou Su 2 participants 2 messages Nov 28, 2024 – Nov 29, 2024

Subsystems (2)
lore
Share & tools
lore

Jinzhou Su

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Add secure display v2 command

Add secure display v2 command to support multiple ROI instances per display.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c       |  3 ++-
 .../gpu/drm/amd/amdgpu/ta_secureDisplay_if.h  | 22 ++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -1
index f015961f257a..12832fd834fb 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +21 -1
index 00d8bdb8254f..c5eddd685390 100644
@@ -31,10 +31,12 @@
  *    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,
+	/* 15 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 */
@@ -98,12 +102,21 @@ struct ta_securedisplay_send_roi_crc_input {
 	uint32_t  phy_id;  /* Physical ID */
 };
 
+struct ta_securedisplay_send_roi_crc_v2_input
+{
+   uint32_t phy_id;  /* Physical ID */
+   uint8_t  roi_idx; /* Region of interest index */
+};
+
 /** @union ta_securedisplay_cmd_input
  *    Input buffer
  */
 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;
+	/* Reserved space for future expansion */
 	uint32_t                                          reserved[4];
 };
 
@@ -128,6 +141,11 @@ 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];
 };
 
Signature · 1 line
2.43.0
#1 lore raw

[Public]

Quoted 55 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jinzhou Su
Sent: Thursday, November 28, 2024 11:31 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Lin, Wayne <[email protected]>; Strauss, Andrew <[email protected]>; Su, Joe <[email protected]>; Lin, Wayne <[email protected]>
Subject: [PATCH] drm/amdgpu: Add secure display v2 command

Add secure display v2 command to support multiple ROI instances per display.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 ++-
.../gpu/drm/amd/amdgpu/ta_secureDisplay_if.h | 22 ++++++++++++++++++-

2 files changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -1
index f015961f257a..12832fd834fb 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +4 -1
index 00d8bdb8254f..c5eddd685390 100644
@@ -31,10 +31,12 @@
 *    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,

};

drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h enum ta_securedisplay_ta_query_cmd_ret { enum · line 88

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +1 -0
@@ -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,
+      /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) + 1 byte(roi_idx) */

A typo? 15 bytes -> 16 bytes

drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h struct ta_securedisplay_send_roi_crc_input { · line 110

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +1 -0
+      TA_SECUREDISPLAY_V2_I2C_BUFFER_SIZE             = 16,
 };
 
 /** Input/output structures for Secure Display commands */ @@ -98,12 +102,21 @@

struct ta_securedisplay_send_roi_crc_input {
uint32_t phy_id; /* Physical ID */
};

drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +5 -0
+struct ta_securedisplay_send_roi_crc_v2_input
+{
+   uint32_t phy_id;  /* Physical ID */
+   uint8_t  roi_idx; /* Region of interest index */ };
+

Coding style issue.

Use
struct ta_securedisplay_send_roi_crc_v2_input {

};

instead of
struct ta_securedisplay_send_roi_crc_v2_input
{

};

Quoted 13 lines

/** @union ta_securedisplay_cmd_input
* Input buffer
*/

union ta_securedisplay_cmd_input {
      /* send ROI and CRC input buffer format */
      struct ta_securedisplay_send_roi_crc_input        send_roi_crc;
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +3 -0
+      /* send ROI and CRC input buffer format, v2 adds a ROI index */
+      struct ta_securedisplay_send_roi_crc_v2_input     send_roi_crc_v2;
+      /* Reserved space for future expansion */
      uint32_t                                          reserved[4];

};

drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h struct ta_securedisplay_send_roi_crc_output { · line 147

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +4 -0
@@ -128,6 +141,11 @@ 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 */ };

Coding style issue.

Use
struct ta_securedisplay_send_roi_crc_v2_output {

};

instead of
struct ta_securedisplay_send_roi_crc_v2_output
{

};

Regards,
Lang

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h +3 -1
+
 /** @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];
 };
 
--

2.43.0