Skip to contentSkip to conversation

drm/amdgpu: refine PSP TA firmware info print in debugfs

PATCH In review Kevin Wang 2 participants 5 messages Mar 1, 2021

Subsystems (2)
lore
Share & tools
lore

Kevin Wang

author
#0 lore raw

PATCH 1/2 drm/amdgpu: refine PSP TA firmware info print in debugfs

refine PSP TA firmware info print in amdgpu_firmware_info().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 50 +++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  1 +
 2 files changed, 21 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +20 -30
index 6c8ea9d26320..1a27673271b0 100644
@@ -289,23 +289,23 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
 		break;
 	case AMDGPU_INFO_FW_TA:
 		switch (query_fw->index) {
-		case 0:
+		case TA_FW_TYPE_PSP_XGMI:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_xgmi_ucode_version;
 			break;
-		case 1:
+		case TA_FW_TYPE_PSP_RAS:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_ras_ucode_version;
 			break;
-		case 2:
+		case TA_FW_TYPE_PSP_HDCP:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_hdcp_ucode_version;
 			break;
-		case 3:
+		case TA_FW_TYPE_PSP_DTM:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_dtm_ucode_version;
 			break;
-		case 4:
+		case TA_FW_TYPE_PSP_RAP:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_rap_ucode_version;
 			break;
@@ -1355,6 +1355,17 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 	struct atom_context *ctx = adev->mode_info.atom_context;
 	int ret, i;
 
+	static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT] = {
+#define TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type
+		TA_FW_NAME(ASD),
+		TA_FW_NAME(XGMI),
+		TA_FW_NAME(RAS),
+		TA_FW_NAME(HDCP),
+		TA_FW_NAME(DTM),
+		TA_FW_NAME(RAP),
+#undef TA_FW_NAME
+	};
+
 	/* VCE */
 	query_fw.fw_type = AMDGPU_INFO_FW_VCE;
 	ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
@@ -1472,35 +1483,14 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 		   fw_info.feature, fw_info.ver);
 
 	query_fw.fw_type = AMDGPU_INFO_FW_TA;
-	for (i = 0; i < 5; i++) {
+	for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {
 		query_fw.index = i;
 		ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
 		if (ret)
 			continue;
-		switch (query_fw.index) {
-		case 0:
-			seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-					"RAS", fw_info.feature, fw_info.ver);
-			break;
-		case 1:
-			seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-					"XGMI", fw_info.feature, fw_info.ver);
-			break;
-		case 2:
-			seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-					"HDCP", fw_info.feature, fw_info.ver);
-			break;
-		case 3:
-			seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-					"DTM", fw_info.feature, fw_info.ver);
-			break;
-		case 4:
-			seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
-					"RAP", fw_info.feature, fw_info.ver);
-			break;
-		default:
-			return -EINVAL;
-		}
+
+		seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
+			   ta_fw_name[i], fw_info.feature, fw_info.ver);
 	}
 
 	/* SMC */
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
index 46449e70348b..c03f32ec3ebc 100644
@@ -136,6 +136,7 @@ enum ta_fw_type {
 	TA_FW_TYPE_PSP_DTM,
 	TA_FW_TYPE_PSP_RAP,
 	TA_FW_TYPE_PSP_SECUREDISPLAY,
+	TA_FW_TYPE_PSP_COUNT,
 };
 
 struct ta_fw_bin_desc {
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/2 drm/amdgpu: add SECURE DISPLAY TA firmware info in debugfs

add SECUREDISPLAY TA firmware info in amdgpu_fimrware_info()

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -0
index 1a27673271b0..ed51dd0468e8 100644
@@ -309,6 +309,10 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_rap_ucode_version;
 			break;
+		case TA_FW_TYPE_PSP_SECUREDISPLAY:
+			fw_info->ver = adev->psp.ta_fw_version;
+			fw_info->feature = adev->psp.ta_securedisplay_ucode_version;
+			break;
 		default:
 			return -EINVAL;
 		}
@@ -1363,6 +1367,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 		TA_FW_NAME(HDCP),
 		TA_FW_NAME(DTM),
 		TA_FW_NAME(RAP),
+		TA_FW_NAME(SECUREDISPLAY),
 #undef TA_FW_NAME
 	};
 
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] drm/amdgpu: add SECURE DISPLAY TA firmware info in debugfs

