Hi Christian

I have modified it according to your suggestion. Can you help review this 
again? Thanks in advance.


Best Regards
Yintian Tao

-----Original Message-----
From: Yintian Tao <yt...@amd.com> 
Sent: Thursday, May 16, 2019 7:54 PM
To: amd-gfx@lists.freedesktop.org
Cc: Tao, Yintian <yintian....@amd.com>; Liu, Monk <monk....@amd.com>
Subject: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

PSP fw primary buffer is not used under SRIOV.
Therefore, we don't need to allocate memory for it.

v2: remove superfluous check for amdgpu_bo_free_kernel().

Signed-off-by: Yintian Tao <yt...@amd.com>
Signed-off-by: Monk Liu <monk....@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index c567a55..af9835c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -905,13 +905,16 @@ static int psp_load_fw(struct amdgpu_device *adev)
        if (!psp->cmd)
                return -ENOMEM;
 
-       ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
-                                       AMDGPU_GEM_DOMAIN_GTT,
-                                       &psp->fw_pri_bo,
-                                       &psp->fw_pri_mc_addr,
-                                       &psp->fw_pri_buf);
-       if (ret)
-               goto failed;
+       /* this fw pri bo is not used under SRIOV */
+       if (!amdgpu_sriov_vf(psp->adev)) {
+               ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
+                                             AMDGPU_GEM_DOMAIN_GTT,
+                                             &psp->fw_pri_bo,
+                                             &psp->fw_pri_mc_addr,
+                                             &psp->fw_pri_buf);
+               if (ret)
+                       goto failed;
+       }
 
        ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE,
                                        AMDGPU_GEM_DOMAIN_VRAM,
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to