Skip to contentSkip to conversation

drm/amd/pm: Skip use smc fw data in SRIOV

PATCH In review Jingwen Chen 2 participants 3 messages Sep 23, 2020 – Sep 24, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/pm: Skip use smc fw data in SRIOV

smc fw is not needed in SRIOV, thus driver should not try to get smc fw data.

---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 61 ++++++++++---------
 1 file changed, 32 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +32 -29
index b53872eb4398..d8ca6d968813 100644
@@ -322,39 +322,42 @@ int smu_v11_0_setup_pptable(struct smu_context *smu)
 	void *table;
 	uint16_t version_major, version_minor;
 
-	hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
-	version_major = le16_to_cpu(hdr->header.header_version_major);
-	version_minor = le16_to_cpu(hdr->header.header_version_minor);
-	if ((version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) ||
-	    adev->asic_type == CHIP_NAVY_FLOUNDER) {
-		dev_info(adev->dev, "use driver provided pptable %d\n", smu->smu_table.boot_values.pp_table_id);
-		switch (version_minor) {
-		case 0:
-			ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
-			break;
-		case 1:
-			ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
-							 smu->smu_table.boot_values.pp_table_id);
-			break;
-		default:
-			ret = -EINVAL;
-			break;
+	if (!amdgpu_sriov_vf(adev)) {
+		hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
+		version_major = le16_to_cpu(hdr->header.header_version_major);
+		version_minor = le16_to_cpu(hdr->header.header_version_minor);
+		if ((version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) ||
+			adev->asic_type == CHIP_NAVY_FLOUNDER) {
+			dev_info(adev->dev, "use driver provided pptable %d\n", smu->smu_table.boot_values.pp_table_id);
+			switch (version_minor) {
+			case 0:
+				ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
+				break;
+			case 1:
+				ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
+								smu->smu_table.boot_values.pp_table_id);
+				break;
+			default:
+				ret = -EINVAL;
+				break;
+			}
+			if (ret)
+				return ret;
+			goto out;
 		}
-		if (ret)
-			return ret;
+	}
 
-	} else {
-		dev_info(adev->dev, "use vbios provided pptable\n");
-		index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
-						    powerplayinfo);
+	dev_info(adev->dev, "use vbios provided pptable\n");
+	index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
+						powerplayinfo);
 
-		ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
-					      (uint8_t **)&table);
-		if (ret)
-			return ret;
-		size = atom_table_size;
-	}
+	ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
+						(uint8_t **)&table);
+	if (ret)
+		return ret;
+	size = atom_table_size;
 
+out:
 	if (!smu->smu_table.power_play_table)
 		smu->smu_table.power_play_table = table;
 	if (!smu->smu_table.power_play_table_size)
Signature · 6 lines
2.25.1

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

PATCH 2/2 drm/amd: Skip not used microcode loading in SRIOV

smc, sdma, sos, ta and asd fw is not used in SRIOV. Skip them to accelerate sw_init for navi12.

v2: skip above fw in SRIOV for vega10 and sienna_cichlid
v3: directly skip psp fw loading in SRIOV

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c              | 10 ++++++----
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c               |  3 +++
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c               |  3 +++
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c               |  3 +++
 .../gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c  | 12 +++++++-----
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c            | 11 +++++++----
 6 files changed, 29 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -4
index 2c66e20b2ed9..18be544d8c1e 100644
@@ -161,10 +161,12 @@ static int psp_sw_init(void *handle)
 	struct psp_context *psp = &adev->psp;
 	int ret;
 
