Skip to contentSkip to conversation

drm/amd/powerplay: correct SW smu11 thermal range settings

PATCH In review Evan Quan 3 participants 10 messages Aug 16, 2019 – Aug 20, 2019 9 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
 	return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-	{-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-	{ 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
 						struct smu_temperature_range *range)
 {
-
 	PPTable_t *pptable = smu->smu_table.driver_pptable;
 
 	if (!range)
 		return -EINVAL;
 
-	memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
 	range->max = pptable->TedgeLimit *
 		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 	range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
 	range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
 		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
 	return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
 	[profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+	{-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+	{ 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
 	int	valid_mapping;
 	int	map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
 	if (!range || !powerplay_table)
 		return -EINVAL;
 
-	/* The unit is temperature */
-	range->min = 0;
-	range->max = powerplay_table->software_shutdown_temp;
+	range->max = powerplay_table->software_shutdown_temp *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 	return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
 	if (!range || !powerplay_table)
 		return -EINVAL;
 
-	/* The unit is temperature */
-	range->min = 0;
-	range->max = powerplay_table->usSoftwareShutdownTemp;
-	range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-	range->hotspot_crit_max = pptable->ThotspotLimit;
-	range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-	range->mem_crit_max = pptable->ThbmLimit;
-	range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+	range->max = powerplay_table->usSoftwareShutdownTemp *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	range->hotspot_crit_max = pptable->ThotspotLimit *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	range->mem_crit_max = pptable->ThbmLimit *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
 	return 0;
Signature · 6 lines
2.22.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Evan Quan <[email protected]>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected] <[email protected]>
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3296E3E1C79504DD56058410A2AF0-rweVpJHSKTqAm9ToKNQgFgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#4 lore raw

Comment inline

From: Wang, Kevin(Yang) <[email protected]>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case. All the existing and coming ASICs should follow this design.
and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. [Quan, Evan] That is still honored, no violation here.
so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344E88B19DF4DA83279BBF2E4A80-rweVpJHSKToDMgCC8P//[email protected]

#6 lore raw

Hi Evan,
So due to the below code, we don't get a chance to set -273.15, right?
+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]
Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case. All the existing and coming ASICs should follow this design.
and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. [Quan, Evan] That is still honored, no violation here.
so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB35981C5C1B0A12B8C8C1CD468EA80-rweVpJHSKTohWwLleUddgQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#8 lore raw

Yes, the lowest settings for thermal controller is 0.

Regards
Evan
From: Feng, Kenneth <[email protected]>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]>; Wang, Kevin(Yang) <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,
So due to the below code, we don't get a chance to set -273.15, right?
+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]
Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case. All the existing and coming ASICs should follow this design.
and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. [Quan, Evan] That is still honored, no violation here.
so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334468A94B93D7D848596611E4A80-rweVpJHSKToDMgCC8P//[email protected]

author
#10 lore raw

Ping..

From: Quan, Evan
Sent: Monday, August 19, 2019 1:27 PM
To: Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Yes, the lowest settings for thermal controller is 0.

Regards
Evan
From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,
So due to the below code, we don't get a chance to set -273.15, right?
+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]
Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case. All the existing and coming ASICs should follow this design.
and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. [Quan, Evan] That is still honored, no violation here.
so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334407D4ABFF5E4F1CC02518E4AB0-rweVpJHSKToDMgCC8P//[email protected]

Reviewed-by Kenneth Feng
#12 lore raw

From: Quan, Evan
Sent: Tuesday, August 20, 2019 10:10 AM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Ping..

From: Quan, Evan
Sent: Monday, August 19, 2019 1:27 PM
To: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Yes, the lowest settings for thermal controller is 0.

Regards
Evan
From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,
So due to the below code, we don't get a chance to set -273.15, right?
+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]
Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11. you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case. All the existing and coming ASICs should follow this design.
and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature. [Quan, Evan] That is still honored, no violation here.
so there is something wrong with this patch.

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3598713DC8A8803F63886E758EAB0-rweVpJHSKTohWwLleUddgQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Kenneth Feng
#14 lore raw

I don't recommend it.

each asic maybe has different thermal policy, you can custom this value in asic file <arcturus_ppt.c> . and your patch define a new array in smu_v11_0.h header file.
it's never done that before, and the code looks is not clearly.

Best Regards,
Kevin
________________________________
From: Feng, Kenneth <[email protected]>
Sent: Tuesday, August 20, 2019 10:51 AM
To: Quan, Evan <[email protected]>; [email protected] <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

From: Quan, Evan
Sent: Tuesday, August 20, 2019 10:10 AM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Ping..

