All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <Lijo.Lazar@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: RE: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query
Date: Wed, 10 Mar 2021 16:28:49 +0000	[thread overview]
Message-ID: <MN2PR12MB45497227E152D0CE43A4D88097919@MN2PR12MB4549.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CADnq5_Pu1uWj1jAR+AVe6JYB27dgmgjALjLQOKHFoG3cSEEMfg@mail.gmail.com>

[AMD Public Use]

>> I was just to be consistent with what we did for carrizo/stoney.  I can return an error if you prefer.
Since they support GFXOFF (or 0 %),  personally error is preferrable to reporting 50% activity.

Thanks,
Lijo

-----Original Message-----
From: Alex Deucher <alexdeucher@gmail.com> 
Sent: Wednesday, March 10, 2021 9:47 PM
To: Lazar, Lijo <Lijo.Lazar@amd.com>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query

On Wed, Mar 10, 2021 at 3:25 AM Lazar, Lijo <Lijo.Lazar@amd.com> wrote:
>
> [AMD Public Use]
>
>
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of 
> Alex Deucher
> Sent: Wednesday, March 10, 2021 9:42 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy 
> query
>
> Was added in newer versions of the firmware.  Add support for it.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h         |  1 +
>  .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c  | 30 
> ++++++++++++++++++-
>  2 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h 
> b/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
> index 4c7e08ba5fa4..171f12b82716 100644
> --- a/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
> +++ b/drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h
> @@ -84,6 +84,7 @@
>  #define PPSMC_MSG_PowerGateMmHub                0x35
>  #define PPSMC_MSG_SetRccPfcPmeRestoreRegister   0x36
>  #define PPSMC_MSG_GpuChangeState                0x37
> +#define PPSMC_MSG_GetGfxBusy                    0x3D
>  #define PPSMC_Message_Count                     0x42
>
>  typedef uint16_t PPSMC_Result;
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c 
> b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> index c932b632ddd4..52fcdec738e9 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> @@ -1261,9 +1261,21 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
>                           void *value, int *size)  {
>         struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
> -       uint32_t sclk, mclk;
> +       struct amdgpu_device *adev = hwmgr->adev;
> +       uint32_t sclk, mclk, activity_percent;
> +       bool has_gfx_busy;
>         int ret = 0;
>
> +       /* GetGfxBusy support was added on RV SMU FW 30.85.00 and PCO 4.30.59 */
> +       if ((adev->apu_flags & AMD_APU_IS_PICASSO) &&
> +           (hwmgr->smu_version >= 0x41e3b))
> +               has_gfx_busy = true;
> +       else if ((adev->apu_flags & AMD_APU_IS_RAVEN) &&
> +                (hwmgr->smu_version >= 0x1e5500))
> +               has_gfx_busy = true;
> +       else
> +               has_gfx_busy = false;
> +
>         switch (idx) {
>         case AMDGPU_PP_SENSOR_GFX_SCLK:
>                 smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetGfxclkFrequency, &sclk); @@ -1284,6 +1296,22 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
>                 *(uint32_t *)value =  smu10_data->vcn_power_gated ? 0 : 1;
>                 *size = 4;
>                 break;
> +       case AMDGPU_PP_SENSOR_GPU_LOAD:
> +               if (has_gfx_busy) {
> +                       ret = smum_send_msg_to_smc(hwmgr,
> +                                                  PPSMC_MSG_GetGfxBusy,
> +                                                  &activity_percent);
> +                       if (!ret) {
> +                               activity_percent = activity_percent > 100 ? 100 : activity_percent;
> +                       } else {
> +                               activity_percent = 50;
>
> <> Why this is assumed? Isn't this as good as not supported?

I was just to be consistent with what we did for carrizo/stoney.  I can return an error if you prefer.

Alex


>
> Thanks,
> Lijo
>
> +                       }
> +                       *((uint32_t *)value) = activity_percent;
> +                       return 0;
> +               } else {
> +                       return -EOPNOTSUPP;
> +               }
> +               break;
>         default:
>                 ret = -EOPNOTSUPP;
>                 break;
> --
> 2.29.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CLi
> jo.Lazar%40amd.com%7C28ef84f65ef9493a458608d8e3e000d4%7C3dd8961fe4884e
> 608e11a82d994e183d%7C0%7C0%7C637509898542174621%7CUnknown%7CTWFpbGZsb3
> d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
> C1000&amp;sdata=ndOr1uoQSRjph%2F%2F07aa0fU%2Ft4oMBboTuu8rjRr3fnfY%3D&a
> mp;reserved=0 _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CLi
> jo.Lazar%40amd.com%7C28ef84f65ef9493a458608d8e3e000d4%7C3dd8961fe4884e
> 608e11a82d994e183d%7C0%7C0%7C637509898542174621%7CUnknown%7CTWFpbGZsb3
> d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
> C1000&amp;sdata=ndOr1uoQSRjph%2F%2F07aa0fU%2Ft4oMBboTuu8rjRr3fnfY%3D&a
> mp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      reply	other threads:[~2021-03-10 16:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  4:11 [PATCH] drm/amdgpu/powerplay/smu10: add support for gpu busy query Alex Deucher
2021-03-10  5:09 ` Chen, Guchun
2021-03-10  7:40 ` Quan, Evan
2021-03-10  9:51   ` S, Shirish
2021-03-10  8:25 ` Lazar, Lijo
2021-03-10 16:17   ` Alex Deucher
2021-03-10 16:28     ` Lazar, Lijo [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=MN2PR12MB45497227E152D0CE43A4D88097919@MN2PR12MB4549.namprd12.prod.outlook.com \
    --to=lijo.lazar@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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.