All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Roy Sun <Roy.Sun@amd.com>, Tom St Denis <tom.stdenis@amd.com>
Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amd/amdgpu: Expose some power info through AMDGPU_INFO
Date: Tue, 13 Apr 2021 10:58:19 -0400	[thread overview]
Message-ID: <CADnq5_M1mxSdF7KhiNsy35OKfJXJCOP=FdOBRUgQhb=RgXtztQ@mail.gmail.com> (raw)
In-Reply-To: <20210412121505.23787-1-Roy.Sun@amd.com>

On Mon, Apr 12, 2021 at 8:15 AM Roy Sun <Roy.Sun@amd.com> wrote:
>
> Add interface to get the mm clock, temperature and memory load
>
> Signed-off-by: Roy Sun <Roy.Sun@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 50 +++++++++++++++++++++++++
>  include/uapi/drm/amdgpu_drm.h           | 12 ++++++
>  2 files changed, 62 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index b2e774aeab45..e5b16e0819ce 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -971,6 +971,56 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>                         }
>                         ui32 /= 100;
>                         break;
> +               case AMDGPU_INFO_SENSOR_UVD_VCLK:
> +                       /* get mm vclk in Mhz */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_UVD_VCLK,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       ui32 /= 100;
> +                       break;
> +               case AMDGPU_INFO_SENSOR_UVD_DCLK:
> +                       /* get mm dclk in Mhz */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_UVD_DCLK,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       ui32 /= 100;
> +                       break;
> +               case AMDGPU_INFO_SENSOR_HOTSPOT_TEMP:
> +                       /* get junction temperature */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_HOTSPOT_TEMP,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       break;
> +               case AMDGPU_INFO_SENSOR_EDGE_TEMP:
> +                       /* get current edge temperature */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_EDGE_TEMP,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       break;
> +               case AMDGPU_INFO_SENSOR_MEM_TEMP:
> +                       /* get current memory temperature */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_MEM_TEMP,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       break;
> +               case AMDGPU_INFO_SENSOR_MEM_LOAD:
> +                       /* get memory load */
> +                       if (amdgpu_dpm_read_sensor(adev,
> +                                                  AMDGPU_PP_SENSOR_MEM_LOAD,
> +                                                  (void *)&ui32, &ui32_size)) {
> +                               return -EINVAL;
> +                       }
> +                       break;
>                 default:
>                         DRM_DEBUG_KMS("Invalid request %d\n",
>                                       info->sensor_info.type);
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 8b832f7458f2..484c72e17c72 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -780,6 +780,18 @@ struct drm_amdgpu_cs_chunk_data {
>         #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK               0x8
>         /* Subquery id: Query GPU stable pstate memory clock */
>         #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK               0x9
> +       /* Subquery id: Query GPU mm vclk */
> +       #define AMDGPU_INFO_SENSOR_UVD_VCLK             0xa
> +       /* Subquery id: Query GPU mm dclk */
> +       #define AMDGPU_INFO_SENSOR_UVD_DCLK             0xb
> +       /* Subquery id: Query junction temperature */
> +       #define AMDGPU_INFO_SENSOR_HOTSPOT_TEMP         0xc
> +       /* Subquery id: Query edge temperature */
> +       #define AMDGPU_INFO_SENSOR_EDGE_TEMP            0xd
> +       /* Subquery id: Query memory temperature */
> +       #define AMDGPU_INFO_SENSOR_MEM_TEMP             0xe
> +       /* Subquery id: Query Memory load */
> +       #define AMDGPU_INFO_SENSOR_MEM_LOAD             0xf

+ Tom

Please provide a link to patches for some userspace tool which uses
these new queries.  Something like umr would be a logical choice.
Once you have that, the patch itself looks good to me.

Alex


>  /* Number of VRAM page faults on CPU access. */
>  #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS   0x1E
>  #define AMDGPU_INFO_VRAM_LOST_COUNTER          0x1F
> --
> 2.31.1
>
> _______________________________________________
> 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

      parent reply	other threads:[~2021-04-13 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 12:15 [PATCH] drm/amd/amdgpu: Expose some power info through AMDGPU_INFO Roy Sun
2021-04-13 13:09 ` Sun, Roy
2021-04-13 13:20   ` Christian König
2021-04-13 14:58 ` Alex Deucher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnq5_M1mxSdF7KhiNsy35OKfJXJCOP=FdOBRUgQhb=RgXtztQ@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=Roy.Sun@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=tom.stdenis@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.