[2/3] drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL

Alex Deucher alexdeucher at gmail.com
Mon Oct 2 20:19:26 UTC 2023


On Mon, Oct 2, 2023 at 3:46 PM Mario Limonciello
<mario.limonciello at amd.com> wrote:
>
> On 10/2/2023 13:49, Alex Deucher wrote:
> > For backwards compatibility with userspace.
> >
> > Fixes: 47f1724db4fe ("drm/amd: Introduce `AMDGPU_PP_SENSOR_GPU_INPUT_POWER`")
> > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2897
> > Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 ++++++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > index 081bd28e2443..ce71f853931a 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > @@ -1077,7 +1077,12 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> >                       if (amdgpu_dpm_read_sensor(adev,
> >                                                  AMDGPU_PP_SENSOR_GPU_AVG_POWER,
> >                                                  (void *)&ui32, &ui32_size)) {
> > -                             return -EINVAL;
>
> In order to encourage userspace software to move to the new dedicated
> IOCTL, what do you think about having a dev_warn_once() here?

I'm not opposed, but I think it will probably just lead to more bug
reports.  We need to type up the mesa side anyway before we can push
patch 3.

Alex

>
> > +                             /* fall back to input power for backwards compat */
> > +                             if (amdgpu_dpm_read_sensor(adev,
> > +                                                        AMDGPU_PP_SENSOR_GPU_INPUT_POWER,
> > +                                                        (void *)&ui32, &ui32_size)) {
> > +                                     return -EINVAL;
> > +                             }
> >                       }
> >                       ui32 >>= 8;
> >                       break;
>


More information about the amd-gfx mailing list