> -----Original Message-----
> From: Lazar, Lijo <lijo.la...@amd.com>
> Sent: Friday, May 5, 2023 5:00 PM
> To: Chen, Guchun <guchun.c...@amd.com>; amd-
> g...@lists.freedesktop.org; Deucher, Alexander
> <alexander.deuc...@amd.com>; Zhang, Hawking
> <hawking.zh...@amd.com>; Quan, Evan <evan.q...@amd.com>; Koenig,
> Christian <christian.koe...@amd.com>; Pan, Xinhui <xinhui....@amd.com>
> Subject: Re: [PATCH] drm/amd/pm: parse pp_handle under appropriate
> conditions
> 
> 
> 
> On 5/5/2023 1:54 PM, Guchun Chen wrote:
> > amdgpu_dpm_is_overdrive_supported is a common API across all asics, so
> > we should cast pp_handle into correct structure under different power
> > frameworks.
> >
> > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2541
> > Fixes: ebfc253335af("drm/amd/pm: do not expose the smu_context
> > structure used internally in power")
> > Signed-off-by: Guchun Chen <guchun.c...@amd.com>
> > ---
> >   drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 16 +++++++++-------
> >   1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > index f0068df2d073..ae45abeab5b5 100644
> > --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > @@ -1455,13 +1455,15 @@ int
> amdgpu_dpm_get_smu_prv_buf_details(struct
> > amdgpu_device *adev,
> >
> >   int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
> >   {
> > -   struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
> > -   struct smu_context *smu = adev->powerplay.pp_handle;
> > -
> > -   if ((is_support_sw_smu(adev) && smu->od_enabled) ||
> > -       (is_support_sw_smu(adev) && smu->is_apu) ||
> > -           (!is_support_sw_smu(adev) && hwmgr->od_enabled))
> > -           return true;
> > +   if (is_support_sw_smu(adev)) {
> > +           struct smu_context *smu = adev->powerplay.pp_handle;
> > +           if (smu->od_enabled || smu->is_apu)
> > +
> 
> Minor change - return (smu->od_enabled || smu->is_apu); and similar
> below for the other check also.

Make sense, will update in v2 with your RB.

Regards,
Guchun

> Anyway,
> 
>       Reviewed-by: Lijo Lazar <lijo.la...@amd.com>
> 
> Thanks,
> Lijo
> 
>               return true;
> > +   } else {
> > +           struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
> > +           if (hwmgr->od_enabled)
> > +                   return true;
> > +   }
> >
> >     return false;
> >   }

Reply via email to