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

Deng, Emily Emily.Deng at amd.com
Thu Sep 24 01:18:45 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Series is Reviewed-by:  Emily.Deng <Emily.Deng at amd.com>

>-----Original Message-----
>From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
>Jingwen Chen
>Sent: Wednesday, September 23, 2020 6:07 PM
>To: amd-gfx at lists.freedesktop.org
>Cc: Chen, JingWen <JingWen.Chen2 at amd.com>
>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
>Signed-off-by: Jingwen Chen <Jingwen.Chen2 at amd.com>
>---
> 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(-)
>
>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>index 2c66e20b2ed9..18be544d8c1e 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>@@ -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);
>diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>index 810635cbf4c1..86fb1eddf5a6 100644
>--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>@@ -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) {
>diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>index 48c95a78a173..9c72b95b7463 100644
>--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>@@ -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) {
>diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
>b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
>index 34ccf376ee45..9f3952723c63 100644
>--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
>+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
>@@ -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) {
>diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
>b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
>index 1e222c5d91a4..daf122f24f23 100644
>--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
>+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vega10_smumgr.c
>@@ -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);
>
>diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>index 538e6f5e19eb..3010cb31324a 100644
>--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>@@ -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);
>--
>2.25.1
>
>_______________________________________________
>amd-gfx mailing list
>amd-gfx at lists.freedesktop.org
>https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fre
>edesktop.org%2Fmailman%2Flistinfo%2Famd-
>gfx&data=02%7C01%7CEmily.Deng%40amd.com%7Ce86d2c737f474bb90
>aa008d85fa86c48%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C
>637364524587021372&sdata=z6fkXF7odf2ZHXPu4wOELA3RuVBm4arFgn
>9f%2FB8Ie6k%3D&reserved=0


More information about the amd-gfx mailing list