RE: [PATCH 2/2 v2] drm/amd/pm: check specific index for aldebaran

2024-05-14 Thread Zhang, Jesse(Jie)
[AMD Official Use Only - AMD Internal Distribution Only]

Hi Lijo

-Original Message-
From: Lazar, Lijo 
Sent: Tuesday, May 14, 2024 4:19 PM
To: Zhang, Jesse(Jie) ; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander ; Koenig, Christian 
; Huang, Tim 
Subject: Re: [PATCH 2/2 v2] drm/amd/pm: check specific index for aldebaran



On 5/14/2024 12:28 PM, Jesse Zhang wrote:
> To avoid warning problems, drop index and use PPSMC_MSG_GfxDriverReset
> instead of index for aldebaran.
>
> Signed-off-by: Jesse Zhang 
> Suggested-by: Lijo Lazar 
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> index a22eb6bbb05e..d671314c46c8 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> @@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct
> smu_context *smu)
>
>  static int aldebaran_mode2_reset(struct smu_context *smu)  {
> - int ret = 0, index;
> + int ret = 0;
>   struct amdgpu_device *adev = smu->adev;
>   int timeout = 10;
>
> - index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
> - SMU_MSG_GfxDeviceDriverReset);
> - if (index < 0 )
> - return -EINVAL;
>   mutex_lock(&smu->message_lock);
>   if (smu->smc_fw_version >= 0x00441400) {
> - ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, 
> SMU_RESET_MODE_2);

For clarity, original comment is - retain this as it is, only replace index 
with PPSMC_MSG_GfxDriverReset.

Changing this to msg_with_param() breaks the reset sequence.

[Zhang, Jesse(Jie)] Sorry, I misunderstood you, I will update the patch again.
Thanks
Jesse

Thanks,
Lijo

> + ret = smu_cmn_send_smc_msg_with_param(smu, 
> PPSMC_MSG_GfxDriverReset,
> + 
> SMU_RESET_MODE_2, NULL);
> + if (ret) {
> + dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
> + goto out;
> + }
>   /* This is similar to FLR, wait till max FLR timeout */
>   msleep(100);
>   dev_dbg(smu->adev->dev, "restore config space...\n");


Re: [PATCH 2/2 v2] drm/amd/pm: check specific index for aldebaran

2024-05-14 Thread Lazar, Lijo



On 5/14/2024 12:28 PM, Jesse Zhang wrote:
> To avoid warning problems, drop index and
> use PPSMC_MSG_GfxDriverReset instead of index for aldebaran.
> 
> Signed-off-by: Jesse Zhang 
> Suggested-by: Lijo Lazar 
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c 
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> index a22eb6bbb05e..d671314c46c8 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> @@ -1880,17 +1880,18 @@ static int aldebaran_mode1_reset(struct smu_context 
> *smu)
>  
>  static int aldebaran_mode2_reset(struct smu_context *smu)
>  {
> - int ret = 0, index;
> + int ret = 0;
>   struct amdgpu_device *adev = smu->adev;
>   int timeout = 10;
>  
> - index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
> - SMU_MSG_GfxDeviceDriverReset);
> - if (index < 0 )
> - return -EINVAL;
>   mutex_lock(&smu->message_lock);
>   if (smu->smc_fw_version >= 0x00441400) {
> - ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, 
> SMU_RESET_MODE_2);

For clarity, original comment is - retain this as it is, only replace
index with PPSMC_MSG_GfxDriverReset.

Changing this to msg_with_param() breaks the reset sequence.

Thanks,
Lijo

> + ret = smu_cmn_send_smc_msg_with_param(smu, 
> PPSMC_MSG_GfxDriverReset,
> + 
> SMU_RESET_MODE_2, NULL);
> + if (ret) {
> + dev_err(smu->adev->dev, "Failed to mode2 reset!\n");
> + goto out;
> + }
>   /* This is similar to FLR, wait till max FLR timeout */
>   msleep(100);
>   dev_dbg(smu->adev->dev, "restore config space...\n");