OSDN Git Service

drm/amd: Skip not used microcode loading in SRIOV
authorJingwen Chen <Jingwen.Chen2@amd.com>
Fri, 18 Sep 2020 09:43:49 +0000 (17:43 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 25 Sep 2020 20:54:00 +0000 (16:54 -0400)
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
Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com>
Reviewed-by: Emily.Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

index 2c66e20..18be544 100644 (file)
@@ -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);
index 810635c..86fb1ed 100644 (file)
@@ -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) {
index 48c95a7..9c72b95 100644 (file)
@@ -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) {
index 34ccf37..9f39527 100644 (file)
@@ -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) {
index 1e222c5..daf122f 100644 (file)
@@ -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);
 
index 538e6f5..3010cb3 100644 (file)
@@ -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);