[AMD Public Use]

With my concern on patch #1 addressed, the series is

Regards,
Hawking
-----Original Message-----
From: Wang, Kevin(Yang) <[email protected]>
Sent: Monday, March 1, 2021 17:10
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: add SECURE DISPLAY TA firmware info in debugfs

add SECUREDISPLAY TA firmware info in amdgpu_fimrware_info()

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -0
index 1a27673271b0..ed51dd0468e8 100644
@@ -309,6 +309,10 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_rap_ucode_version;
 			break;
+		case TA_FW_TYPE_PSP_SECUREDISPLAY:
+			fw_info->ver = adev->psp.ta_fw_version;
+			fw_info->feature = adev->psp.ta_securedisplay_ucode_version;
+			break;
 		default:
 			return -EINVAL;
 		}
@@ -1363,6 +1367,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 		TA_FW_NAME(HDCP),
 		TA_FW_NAME(DTM),
 		TA_FW_NAME(RAP),
+		TA_FW_NAME(SECUREDISPLAY),
 #undef TA_FW_NAME
 	};
 
Signature · 5 lines
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to Kevin Wang

[AMD Public Use]

+ for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {

I think we still rely on AMDGPU_INFO_FW_ASD to query ASD firmware version. Therefore, we need to start from TA_FW_TYPE_PSP_XGMI.

+ TA_FW_TYPE_PSP_COUNT,
+ static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT]

The enum is a little bit confusing, might rename to TA_FW_TYPE_MAX_INDEX,

Regards,
Hawking

-----Original Message-----
From: Wang, Kevin(Yang) <[email protected]>
Sent: Monday, March 1, 2021 17:10
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs

refine PSP TA firmware info print in amdgpu_firmware_info().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 50 +++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  1 +
 2 files changed, 21 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +16 -5
index 6c8ea9d26320..1a27673271b0 100644
@@ -289,23 +289,23 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
 		break;
 	case AMDGPU_INFO_FW_TA:
 		switch (query_fw->index) {
-		case 0:
+		case TA_FW_TYPE_PSP_XGMI:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_xgmi_ucode_version;
 			break;
-		case 1:
+		case TA_FW_TYPE_PSP_RAS:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_ras_ucode_version;
 			break;
-		case 2:
+		case TA_FW_TYPE_PSP_HDCP:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_hdcp_ucode_version;
 			break;
-		case 3:
+		case TA_FW_TYPE_PSP_DTM:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_dtm_ucode_version;
 			break;
-		case 4:
+		case TA_FW_TYPE_PSP_RAP:
 			fw_info->ver = adev->psp.ta_fw_version;
 			fw_info->feature = adev->psp.ta_rap_ucode_version;
 			break;
@@ -1355,6 +1355,17 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
 	struct atom_context *ctx = adev->mode_info.atom_context;
 	int ret, i;
 
+	static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT] = { #define 
+TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type
+		TA_FW_NAME(ASD),
+		TA_FW_NAME(XGMI),
+		TA_FW_NAME(RAS),
+		TA_FW_NAME(HDCP),
+		TA_FW_NAME(DTM),
+		TA_FW_NAME(RAP),
+#undef TA_FW_NAME
+	};
+
 	/* VCE */
 	query_fw.fw_type = AMDGPU_INFO_FW_VCE;
 	ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); @@ -1472,35 +1483,14 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)

fw_info.feature, fw_info.ver);

query_fw.fw_type = AMDGPU_INFO_FW_TA;
- for (i = 0; i < 5; i++) {
+ for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {
query_fw.index = i;
ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); if (ret)
continue;
- switch (query_fw.index) {
- case 0:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "RAS", fw_info.feature, fw_info.ver);
- break;
- case 1:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "XGMI", fw_info.feature, fw_info.ver);
- break;
- case 2:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "HDCP", fw_info.feature, fw_info.ver);
- break;
- case 3:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "DTM", fw_info.feature, fw_info.ver);
- break;
- case 4:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "RAP", fw_info.feature, fw_info.ver);
- break;
- default:
- return -EINVAL;
- }
+
+ seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
+ ta_fw_name[i], fw_info.feature, fw_info.ver);
}

