All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: Add get_gfx_off_status interface
@ 2022-07-21  8:57 shikai.guo
  2022-07-21 10:33 ` Lazar, Lijo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: shikai.guo @ 2022-07-21  8:57 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, prike.liang, evan.quan, Shikai Guo

From: Shikai Guo <Shikai.Guo@amd.com>

add get_gfx_off_status interface to yellow_carp_ppt_funcs structure.

Signed-off-by: Shikai Guo <shikai.guo@amd.com>
---
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
index 70cbc46341a3..2e39b629e7e6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
@@ -31,6 +31,7 @@
 #include "smu_v13_0_1_ppsmc.h"
 #include "smu_v13_0_1_pmfw.h"
 #include "smu_cmn.h"
+#include "asic_reg/smuio/smuio_13_0_2_offset.h"
 
 /*
  * DO NOT use these for err/warn/info/debug messages.
@@ -42,6 +43,9 @@
 #undef pr_info
 #undef pr_debug
 
+#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK		0x00000006L
+#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT			0x1
+
 #define FEATURE_MASK(feature) (1ULL << feature)
 #define SMC_DPM_FEATURE ( \
 	FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \
@@ -587,6 +591,31 @@ static ssize_t yellow_carp_get_gpu_metrics(struct smu_context *smu,
 	return sizeof(struct gpu_metrics_v2_1);
 }
 
+/**
+ * yellow_carp_get_gfxoff_status - get gfxoff status
+ *
+ * @smu: smu_context pointer
+ *
+ * This function will be used to get gfxoff status
+ *
+ * Returns 0=GFXOFF(default).
+ * Returns 1=Transition out of GFX State.
+ * Returns 2=Not in GFXOFF.
+ * Returns 3=Transition into GFXOFF.
+ */
+static uint32_t yellow_carp_get_gfxoff_status(struct smu_context *smu)
+{
+	uint32_t reg;
+	uint32_t gfxOff_Status = 0;
+	struct amdgpu_device *adev = smu->adev;
+
+	reg = RREG32_SOC15(SMUIO, 0, regSMUIO_GFX_MISC_CNTL);
+	gfxOff_Status = (reg & SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK)
+		>> SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT;
+
+	return gfxOff_Status;
+}
+
 static int yellow_carp_set_default_dpm_tables(struct smu_context *smu)
 {
 	struct smu_table_context *smu_table = &smu->smu_table;
@@ -1186,6 +1215,7 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = {
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_driver_table_location = smu_v13_0_set_driver_table_location,
 	.gfx_off_control = smu_v13_0_gfx_off_control,
+	.get_gfx_off_status = yellow_carp_get_gfxoff_status,
 	.post_init = yellow_carp_post_smu_init,
 	.mode2_reset = yellow_carp_mode2_reset,
 	.get_dpm_ultimate_freq = yellow_carp_get_dpm_ultimate_freq,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/pm: Add get_gfx_off_status interface
  2022-07-21  8:57 [PATCH] drm/amd/pm: Add get_gfx_off_status interface shikai.guo
@ 2022-07-21 10:33 ` Lazar, Lijo
  2022-07-21 13:10 ` André Almeida
  2022-07-22  1:37 ` Liu, Aaron
  2 siblings, 0 replies; 5+ messages in thread
From: Lazar, Lijo @ 2022-07-21 10:33 UTC (permalink / raw)
  To: shikai.guo, amd-gfx; +Cc: Alexander.Deucher, prike.liang, evan.quan



On 7/21/2022 2:27 PM, shikai.guo@amd.com wrote:
> From: Shikai Guo <Shikai.Guo@amd.com>
> 
> add get_gfx_off_status interface to yellow_carp_ppt_funcs structure.
> 
> Signed-off-by: Shikai Guo <shikai.guo@amd.com>
> ---
>   .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  | 30 +++++++++++++++++++
>   1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> index 70cbc46341a3..2e39b629e7e6 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> @@ -31,6 +31,7 @@
>   #include "smu_v13_0_1_ppsmc.h"
>   #include "smu_v13_0_1_pmfw.h"
>   #include "smu_cmn.h"
> +#include "asic_reg/smuio/smuio_13_0_2_offset.h"
>   
>   /*
>    * DO NOT use these for err/warn/info/debug messages.
> @@ -42,6 +43,9 @@
>   #undef pr_info
>   #undef pr_debug
>   
> +#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK		0x00000006L
> +#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT			0x1
> +
>   #define FEATURE_MASK(feature) (1ULL << feature)
>   #define SMC_DPM_FEATURE ( \
>   	FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \
> @@ -587,6 +591,31 @@ static ssize_t yellow_carp_get_gpu_metrics(struct smu_context *smu,
>   	return sizeof(struct gpu_metrics_v2_1);
>   }
>   
> +/**
> + * yellow_carp_get_gfxoff_status - get gfxoff status
> + *
> + * @smu: smu_context pointer
> + *
> + * This function will be used to get gfxoff status
> + *
> + * Returns 0=GFXOFF(default).
> + * Returns 1=Transition out of GFX State.
> + * Returns 2=Not in GFXOFF.
> + * Returns 3=Transition into GFXOFF.
> + */

