Skip to contentSkip to conversation

drm/amdgpu: skip fw pri bo alloc for SRIOV

PATCH In review Yintian Tao 5 participants 7 messages May 16, 2019 – May 17, 2019 5 messages not in the archive

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

PATCH 1/1 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().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +10 -7
index c567a55..af9835c 100644
@@ -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,
Signature · 6 lines
2.7.4

_______________________________________________
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): 1558007618-24482-1-git-send-email-yttao-5C7GfCeVMHo@public.gmane.org

#2 lore raw

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 <[email protected]>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]
Cc: Tao, Yintian <[email protected]>; Liu, Monk <[email protected]>
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().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +10 -7
index c567a55..af9835c 100644
@@ -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,
Signature · 6 lines
2.7.4

_______________________________________________
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): MN2PR12MB3039EAC37D6BB17BD3582D77E50B0-rweVpJHSKTr/[email protected]

#4 lore raw

Looks good to me now, but I don't know the technical background why this BO is not needed under SRIOV.

So this patch is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Am 17.05.19 um 04:41 schrieb Tao, Yintian:

Quoted 45 lines

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 <[email protected]>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]
Cc: Tao, Yintian <[email protected]>; Liu, Monk <[email protected]>
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().

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -7
index c567a55..af9835c 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 920

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +7 -0
+					      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,

_______________________________________________
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): f77131be-9a53-789d-0f1e-c743c80dc11a-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Hi Christian

Many thanks for your review.

The background is that this bo is to let psp load sos and sysdrv but under sriov, sos and sysdrv is loaded by VBIOS or hypervisor driver.

The reason why not let guest driver to load it under SRIOV is that it is not safe.

Best Regards

Yintian Tao

________________________________
发件人: Koenig, Christian
发送时间: 2019年5月17日 14:53:35
收件人: Tao, Yintian
抄送: Liu, Monk; [email protected]
主题: Re: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

Looks good to me now, but I don't know the technical background why this BO is not needed under SRIOV.

So this patch is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Am 17.05.19 um 04:41 schrieb Tao, Yintian:

Quoted 45 lines

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 <[email protected]>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]
Cc: Tao, Yintian <[email protected]>; Liu, Monk <[email protected]>
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().

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -7
index c567a55..af9835c 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 920

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +7 -0
+                                           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,

_______________________________________________
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): MN2PR12MB30390AB5467D6A7080AD45C6E50B0-rweVpJHSKTr/[email protected]

#8 lore raw

Hi Yintian,

please add this as a code comment to the patch.

Christian.

Am 17.05.19 um 09:17 schrieb Tao, Yintian:

Quoted 90 lines

Hi  Christian

Many thanks for your review.

The background is that this bo is to let psp load sos and sysdrv but under sriov, sos and sysdrv is loaded by VBIOS or hypervisor driver.

The reason why not let guest driver to load it under SRIOV is that it is not safe.

Best Regards

Yintian Tao

------------------------------------------------------------------------
*发件人:* Koenig, Christian
*发送时间:* 2019年5月17日 14:53:35
*收件人:* Tao, Yintian
*抄送:* Liu, Monk; [email protected] *主题:* Re: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV Looks good to me now, but I don't know the technical background why this BO is not needed under SRIOV.

So this patch is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Am 17.05.19 um 04:41 schrieb Tao, Yintian:

Quoted 4 lines

Hi Christian

I have modified it according to your suggestion. Can you help review

this again? Thanks in advance.

Quoted 17 lines

Best Regards
Yintian Tao

-----Original Message-----
From: Yintian Tao <[email protected]>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]
Cc: Tao, Yintian <[email protected]>; Liu, Monk <[email protected]>
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().

Review

Quoted 7 lines

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------

   1 file changed, 10 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Quoted 16 lines

index c567a55..af9835c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -7
@@ -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)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 919

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +8 -0
+             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,

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 920

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -0
 AMDGPU_GEM_DOMAIN_VRAM,

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): 0f307e3d-3f5f-3766-6db8-e51ab6c2562e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#10 lore raw

Hi Chrisitian

Yes, of course. Thanks for your reminder.

Best Regards
Yintian Tao

________________________________
发件人: Christian König <[email protected]> 发送时间: 2019年5月17日 15:20:54
收件人: Tao, Yintian; Koenig, Christian
抄送: [email protected]; Liu, Monk
主题: Re: 答复: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

[CAUTION: External Email]
Hi Yintian,

please add this as a code comment to the patch.

Christian.

Am 17.05.19 um 09:17 schrieb Tao, Yintian:

Hi Christian

Many thanks for your review.

The background is that this bo is to let psp load sos and sysdrv but under sriov, sos and sysdrv is loaded by VBIOS or hypervisor driver.

The reason why not let guest driver to load it under SRIOV is that it is not safe.

Best Regards

Yintian Tao

________________________________
发件人: Koenig, Christian
发送时间: 2019年5月17日 14:53:35
收件人: Tao, Yintian
抄送: Liu, Monk; [email protected]<mailto:[email protected]> 主题: Re: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

Looks good to me now, but I don't know the technical background why this BO is not needed under SRIOV.

So this patch is Acked-by: Christian König <[email protected]><mailto:[email protected]>.

Regards,
Christian.

Am 17.05.19 um 04:41 schrieb Tao, Yintian:

Quoted 45 lines

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 <[email protected]><mailto:[email protected]>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]<mailto:[email protected]>
Cc: Tao, Yintian <[email protected]><mailto:[email protected]>; Liu, Monk <[email protected]><mailto:[email protected]>
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().

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -7
index c567a55..af9835c 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 920

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +7 -0
+                                           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,

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

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

#11 lore raw
In reply to a message not in the archive

Instead if guest load “sos” and “sysdrv” there are two kinds of result:

1. For elder version PSP boot loader guest would hit failure.
2. For new version PSP boot loader those ucode won’t work at all so loading the is redundant

/Monk

From: Tao, Yintian
Sent: Friday, May 17, 2019 3:17 PM
To: Koenig, Christian <[email protected]>
Cc: Liu, Monk <[email protected]>; [email protected]
Subject: 答复: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

Hi Christian

Many thanks for your review.

The background is that this bo is to let psp load sos and sysdrv but under sriov, sos and sysdrv is loaded by VBIOS or hypervisor driver.

The reason why not let guest driver to load it under SRIOV is that it is not safe.

Best Regards

Yintian Tao

________________________________
发件人: Koenig, Christian
发送时间: 2019年5月17日 14:53:35
收件人: Tao, Yintian
抄送: Liu, Monk; [email protected]<mailto:[email protected]> 主题: Re: [PATCH] drm/amdgpu: skip fw pri bo alloc for SRIOV

Looks good to me now, but I don't know the technical background why this BO is not needed under SRIOV.

So this patch is Acked-by: Christian König <[email protected]<mailto:[email protected]>>.

Regards,
Christian.

Am 17.05.19 um 04:41 schrieb Tao, Yintian:

Quoted 45 lines

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 <[email protected]<mailto:[email protected]>>
Sent: Thursday, May 16, 2019 7:54 PM
To: [email protected]<mailto:[email protected]>
Cc: Tao, Yintian <[email protected]<mailto:[email protected]>>; Liu, Monk <[email protected]<mailto:[email protected]>>
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().

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -7
index c567a55..af9835c 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_load_fw(struct amdgpu_device *adev) · line 920

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +7 -0
+                                           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,

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