-	ret = psp_init_microcode(psp);
-	if (ret) {
-		DRM_ERROR("Failed to load psp firmware!\n");
-		return ret;
+	if (!amdgpu_sriov_vf(adev)) {
+		ret = psp_init_microcode(psp);
+		if (ret) {
+			DRM_ERROR("Failed to load psp firmware!\n");
+			return ret;
+		}
 	}
 
 	ret = psp_memory_training_init(psp);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +3 -0
index 810635cbf4c1..86fb1eddf5a6 100644
@@ -592,6 +592,9 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
 	struct amdgpu_firmware_info *info = NULL;
 	const struct common_firmware_header *header = NULL;
 
+	if (amdgpu_sriov_vf(adev))
+		return 0;
+
 	DRM_DEBUG("\n");
 
 	switch (adev->asic_type) {
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +3 -0
index 48c95a78a173..9c72b95b7463 100644
@@ -203,6 +203,9 @@ static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)
 	const struct common_firmware_header *header = NULL;
 	const struct sdma_firmware_header_v1_0 *hdr;
 
+	if (amdgpu_sriov_vf(adev))
+		return 0;
+
 	DRM_DEBUG("\n");
 
 	switch (adev->asic_type) {
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +3 -0
index 34ccf376ee45..9f3952723c63 100644
@@ -148,6 +148,9 @@ static int sdma_v5_2_init_microcode(struct amdgpu_device *adev)
 	struct amdgpu_firmware_info *info = NULL;
 	const struct common_firmware_header *header = NULL;
 
+	if (amdgpu_sriov_vf(adev))
+		return 0;
+
 	DRM_DEBUG("\n");
 
 	switch (adev->asic_type) {
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c +7 -5
index 1e222c5d91a4..daf122f24f23 100644
@@ -209,11 +209,13 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
 	int ret;
 	struct cgs_firmware_info info = {0};
 
-	ret = cgs_get_firmware_info(hwmgr->device,
-				    CGS_UCODE_ID_SMU,
-				    &info);
-	if (ret || !info.kptr)
-		return -EINVAL;
+	if (!amdgpu_sriov_vf((struct amdgpu_device *)hwmgr->adev)) {
+		ret = cgs_get_firmware_info(hwmgr->device,
+						CGS_UCODE_ID_SMU,
+						&info);
+		if (ret || !info.kptr)
+			return -EINVAL;
+	}
 
 	priv = kzalloc(sizeof(struct vega10_smumgr), GFP_KERNEL);
 
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7 -4
index 538e6f5e19eb..3010cb31324a 100644
@@ -832,10 +832,13 @@ static int smu_sw_init(void *handle)
 
 	smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
 	smu->smu_dpm.requested_dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;
-	ret = smu_init_microcode(smu);
-	if (ret) {
-		dev_err(adev->dev, "Failed to load smu firmware!\n");
-		return ret;
+
+	if (!amdgpu_sriov_vf(adev)) {
+		ret = smu_init_microcode(smu);
+		if (ret) {
+			dev_err(adev->dev, "Failed to load smu firmware!\n");
+			return ret;
+		}
 	}
 
 	ret = smu_smc_table_sw_init(smu);
Signature · 6 lines
2.25.1

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

RE: [PATCH 2/2] drm/amd: Skip not used microcode loading in SRIOV

[AMD Official Use Only - Internal Distribution Only]

Series is Reviewed-by: Emily.Deng <[email protected]>

Quoted 146 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jingwen Chen
Sent: Wednesday, September 23, 2020 6:07 PM
To: [email protected]
Cc: Chen, JingWen <[email protected]>
Subject: [PATCH 2/2] drm/amd: Skip not used microcode loading in SRIOV

smc, sdma, sos, ta and asd fw is not used in SRIOV. Skip them to accelerate sw_init for navi12.

v2: skip above fw in SRIOV for vega10 and sienna_cichlid
v3: directly skip psp fw loading in SRIOV

---

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c              | 10 ++++++----
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c               |  3 +++
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c               |  3 +++
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c               |  3 +++
.../gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c  | 12 +++++++----
-
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c            | 11 +++++++----
6 files changed, 29 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -4
index 2c66e20b2ed9..18be544d8c1e 100644
@@ -161,10 +161,12 @@ static int psp_sw_init(void *handle)
 struct psp_context *psp = &adev->psp;
 int ret;
 
-ret = psp_init_microcode(psp);
-if (ret) {
-DRM_ERROR("Failed to load psp firmware!\n");
-return ret;
+if (!amdgpu_sriov_vf(adev)) {
+ret = psp_init_microcode(psp);
+if (ret) {
+DRM_ERROR("Failed to load psp firmware!\n");
+return ret;
+}
 }
 
 ret = psp_memory_training_init(psp);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +3 -0
index 810635cbf4c1..86fb1eddf5a6 100644
@@ -592,6 +592,9 @@ static int sdma_v4_0_init_microcode(struct
 amdgpu_device *adev)
 struct amdgpu_firmware_info *info = NULL;
 const struct common_firmware_header *header = NULL;
 
+if (amdgpu_sriov_vf(adev))
+return 0;
+
 DRM_DEBUG("\n");
 

switch (adev->asic_type) {

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +3 -0
index 48c95a78a173..9c72b95b7463 100644
@@ -203,6 +203,9 @@ static int sdma_v5_0_init_microcode(struct
 amdgpu_device *adev)
 const struct common_firmware_header *header = NULL;
 const struct sdma_firmware_header_v1_0 *hdr;
 
+if (amdgpu_sriov_vf(adev))
+return 0;
+
 DRM_DEBUG("\n");
 

switch (adev->asic_type) {

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +3 -0
index 34ccf376ee45..9f3952723c63 100644
@@ -148,6 +148,9 @@ static int sdma_v5_2_init_microcode(struct
 amdgpu_device *adev)
 struct amdgpu_firmware_info *info = NULL;
 const struct common_firmware_header *header = NULL;
 
+if (amdgpu_sriov_vf(adev))
+return 0;
+
 DRM_DEBUG("\n");
 

switch (adev->asic_type) {

drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c +7 -5
index 1e222c5d91a4..daf122f24f23 100644
@@ -209,11 +209,13 @@ static int vega10_smu_init(struct pp_hwmgr
 *hwmgr)
 int ret;
 struct cgs_firmware_info info = {0};
 
-ret = cgs_get_firmware_info(hwmgr->device,
-    CGS_UCODE_ID_SMU,
-    &info);
-if (ret || !info.kptr)
-return -EINVAL;
+if (!amdgpu_sriov_vf((struct amdgpu_device *)hwmgr->adev)) {
+ret = cgs_get_firmware_info(hwmgr->device,
+CGS_UCODE_ID_SMU,
+&info);
+if (ret || !info.kptr)
+return -EINVAL;
+}
 
 priv = kzalloc(sizeof(struct vega10_smumgr), GFP_KERNEL);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 538e6f5e19eb..3010cb31324a 100644
@@ -832,10 +832,13 @@ static int smu_sw_init(void *handle)
 
 smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;

smu->smu_dpm.requested_dpm_level =
AMD_DPM_FORCED_LEVEL_AUTO;

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7 -4
-ret = smu_init_microcode(smu);
-if (ret) {
-dev_err(adev->dev, "Failed to load smu firmware!\n");
-return ret;
+
+if (!amdgpu_sriov_vf(adev)) {
+ret = smu_init_microcode(smu);
+if (ret) {
+dev_err(adev->dev, "Failed to load smu firmware!\n");
+return ret;
+}

}

ret = smu_smc_table_sw_init(smu);
--
2.25.1

Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fre
edesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7CEmily.Deng%40amd.com%7Ce86d2c737f474bb90 aa008d85fa86c48%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C 637364524587021372&amp;sdata=z6fkXF7odf2ZHXPu4wOELA3RuVBm4arFgn 9f%2FB8Ie6k%3D&amp;reserved=0

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