This is a public API (amdgpu_dpm). Hope the final status is consistent 
with whatever is already defined for other ASICs.

> +static uint32_t yellow_carp_get_gfxoff_status(struct smu_context *smu)
> +{
> +	uint32_t reg;
> +	uint32_t gfxOff_Status = 0;

Mixed-case names are not part of coding style.

With that change
	Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>

Thanks,
Lijo

> +	struct amdgpu_device *adev = smu->adev;
> +
> +	reg = RREG32_SOC15(SMUIO, 0, regSMUIO_GFX_MISC_CNTL);
> +	gfxOff_Status = (reg & SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK)
> +		>> SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT;
> +
> +	return gfxOff_Status;
> +}
> +
>   static int yellow_carp_set_default_dpm_tables(struct smu_context *smu)
>   {
>   	struct smu_table_context *smu_table = &smu->smu_table;
> @@ -1186,6 +1215,7 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = {
>   	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
>   	.set_driver_table_location = smu_v13_0_set_driver_table_location,
>   	.gfx_off_control = smu_v13_0_gfx_off_control,
> +	.get_gfx_off_status = yellow_carp_get_gfxoff_status,
>   	.post_init = yellow_carp_post_smu_init,
>   	.mode2_reset = yellow_carp_mode2_reset,
>   	.get_dpm_ultimate_freq = yellow_carp_get_dpm_ultimate_freq,
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/pm: Add get_gfx_off_status interface
  2022-07-21  8:57 [PATCH] drm/amd/pm: Add get_gfx_off_status interface shikai.guo
  2022-07-21 10:33 ` Lazar, Lijo
@ 2022-07-21 13:10 ` André Almeida
  2022-07-25  3:08   ` Guo, Shikai
  2022-07-22  1:37 ` Liu, Aaron
  2 siblings, 1 reply; 5+ messages in thread
From: André Almeida @ 2022-07-21 13:10 UTC (permalink / raw)
  To: shikai.guo; +Cc: Alexander.Deucher, prike.liang, evan.quan, amd-gfx

Hi Shikai,

Could you change the commit message to

 drm/amd/pm: Add get_gfx_off_status interface for yellow carp

Otherwise, we are going to have duplicated commit messages for each new
architecture supporting get_gfx_off_status.

Also, giving that this is the second version of your patch, the subject
should be [PATCH v2], and the patch should contain a changelog compared
to the previous patch version.

Às 05:57 de 21/07/22, shikai.guo@amd.com escreveu:
> From: Shikai Guo <Shikai.Guo@amd.com>
> 
> add get_gfx_off_status interface to yellow_carp_ppt_funcs structure.
> 
> Signed-off-by: Shikai Guo <shikai.guo@amd.com>


Thanks,
	André

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] drm/amd/pm: Add get_gfx_off_status interface
  2022-07-21  8:57 [PATCH] drm/amd/pm: Add get_gfx_off_status interface shikai.guo
  2022-07-21 10:33 ` Lazar, Lijo
  2022-07-21 13:10 ` André Almeida
@ 2022-07-22  1:37 ` Liu, Aaron
  2 siblings, 0 replies; 5+ messages in thread
From: Liu, Aaron @ 2022-07-22  1:37 UTC (permalink / raw)
  To: Guo, Shikai, amd-gfx
  Cc: Deucher, Alexander, Liang, Prike, Quan, Evan, Guo, Shikai

[AMD Official Use Only - General]

Shikai,

Yellow carp's SMUIO is 13_0_1. 
#define regSMUIO_GFX_MISC_CNTL                                                                          0x00c5

This register in your patch is from smuio_13_0_2_offset.h and this register's value is different to 13_0_1.
#define regSMUIO_GFX_MISC_CNTL                                                                          0x00d1


> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> shikai.guo@amd.com
> Sent: Thursday, July 21, 2022 4:58 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Liang, Prike
> <Prike.Liang@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Guo, Shikai
> <Shikai.Guo@amd.com>
> Subject: [PATCH] drm/amd/pm: Add get_gfx_off_status interface
> 
> From: Shikai Guo <Shikai.Guo@amd.com>
> 
> add get_gfx_off_status interface to yellow_carp_ppt_funcs structure.
> 
> Signed-off-by: Shikai Guo <shikai.guo@amd.com>
> ---
>  .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  | 30
> +++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> index 70cbc46341a3..2e39b629e7e6 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> @@ -31,6 +31,7 @@
>  #include "smu_v13_0_1_ppsmc.h"
>  #include "smu_v13_0_1_pmfw.h"
>  #include "smu_cmn.h"
> +#include "asic_reg/smuio/smuio_13_0_2_offset.h"
> 
>  /*
>   * DO NOT use these for err/warn/info/debug messages.
> @@ -42,6 +43,9 @@
>  #undef pr_info
>  #undef pr_debug
> 
> +#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK
> 	0x00000006L
> +#define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT
> 		0x1
> +
>  #define FEATURE_MASK(feature) (1ULL << feature)  #define
> SMC_DPM_FEATURE ( \
>  	FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \ @@ -587,6 +591,31
> @@ static ssize_t yellow_carp_get_gpu_metrics(struct smu_context *smu,
>  	return sizeof(struct gpu_metrics_v2_1);  }
> 
> +/**
> + * yellow_carp_get_gfxoff_status - get gfxoff status
> + *
> + * @smu: smu_context pointer
> + *
> + * This function will be used to get gfxoff status
> + *
> + * Returns 0=GFXOFF(default).
> + * Returns 1=Transition out of GFX State.
> + * Returns 2=Not in GFXOFF.
> + * Returns 3=Transition into GFXOFF.
> + */
> +static uint32_t yellow_carp_get_gfxoff_status(struct smu_context *smu)
> +{
> +	uint32_t reg;
> +	uint32_t gfxOff_Status = 0;
> +	struct amdgpu_device *adev = smu->adev;
> +
> +	reg = RREG32_SOC15(SMUIO, 0, regSMUIO_GFX_MISC_CNTL);
> +	gfxOff_Status = (reg &
> SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK)
> +		>> SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT;
> +
> +	return gfxOff_Status;
> +}
> +
>  static int yellow_carp_set_default_dpm_tables(struct smu_context *smu)  {
>  	struct smu_table_context *smu_table = &smu->smu_table; @@ -
> 1186,6 +1215,7 @@ static const struct pptable_funcs yellow_carp_ppt_funcs
> = {
>  	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
>  	.set_driver_table_location = smu_v13_0_set_driver_table_location,
>  	.gfx_off_control = smu_v13_0_gfx_off_control,
> +	.get_gfx_off_status = yellow_carp_get_gfxoff_status,
>  	.post_init = yellow_carp_post_smu_init,
>  	.mode2_reset = yellow_carp_mode2_reset,
>  	.get_dpm_ultimate_freq = yellow_carp_get_dpm_ultimate_freq,
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] drm/amd/pm: Add get_gfx_off_status interface
  2022-07-21 13:10 ` André Almeida
@ 2022-07-25  3:08   ` Guo, Shikai
  0 siblings, 0 replies; 5+ messages in thread
From: Guo, Shikai @ 2022-07-25  3:08 UTC (permalink / raw)
  To: André Almeida; +Cc: Deucher, Alexander, Liang, Prike, Quan, Evan, amd-gfx

[AMD Official Use Only - General]


Thanks comment, I will change it.
-----Original Message-----
From: André Almeida <andrealmeid@igalia.com> 
Sent: Thursday, July 21, 2022 9:11 PM
To: Guo, Shikai <Shikai.Guo@amd.com>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org; Liang, Prike <Prike.Liang@amd.com>; Quan, Evan <Evan.Quan@amd.com>
Subject: Re: [PATCH] drm/amd/pm: Add get_gfx_off_status interface

Hi Shikai,

Could you change the commit message to

 drm/amd/pm: Add get_gfx_off_status interface for yellow carp

Otherwise, we are going to have duplicated commit messages for each new architecture supporting get_gfx_off_status.

Also, giving that this is the second version of your patch, the subject should be [PATCH v2], and the patch should contain a changelog compared to the previous patch version.

Às 05:57 de 21/07/22, shikai.guo@amd.com escreveu:
> From: Shikai Guo <Shikai.Guo@amd.com>
> 
> add get_gfx_off_status interface to yellow_carp_ppt_funcs structure.
> 
> Signed-off-by: Shikai Guo <shikai.guo@amd.com>


Thanks,
	André

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-25  3:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  8:57 [PATCH] drm/amd/pm: Add get_gfx_off_status interface shikai.guo
2022-07-21 10:33 ` Lazar, Lijo
2022-07-21 13:10 ` André Almeida
2022-07-25  3:08   ` Guo, Shikai
2022-07-22  1:37 ` Liu, Aaron

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.