/* SMC */

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
index 46449e70348b..c03f32ec3ebc 100644
@@ -136,6 +136,7 @@ enum ta_fw_type {
 	TA_FW_TYPE_PSP_DTM,
 	TA_FW_TYPE_PSP_RAP,
 	TA_FW_TYPE_PSP_SECUREDISPLAY,
+	TA_FW_TYPE_PSP_COUNT,
 };
 
 struct ta_fw_bin_desc {

--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw

[AMD Public Use]

________________________________
From: Zhang, Hawking <[email protected]>
Sent: Monday, March 1, 2021 5:31 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs

[AMD Public Use]

+ for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {

I think we still rely on AMDGPU_INFO_FW_ASD to query ASD firmware version. Therefore, we need to start from TA_FW_TYPE_PSP_XGMI.

[kevin]:
thanks, yes, the ASD is different with other TAs, I will correct it before submitting.

+ TA_FW_TYPE_PSP_COUNT,
+ static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT]

The enum is a little bit confusing, might rename to TA_FW_TYPE_MAX_INDEX,

Regards,
Hawking

-----Original Message-----
From: Wang, Kevin(Yang) <[email protected]>
Sent: Monday, March 1, 2021 17:10
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: refine PSP TA firmware info print in debugfs

refine PSP TA firmware info print in amdgpu_firmware_info().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 50 +++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  1 +
 2 files changed, 21 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +16 -5
index 6c8ea9d26320..1a27673271b0 100644
@@ -289,23 +289,23 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
                 break;
         case AMDGPU_INFO_FW_TA:
                 switch (query_fw->index) {
-               case 0:
+               case TA_FW_TYPE_PSP_XGMI:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_xgmi_ucode_version;
                         break;
-               case 1:
+               case TA_FW_TYPE_PSP_RAS:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_ras_ucode_version;
                         break;
-               case 2:
+               case TA_FW_TYPE_PSP_HDCP:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_hdcp_ucode_version;
                         break;
-               case 3:
+               case TA_FW_TYPE_PSP_DTM:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_dtm_ucode_version;
                         break;
-               case 4:
+               case TA_FW_TYPE_PSP_RAP:
                         fw_info->ver = adev->psp.ta_fw_version;
                         fw_info->feature = adev->psp.ta_rap_ucode_version;
                         break;
@@ -1355,6 +1355,17 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
         struct atom_context *ctx = adev->mode_info.atom_context;
         int ret, i;
 
+       static const char *ta_fw_name[TA_FW_TYPE_PSP_COUNT] = { #define
+TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type
+               TA_FW_NAME(ASD),
+               TA_FW_NAME(XGMI),
+               TA_FW_NAME(RAS),
+               TA_FW_NAME(HDCP),
+               TA_FW_NAME(DTM),
+               TA_FW_NAME(RAP),
+#undef TA_FW_NAME
+       };
+
         /* VCE */
         query_fw.fw_type = AMDGPU_INFO_FW_VCE;
         ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); @@ -1472,35 +1483,14 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
                    fw_info.feature, fw_info.ver);

         query_fw.fw_type = AMDGPU_INFO_FW_TA;
-       for (i = 0; i < 5; i++) {
+       for (i = TA_FW_TYPE_PSP_ASD; i < TA_FW_TYPE_PSP_COUNT; i++) {
                 query_fw.index = i;
                 ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
                 if (ret)
                         continue;

- switch (query_fw.index) {
- case 0:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "RAS", fw_info.feature, fw_info.ver);
- break;
- case 1:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "XGMI", fw_info.feature, fw_info.ver);
- break;
- case 2:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "HDCP", fw_info.feature, fw_info.ver);
- break;
- case 3:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "DTM", fw_info.feature, fw_info.ver);
- break;
- case 4:
- seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",
- "RAP", fw_info.feature, fw_info.ver);
- break;
- default:
- return -EINVAL;
- }
+
+ seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n",

+                          ta_fw_name[i], fw_info.feature, fw_info.ver);
         }

         /* SMC */
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
index 46449e70348b..c03f32ec3ebc 100644
@@ -136,6 +136,7 @@ enum ta_fw_type {
         TA_FW_TYPE_PSP_DTM,
         TA_FW_TYPE_PSP_RAP,
         TA_FW_TYPE_PSP_SECUREDISPLAY,
+       TA_FW_TYPE_PSP_COUNT,
 };
 
 struct ta_fw_bin_desc {

--
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx