[2/2] drm/amd/powerplay: add arcturus_is_dpm_running function for arcturus

Submitted by Gui, Jack on Aug. 12, 2019, 8:22 a.m.

Details

Message ID 1565598138-13844-2-git-send-email-Jack.Gui@amd.com
State Accepted
Commit 3f513baef6c437ae1ae7927c74b693b1d268f130
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Gui, Jack Aug. 12, 2019, 8:22 a.m.
add arcturus_is_dpm_running function

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 03ce871..9107beb 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -51,6 +51,15 @@ 
 #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000
 #define SMU_FEATURES_HIGH_SHIFT      32
 
+#define SMC_DPM_FEATURE ( \
+	FEATURE_DPM_PREFETCHER_MASK | \
+	FEATURE_DPM_GFXCLK_MASK | \
+	FEATURE_DPM_UCLK_MASK | \
+	FEATURE_DPM_SOCCLK_MASK | \
+	FEATURE_DPM_MP0CLK_MASK | \
+	FEATURE_DPM_FCLK_MASK | \
+	FEATURE_DPM_XGMI_MASK)
+
 /* possible frequency drift (1Mhz) */
 #define EPSILON				1
 
@@ -1873,6 +1882,17 @@  static void arcturus_dump_pptable(struct smu_context *smu)
 
 }
 
+static bool arcturus_is_dpm_running(struct smu_context *smu)
+{
+	int ret = 0;
+	uint32_t feature_mask[2];
+	unsigned long feature_enabled;
+	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
+	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
+			   ((uint64_t)feature_mask[1] << 32));
+	return !!(feature_enabled & SMC_DPM_FEATURE);
+}
+
 static const struct pptable_funcs arcturus_ppt_funcs = {
 	/* translate smu index into arcturus specific index */
 	.get_smu_msg_index = arcturus_get_smu_msg_index,
@@ -1910,6 +1930,7 @@  static const struct pptable_funcs arcturus_ppt_funcs = {
 	/* debug (internal used) */
 	.dump_pptable = arcturus_dump_pptable,
 	.get_power_limit = arcturus_get_power_limit,
+	.is_dpm_running = arcturus_is_dpm_running,
 };
 
 void arcturus_set_ppt_funcs(struct smu_context *smu)

Comments

Reviewed-by: Kevin Wang <kevin1.wang@amd.com>


On 8/12/19 4:22 PM, Chengming Gui wrote:
> add arcturus_is_dpm_running function

>

> Signed-off-by: Chengming Gui <Jack.Gui@amd.com>

> ---

>   drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21 +++++++++++++++++++++

>   1 file changed, 21 insertions(+)

>

> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> index 03ce871..9107beb 100644

> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> @@ -51,6 +51,15 @@

>   #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000

>   #define SMU_FEATURES_HIGH_SHIFT      32

>   

> +#define SMC_DPM_FEATURE ( \

> +	FEATURE_DPM_PREFETCHER_MASK | \

> +	FEATURE_DPM_GFXCLK_MASK | \

> +	FEATURE_DPM_UCLK_MASK | \

> +	FEATURE_DPM_SOCCLK_MASK | \

> +	FEATURE_DPM_MP0CLK_MASK | \

> +	FEATURE_DPM_FCLK_MASK | \

> +	FEATURE_DPM_XGMI_MASK)

> +

>   /* possible frequency drift (1Mhz) */

>   #define EPSILON				1

>   

> @@ -1873,6 +1882,17 @@ static void arcturus_dump_pptable(struct smu_context *smu)

>   

>   }

>   

> +static bool arcturus_is_dpm_running(struct smu_context *smu)

> +{

> +	int ret = 0;

> +	uint32_t feature_mask[2];

> +	unsigned long feature_enabled;

> +	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

> +	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |

> +			   ((uint64_t)feature_mask[1] << 32));

> +	return !!(feature_enabled & SMC_DPM_FEATURE);

> +}

> +

>   static const struct pptable_funcs arcturus_ppt_funcs = {

>   	/* translate smu index into arcturus specific index */

>   	.get_smu_msg_index = arcturus_get_smu_msg_index,

> @@ -1910,6 +1930,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {

>   	/* debug (internal used) */

>   	.dump_pptable = arcturus_dump_pptable,

>   	.get_power_limit = arcturus_get_power_limit,

> +	.is_dpm_running = arcturus_is_dpm_running,

>   };

>   

>   void arcturus_set_ppt_funcs(struct smu_context *smu)
Please set FEATURE_DPM_PREFETCHER_MASK | FEATURE_DPM_GFXCLK_MASK only. For now, only these two are enabled on arcturus.

With that fixed, the patch is reviewed-by: Evan Quan <evan.quan@amd.com>
> -----Original Message-----

> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of

> Chengming Gui

> Sent: Monday, August 12, 2019 4:22 PM

> To: amd-gfx@lists.freedesktop.org

> Cc: Gui, Jack <Jack.Gui@amd.com>

> Subject: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running

> function for arcturus

> 

> add arcturus_is_dpm_running function

> 

> Signed-off-by: Chengming Gui <Jack.Gui@amd.com>

> ---

>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21

> +++++++++++++++++++++

>  1 file changed, 21 insertions(+)

> 

> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> index 03ce871..9107beb 100644

> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> @@ -51,6 +51,15 @@

>  #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000

>  #define SMU_FEATURES_HIGH_SHIFT      32

> 

> +#define SMC_DPM_FEATURE ( \

> +	FEATURE_DPM_PREFETCHER_MASK | \

> +	FEATURE_DPM_GFXCLK_MASK | \

> +	FEATURE_DPM_UCLK_MASK | \

> +	FEATURE_DPM_SOCCLK_MASK | \

> +	FEATURE_DPM_MP0CLK_MASK | \

> +	FEATURE_DPM_FCLK_MASK | \

> +	FEATURE_DPM_XGMI_MASK)

> +

>  /* possible frequency drift (1Mhz) */

>  #define EPSILON				1

> 

> @@ -1873,6 +1882,17 @@ static void arcturus_dump_pptable(struct

> smu_context *smu)

> 

>  }

> 

> +static bool arcturus_is_dpm_running(struct smu_context *smu) {

> +	int ret = 0;

> +	uint32_t feature_mask[2];

> +	unsigned long feature_enabled;

> +	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

> +	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |

> +			   ((uint64_t)feature_mask[1] << 32));

> +	return !!(feature_enabled & SMC_DPM_FEATURE); }

> +

>  static const struct pptable_funcs arcturus_ppt_funcs = {

>  	/* translate smu index into arcturus specific index */

>  	.get_smu_msg_index = arcturus_get_smu_msg_index, @@ -1910,6

> +1930,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {

>  	/* debug (internal used) */

>  	.dump_pptable = arcturus_dump_pptable,

>  	.get_power_limit = arcturus_get_power_limit,

> +	.is_dpm_running = arcturus_is_dpm_running,

>  };

> 

>  void arcturus_set_ppt_funcs(struct smu_context *smu)

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi Evan,

All supported feature can be set there, 
Anyone of these features is running, we can judge dpm is running.  

BR,
Jack Gui

-----Original Message-----
From: Quan, Evan <Evan.Quan@amd.com> 

Sent: Monday, August 12, 2019 5:39 PM
To: Gui, Jack <Jack.Gui@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Gui, Jack <Jack.Gui@amd.com>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running function for arcturus

Please set FEATURE_DPM_PREFETCHER_MASK | FEATURE_DPM_GFXCLK_MASK only. For now, only these two are enabled on arcturus.

With that fixed, the patch is reviewed-by: Evan Quan <evan.quan@amd.com>
> -----Original Message-----

> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of 

> Chengming Gui

> Sent: Monday, August 12, 2019 4:22 PM

> To: amd-gfx@lists.freedesktop.org

> Cc: Gui, Jack <Jack.Gui@amd.com>

> Subject: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running 

> function for arcturus

> 

> add arcturus_is_dpm_running function

> 

> Signed-off-by: Chengming Gui <Jack.Gui@amd.com>

> ---

>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21

> +++++++++++++++++++++

>  1 file changed, 21 insertions(+)

> 

> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> index 03ce871..9107beb 100644

> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> @@ -51,6 +51,15 @@

>  #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000

>  #define SMU_FEATURES_HIGH_SHIFT      32

> 

> +#define SMC_DPM_FEATURE ( \

> +	FEATURE_DPM_PREFETCHER_MASK | \

> +	FEATURE_DPM_GFXCLK_MASK | \

> +	FEATURE_DPM_UCLK_MASK | \

> +	FEATURE_DPM_SOCCLK_MASK | \

> +	FEATURE_DPM_MP0CLK_MASK | \

> +	FEATURE_DPM_FCLK_MASK | \

> +	FEATURE_DPM_XGMI_MASK)

> +

>  /* possible frequency drift (1Mhz) */

>  #define EPSILON				1

> 

> @@ -1873,6 +1882,17 @@ static void arcturus_dump_pptable(struct 

> smu_context *smu)

> 

>  }

> 

> +static bool arcturus_is_dpm_running(struct smu_context *smu) {

> +	int ret = 0;

> +	uint32_t feature_mask[2];

> +	unsigned long feature_enabled;

> +	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

> +	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |

> +			   ((uint64_t)feature_mask[1] << 32));

