Skip to contentSkip to conversation

drm/amd/pp: Get and save CZ/ST smu version

PATCH In review Rex Zhu 2 participants 2 messages Dec 21, 2017 – Dec 22, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: Get and save CZ/ST smu version

The smu firmware is loaded by the sbios on APUs, so query it from the smu and save the smu fw version info that is reported to userspace.

Change-Id Ifce41405c0369610985881cea26e14b0525e4d25
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c          |  2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +2 -0
index 13607e2..4466f35 100644
@@ -801,6 +801,8 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 				else
 					strcpy(fw_name, "amdgpu/vega10_smc.bin");
 				break;
+			case CHIP_CARRIZO:
+			case CHIP_STONEY:
 			case CHIP_RAVEN:
 				adev->pm.fw_version = info->version;
 				return 0;
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +13 -0
index 78ab055..4d3aff3 100644
@@ -709,6 +709,19 @@ static int cz_start_smu(struct pp_hwmgr *hwmgr)
 {
 	int ret = 0;
 	uint32_t fw_to_check = 0;
+	struct cgs_firmware_info info = {0};
+	uint32_t index = SMN_MP1_SRAM_START_ADDR +
+			 SMU8_FIRMWARE_HEADER_LOCATION +
+			 offsetof(struct SMU8_Firmware_Header, Version);
+
+
+	if (hwmgr == NULL || hwmgr->device == NULL)
+		return -EINVAL;
+
+	cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index);
+	hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA);
+	info.version = hwmgr->smu_version >> 8;
+	cgs_get_firmware_info(hwmgr->device, CGS_UCODE_ID_SMU, &info);
 
 	fw_to_check = UCODE_ID_RLC_G_MASK |
 			UCODE_ID_SDMA0_MASK |
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1513852896-24551-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Thursday, December 21, 2017 5:41:36 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amd/pp: Get and save CZ/ST smu version

The smu firmware is loaded by the sbios on APUs, so query it from the smu and save the smu fw version info that is reported to userspace.

Change-Id Ifce41405c0369610985881cea26e14b0525e4d25
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c          |  2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +2 -0
index 13607e2..4466f35 100644
@@ -801,6 +801,8 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
                                 else
                                         strcpy(fw_name, "amdgpu/vega10_smc.bin");
                                 break;
+                       case CHIP_CARRIZO:
+                       case CHIP_STONEY:
                         case CHIP_RAVEN:
                                 adev->pm.fw_version = info->version;
                                 return 0;
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +13 -0
index 78ab055..4d3aff3 100644
@@ -709,6 +709,19 @@ static int cz_start_smu(struct pp_hwmgr *hwmgr)
 {
         int ret = 0;
         uint32_t fw_to_check = 0;
+       struct cgs_firmware_info info = {0};
+       uint32_t index = SMN_MP1_SRAM_START_ADDR +
+                        SMU8_FIRMWARE_HEADER_LOCATION +
+                        offsetof(struct SMU8_Firmware_Header, Version);
+
+
+       if (hwmgr == NULL || hwmgr->device == NULL)
+               return -EINVAL;
+
+       cgs_write_register(hwmgr->device, mmMP0PUB_IND_INDEX, index);
+       hwmgr->smu_version = cgs_read_register(hwmgr->device, mmMP0PUB_IND_DATA);
+       info.version = hwmgr->smu_version >> 8;
+       cgs_get_firmware_info(hwmgr->device, CGS_UCODE_ID_SMU, &info);
 
         fw_to_check = UCODE_ID_RLC_G_MASK |
                         UCODE_ID_SDMA0_MASK |

--
1.9.1

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

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