From: Quan, Evan
Sent: Monday, August 19, 2019 1:27 PM
To: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Yes, the lowest settings for thermal controller is 0.

Regards

Evan

From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

So due to the below code, we don’t get a chance to set -273.15, right?

+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]

Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11.

you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case.

All the existing and coming ASICs should follow this design.

and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature.

[Quan, Evan] That is still honored, no violation here.

so there is something wrong with this patch.

Best Regards,
Kevin

________________________________

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3296F5F765F20B96B8B82F1EA2AB0-rweVpJHSKTqAm9ToKNQgFgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Reviewed-by Kenneth Feng
#16 lore raw

Hi Kevin,

smu11_thermal_policy provides the default thermal policy if the ASIC does not provide its own(e.g. Navi10). It's not ASIC specific.

Btw I think we should have enough information to provide Navi10's own settings(for temp2/3) in navi10_get_thermal_temperature_range(). Can you help to add them?

Please refer to the following descriptions for those thermal interfaces.

* - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius
* - temp2_input and temp3_input are supported on SOC15 dGPUs only
*
* - temp[1-3]_label: temperature channel label
* - temp2_label and temp3_label are supported on SOC15 dGPUs only
*
* - temp[1-3]_crit: temperature critical max value in millidegrees Celsius
* - temp2_crit and temp3_crit are supported on SOC15 dGPUs only
*
* - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius
* - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
*
* - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius
* - these are supported on SOC15 dGPUs only

Regards,
Evan
From: Wang, Kevin(Yang) <[email protected]>
Sent: Tuesday, August 20, 2019 1:44 PM
To: Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

I don't recommend it.

each asic maybe has different thermal policy, you can custom this value in asic file <arcturus_ppt.c> . and your patch define a new array in smu_v11_0.h header file.
it's never done that before, and the code looks is not clearly.

Best Regards,
Kevin
________________________________
From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 20, 2019 10:51 AM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

From: Quan, Evan
Sent: Tuesday, August 20, 2019 10:10 AM
To: [email protected]<mailto:[email protected]>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Ping..

From: Quan, Evan
Sent: Monday, August 19, 2019 1:27 PM
To: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Yes, the lowest settings for thermal controller is 0.

Regards

Evan

From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

So due to the below code, we don't get a chance to set -273.15, right?

+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]

Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11.

you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case.

All the existing and coming ASICs should follow this design.

and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature.

[Quan, Evan] That is still honored, no violation here.

so there is something wrong with this patch.

Best Regards,
Kevin

________________________________

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN8PR12MB3329E1BF400EDECDCBDB70F2E4AB0-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Kenneth Feng
#18 lore raw

Hi Evan,

thank you for explaining this background reason. you want to support more hwmon sensor in smu driver. but in this patch, I have a few different opinions

1. could you move smu11_thermal_policy from smu_11_0.h to smu_v11_0.c, i think shouldn't define any data in header file.
2. +static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+ {-273150, 99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+ { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000}, //not used in this patch, why do you want to do?
+};
3. the smu driver will use 0 as min temperature to set hardware register, but it will show 273.15 as min value. in hwmon sensor
I think there is something wrong with this.
4. memcpy(&range, &smu11_thermal_policy[0], sizeof(struct smu_temperature_range));
although I know the meaning of this code, but I think this is not very good.

Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Tuesday, August 20, 2019 2:50 PM
To: Wang, Kevin(Yang) <[email protected]>; Feng, Kenneth <[email protected]>; [email protected] <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Kevin,

smu11_thermal_policy provides the default thermal policy if the ASIC does not provide its own(e.g. Navi10). It’s not ASIC specific.

Btw I think we should have enough information to provide Navi10’s own settings(for temp2/3) in navi10_get_thermal_temperature_range().

Can you help to add them?

Please refer to the following descriptions for those thermal interfaces.

* - temp[1-3]_input: the on die GPU temperature in millidegrees Celsius

* - temp2_input and temp3_input are supported on SOC15 dGPUs only

*

* - temp[1-3]_label: temperature channel label

* - temp2_label and temp3_label are supported on SOC15 dGPUs only

*

* - temp[1-3]_crit: temperature critical max value in millidegrees Celsius

* - temp2_crit and temp3_crit are supported on SOC15 dGPUs only

*

* - temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius

* - temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only

*

* - temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius

* - these are supported on SOC15 dGPUs only

Regards,

Evan

From: Wang, Kevin(Yang) <[email protected]>
Sent: Tuesday, August 20, 2019 1:44 PM
To: Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

I don't recommend it.

each asic maybe has different thermal policy, you can custom this value in asic file <arcturus_ppt.c> .