> +	return !!(feature_enabled & SMC_DPM_FEATURE); }

> +

>  static const struct pptable_funcs arcturus_ppt_funcs = {

>  	/* translate smu index into arcturus specific index */

>  	.get_smu_msg_index = arcturus_get_smu_msg_index, @@ -1910,6

> +1930,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {

>  	/* debug (internal used) */

>  	.dump_pptable = arcturus_dump_pptable,

>  	.get_power_limit = arcturus_get_power_limit,

> +	.is_dpm_running = arcturus_is_dpm_running,

>  };

> 

>  void arcturus_set_ppt_funcs(struct smu_context *smu)

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

OK, I see. That will be fine.

Regards,
Evan

> -----Original Message-----

> From: Gui, Jack <Jack.Gui@amd.com>

> Sent: Monday, August 12, 2019 5:51 PM

> To: Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org

> Subject: RE: [PATCH 2/2] drm/amd/powerplay: add

> arcturus_is_dpm_running function for arcturus

> 

> Hi Evan,

> 

> All supported feature can be set there, Anyone of these features is running,

> we can judge dpm is running.

> 

> BR,

> Jack Gui

> 

> -----Original Message-----

> From: Quan, Evan <Evan.Quan@amd.com>

> Sent: Monday, August 12, 2019 5:39 PM

> To: Gui, Jack <Jack.Gui@amd.com>; amd-gfx@lists.freedesktop.org

> Cc: Gui, Jack <Jack.Gui@amd.com>

> Subject: RE: [PATCH 2/2] drm/amd/powerplay: add

> arcturus_is_dpm_running function for arcturus

> 

> Please set FEATURE_DPM_PREFETCHER_MASK |

> FEATURE_DPM_GFXCLK_MASK only. For now, only these two are enabled

> on arcturus.

> 

> With that fixed, the patch is reviewed-by: Evan Quan <evan.quan@amd.com>

> > -----Original Message-----

> > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of

> > Chengming Gui

> > Sent: Monday, August 12, 2019 4:22 PM

> > To: amd-gfx@lists.freedesktop.org

> > Cc: Gui, Jack <Jack.Gui@amd.com>

> > Subject: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running

> > function for arcturus

> >

> > add arcturus_is_dpm_running function

> >

> > Signed-off-by: Chengming Gui <Jack.Gui@amd.com>

> > ---

> >  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21

> > +++++++++++++++++++++

> >  1 file changed, 21 insertions(+)

> >

> > diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> > b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> > index 03ce871..9107beb 100644

> > --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> > +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

> > @@ -51,6 +51,15 @@

> >  #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000

> >  #define SMU_FEATURES_HIGH_SHIFT      32

> >

> > +#define SMC_DPM_FEATURE ( \

> > +	FEATURE_DPM_PREFETCHER_MASK | \

> > +	FEATURE_DPM_GFXCLK_MASK | \

> > +	FEATURE_DPM_UCLK_MASK | \

> > +	FEATURE_DPM_SOCCLK_MASK | \

> > +	FEATURE_DPM_MP0CLK_MASK | \

> > +	FEATURE_DPM_FCLK_MASK | \

> > +	FEATURE_DPM_XGMI_MASK)

> > +

> >  /* possible frequency drift (1Mhz) */

> >  #define EPSILON				1

> >

> > @@ -1873,6 +1882,17 @@ static void arcturus_dump_pptable(struct

> > smu_context *smu)

> >

> >  }

> >

> > +static bool arcturus_is_dpm_running(struct smu_context *smu) {

> > +	int ret = 0;

> > +	uint32_t feature_mask[2];

> > +	unsigned long feature_enabled;

> > +	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

> > +	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |

> > +			   ((uint64_t)feature_mask[1] << 32));

> > +	return !!(feature_enabled & SMC_DPM_FEATURE); }

> > +

> >  static const struct pptable_funcs arcturus_ppt_funcs = {

> >  	/* translate smu index into arcturus specific index */

> >  	.get_smu_msg_index = arcturus_get_smu_msg_index, @@ -1910,6

> > +1930,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {

> >  	/* debug (internal used) */

> >  	.dump_pptable = arcturus_dump_pptable,

> >  	.get_power_limit = arcturus_get_power_limit,

> > +	.is_dpm_running = arcturus_is_dpm_running,

> >  };

> >

> >  void arcturus_set_ppt_funcs(struct smu_context *smu)

> > --

> > 2.7.4

> >

> > _______________________________________________

> > amd-gfx mailing list

> > amd-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx