All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
Cc: "Fu, Ping" <Ping.Fu-5C7GfCeVMHo@public.gmane.org>,
	"Mao, David" <David.Mao-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"Deucher,
	Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
	"Zhu, Rex" <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>,
	Hawking Zhang <hawking.zhang-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: show gfx clock gating status to user
Date: Wed, 4 Jan 2017 12:39:33 -0500	[thread overview]
Message-ID: <CADnq5_OaHsiSDgUNNkG_79MubbCoDDPh30MG25XsBjYzhEOUqw@mail.gmail.com> (raw)
In-Reply-To: <20170104065232.GA22326@hr-amur2>

On Wed, Jan 4, 2017 at 1:52 AM, Huang Rui <ray.huang@amd.com> wrote:
> On Wed, Jan 04, 2017 at 10:21:44AM +0800, Huang Rui wrote:
>> On Tue, Jan 03, 2017 at 11:02:09PM +0800, Deucher, Alexander wrote:
>> > > -----Original Message-----
>> > > From: Huang Rui [mailto:ray.huang@amd.com]
>> > > Sent: Tuesday, January 03, 2017 5:47 AM
>> > > To: Deucher, Alexander; amd-gfx@lists.freedesktop.org
>> > > Cc: Zhu, Rex; Mao, David; Fu, Ping; Huang, Ray
>> > > Subject: [PATCH] drm/amdgpu: show gfx clock gating status to user
>> > >
>> > > Signed-off-by: Huang Rui <ray.huang@amd.com>
>> > > ---
>> > >  drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 +
>> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 +++++
>> > >  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c  | 2 ++
>> > >  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 2 ++
>> > >  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 3 +++
>> > >  5 files changed, 13 insertions(+)
>> > >
>> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> > > index 96eeea7..989d311 100644
>> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> > > @@ -1033,6 +1033,7 @@ struct amdgpu_gfx {
>> > >   struct amdgpu_irq_src           priv_inst_irq;
>> > >   /* gfx status */
>> > >   uint32_t                        gfx_current_status;
>> > > + bool                            cg_enabled;
>> > >   /* ce ram size*/
>> > >   unsigned                        ce_ram_size;
>> > >   struct amdgpu_cu_info           cu_info;
>> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> > > index a7c7657..10f2eab 100644
>> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> > > @@ -1543,6 +1543,11 @@ static int amdgpu_debugfs_pm_info(struct
>> > > seq_file *m, void *data)
>> > >   struct amdgpu_device *adev = dev->dev_private;
>> > >   struct drm_device *ddev = adev->ddev;
>> > >
>> > > + if (adev->gfx.cg_enabled)
>> > > +         seq_printf(m, "GFX Clock Gating: Enabled\n");
>> > > + else
>> > > +         seq_printf(m, "GFX Clock Gating: Disabled\n");
>> > > +
>> >
>> >
>> > I think it would be better to print the cg_flags and pg_flags (both as a mask and in human readable form) so we know exactly cg and pg features are enabled.
>> >
>>
>> It's probable better. Let me revise this patch and send it later.
>>
>
> Hi Alex,
>
> There is one issue on tonga, polaris10, and polaris11, they use smu to
> control clock gating. And flags are below, not use adev->cg_flags. It
> cannot indicate clock gating status from adev->cg_flags and the
> cg_flags/pg_flags is marked supported state by HW, not runtime enablement state:
>
> #define PP_STATE_CG             0x01
> #define PP_STATE_LS             0x02
> #define PP_STATE_DS             0x04
> #define PP_STATE_SD             0x08
> #define PP_STATE_SUPPORT_CG     0x10
> #define PP_STATE_SUPPORT_LS     0x20
> #define PP_STATE_SUPPORT_DS     0x40
> #define PP_STATE_SUPPORT_SD     0x80
>
> I think shall we combine them with AMD_CG_SUPPORT_GFX_MGCG and etc.?
> Try to find unified flags to control clock gating and power gating...

I think we can still stick to the cg_flags.  The smu cg control
messages are derived from the cg_flags, they are just more coarse
grained.  cg_flags indicated the supported state, but unless there is
a problem, the driver will attempt to enable all of the features set
in cg_flags so we can use cg_flags for enablement as well.  For
tracking purposes, just add adev->cg_enabled and pg_enabled and set
the bits in the clockgating and powergating IP functions based on the
current state.  While some blocks are static, GFX supports automatic
clockgating so it's unless you've specifically disabled it, it's
enabled dynamically.  If you really want the current status, you'll
need to read the gfx cg status registers to check the current clock
state.

Alex
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2017-01-04 17:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 10:47 [PATCH] drm/amdgpu: show gfx clock gating status to user Huang Rui
     [not found] ` <1483440426-22080-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-01-03 15:02   ` Deucher, Alexander
     [not found]     ` <BN6PR12MB1652A908E7D3DAD0302D6217F76E0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-04  2:21       ` Huang Rui
2017-01-04  6:52         ` Huang Rui
2017-01-04 17:39           ` Alex Deucher [this message]
2017-01-05  3:33         ` Zhu, Rex
2017-01-05  4:27         ` Zhu, Rex

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_OaHsiSDgUNNkG_79MubbCoDDPh30MG25XsBjYzhEOUqw@mail.gmail.com \
    --to=alexdeucher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=David.Mao-5C7GfCeVMHo@public.gmane.org \
    --cc=Ping.Fu-5C7GfCeVMHo@public.gmane.org \
    --cc=Rex.Zhu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hawking.zhang-5C7GfCeVMHo@public.gmane.org \
    --cc=ray.huang-5C7GfCeVMHo@public.gmane.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.