and your patch define a new array in smu_v11_0.h header file.

it's never done that before, and the code looks is not clearly.

Best Regards,
Kevin

________________________________

From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 20, 2019 10:51 AM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

From: Quan, Evan
Sent: Tuesday, August 20, 2019 10:10 AM
To: [email protected]<mailto:[email protected]>
Cc: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Ping..

From: Quan, Evan
Sent: Monday, August 19, 2019 1:27 PM
To: Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Yes, the lowest settings for thermal controller is 0.

Regards

Evan

From: Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, August 19, 2019 1:12 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

So due to the below code, we don’t get a chance to set -273.15, right?

+ low = max(SMU_THERMAL_MINIMUM_ALERT_TEMP,
+ range.min / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);
+ high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+ range.max / SMU_TEMPERATURE_UNITS_PER_CENTIGRADES);

From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Quan, Evan
Sent: Monday, August 19, 2019 10:16 AM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

[CAUTION: External Email]

Comment inline

From: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 7:04 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Hi Evan,

the temperature min value should be 0, not -273 on smu11.

you can refrence window driver code or register spec.

        output_ptr->operating_temperature_min_Limit = 0;
        output_ptr->operating_temperature_max_Limit = ppt_info->software_shutdown_temp;

[Quan, Evan] There was a discussion over the min value(0 or -273.15) and we decided to use the later considering the OD case.

All the existing and coming ASICs should follow this design.

and in smu11, the thermal control has a 8bit register to set min and max value, and the unit is temperature.

[Quan, Evan] That is still honored, no violation here.

so there is something wrong with this patch.

Best Regards,
Kevin

________________________________

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Evan Quan <[email protected]<mailto:[email protected]>>
Sent: Friday, August 16, 2019 5:31 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/powerplay: correct SW smu11 thermal range settings

Problems with current settings:
1. The min value was overrided to 0 on Vega20 & Navi10. While the expected should be -273.15 C.
2. The thermal min/max threshold was output in wrong unit on Navi10 & Arcturus. As TEMP_RANGE_MIN/MAX is already in millicelsius. And "*1000" in smu_v11_0_start_thermal_control makes the output wrongly.

Change-Id I2f1866edd1baf264f521310343f492eaede26c33
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 10 ----
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  6 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    |  5 +-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 51 +++++++------------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c    | 20 +++++---
 5 files changed, 38 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -10
index 4060607fbb35..1a1f64a9e1e0 100644
@@ -880,23 +880,14 @@ static int arcturus_force_clk_levels(struct smu_context *smu,
         return ret;
 }
 
-static const struct smu_temperature_range arcturus_thermal_policy[] =
-{
-       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
-       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
-};
-
 static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                                                 struct smu_temperature_range *range)
 {
-
         PPTable_t *pptable = smu->smu_table.driver_pptable;
 
         if (!range)
                 return -EINVAL;
 
-       memcpy(range, &arcturus_thermal_policy[0], sizeof(struct smu_temperature_range));
-
         range->max = pptable->TedgeLimit *
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
         range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
@@ -910,7 +901,6 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
         range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
                 SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
-
         return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +6 -0
index 0a22fa48ff5a..59b2045e37e4 100644
@@ -64,6 +64,12 @@
 #define WORKLOAD_MAP(profile, workload) \
         [profile] = {1, (workload)}
 
+static const struct smu_temperature_range smu11_thermal_policy[] =
+{
+       {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
+       { 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000, 120000},
+};
+
 struct smu_11_0_cmn2aisc_mapping {
         int     valid_mapping;
         int     map_to;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -3
index d7d4186b762f..e804d18f61d0 100644
@@ -1505,9 +1505,8 @@ static int navi10_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->software_shutdown_temp;
+       range->max = powerplay_table->software_shutdown_temp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
         return 0;
 }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +18 -33

85 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +12 -8
index acf075393c13..e14363182691 100644
@@ -3113,14 +3113,18 @@ static int vega20_get_thermal_temperature_range(struct smu_context *smu,
         if (!range || !powerplay_table)
                 return -EINVAL;
 
-       /* The unit is temperature */
-       range->min = 0;
-       range->max = powerplay_table->usSoftwareShutdownTemp;
-       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE);
-       range->hotspot_crit_max = pptable->ThotspotLimit;
-       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT);
-       range->mem_crit_max = pptable->ThbmLimit;
-       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM);
+       range->max = powerplay_table->usSoftwareShutdownTemp *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->ThbmLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->ThbmLimit + CTF_OFFSET_HBM) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
 
         return 0;

--
2.22.0

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx