Re: [PATCH 4/4] SWDEV-226663 - Ignore the not supported error from psp

2020-03-25 Thread Luben Tuikov
On 2020-03-25 04:33, Emily Deng wrote:
> As the VCN firmware will not use
> vf vmr now. And new psp policy won't support set tmr
> now.
> For driver compatible issue, ignore the not support error.

The line wrap is a bit off here.

> 
> Signed-off-by: Emily Deng 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index c2bf2d9..1a46050 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -205,6 +205,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
>   int index;
>   int timeout = 2000;
>   bool ras_intr = false;
> + bool skip_unsupport = false;

I'd name this "skip_unsupported", or "skip_unsupp".

You shouldn't have to initialize "skip_unsupport" to a value.
Leave it uninitialized. You want the compiler to warn you
if you're using it uninitialized, and show you the path(s)
where this happens, so you can check the logic of the patch.

>  
>   mutex_lock(>mutex);
>  
> @@ -236,6 +237,9 @@ psp_cmd_submit_buf(struct psp_context *psp,
>   amdgpu_asic_invalidate_hdp(psp->adev, NULL);
>   }
>  
> + /* We allow TEE_ERROR_NOT_SUPPORTED for VMR command in SRIOV */
> + skip_unsupport = (psp->cmd_buf_mem->resp.status == 0x000a) && 
> amdgpu_sriov_vf(psp->adev);
> +

It's unconditionally set here, so you don't need to initialize it when you 
define it.

Regards,
Luben

>   /* In some cases, psp response status is not 0 even there is no
>* problem while the command is submitted. Some version of PSP FW
>* doesn't write 0 to that field.
> @@ -243,7 +247,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
>* during psp initialization to avoid breaking hw_init and it doesn't
>* return -EINVAL.
>*/
> - if ((psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
> + if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && 
> !ras_intr) {
>   if (ucode)
>   DRM_WARN("failed to load ucode id (%d) ",
> ucode->ucode_id);
> 

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


Re: [PATCH 4/4] SWDEV-226663 - Ignore the not supported error from psp

2020-03-25 Thread Alex Deucher
On Wed, Mar 25, 2020 at 4:33 AM Emily Deng  wrote:
>
> As the VCN firmware will not use
> vf vmr now. And new psp policy won't support set tmr
> now.
> For driver compatible issue, ignore the not support error.
>
> Signed-off-by: Emily Deng 

Please fix the patch title.  With that fixed:
Reviewed-by: Alex Deucher 

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index c2bf2d9..1a46050 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -205,6 +205,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
> int index;
> int timeout = 2000;
> bool ras_intr = false;
> +   bool skip_unsupport = false;
>
> mutex_lock(>mutex);
>
> @@ -236,6 +237,9 @@ psp_cmd_submit_buf(struct psp_context *psp,
> amdgpu_asic_invalidate_hdp(psp->adev, NULL);
> }
>
> +   /* We allow TEE_ERROR_NOT_SUPPORTED for VMR command in SRIOV */
> +   skip_unsupport = (psp->cmd_buf_mem->resp.status == 0x000a) && 
> amdgpu_sriov_vf(psp->adev);
> +
> /* In some cases, psp response status is not 0 even there is no
>  * problem while the command is submitted. Some version of PSP FW
>  * doesn't write 0 to that field.
> @@ -243,7 +247,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
>  * during psp initialization to avoid breaking hw_init and it doesn't
>  * return -EINVAL.
>  */
> -   if ((psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
> +   if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && 
> !ras_intr) {
> if (ucode)
> DRM_WARN("failed to load ucode id (%d) ",
>   ucode->ucode_id);
> --
> 2.7.4
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 4/4] SWDEV-226663 - Ignore the not supported error from psp

2020-03-25 Thread Liu, Monk
Reviewed-by: Monk Liu < monk@amd.com>

_
Monk Liu|GPU Virtualization Team |AMD


-Original Message-
From: amd-gfx  On Behalf Of Emily Deng
Sent: Wednesday, March 25, 2020 4:33 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deng, Emily 
Subject: [PATCH 4/4] SWDEV-226663 - Ignore the not supported error from psp

As the VCN firmware will not use
vf vmr now. And new psp policy won't support set tmr now.
For driver compatible issue, ignore the not support error.

Signed-off-by: Emily Deng 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index c2bf2d9..1a46050 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -205,6 +205,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
int index;
int timeout = 2000;
bool ras_intr = false;
+   bool skip_unsupport = false;
 
mutex_lock(>mutex);
 
@@ -236,6 +237,9 @@ psp_cmd_submit_buf(struct psp_context *psp,
amdgpu_asic_invalidate_hdp(psp->adev, NULL);
}
 
+   /* We allow TEE_ERROR_NOT_SUPPORTED for VMR command in SRIOV */
+   skip_unsupport = (psp->cmd_buf_mem->resp.status == 0x000a) && 
+amdgpu_sriov_vf(psp->adev);
+
/* In some cases, psp response status is not 0 even there is no
 * problem while the command is submitted. Some version of PSP FW
 * doesn't write 0 to that field.
@@ -243,7 +247,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
 * during psp initialization to avoid breaking hw_init and it doesn't
 * return -EINVAL.
 */
-   if ((psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
+   if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && 
+!ras_intr) {
if (ucode)
DRM_WARN("failed to load ucode id (%d) ",
  ucode->ucode_id);
--
2.7.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cmonk.liu%40amd.com%7C62d9f9c813ab4abc2d8d08d7d09742a0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637207220397136549sdata=bdF3bmwXnmsYeJNcgImMHq2o4ambY0VVYCc4gC24zEc%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx