Skip to contentSkip to conversation

drm/amd/powerplay: export vega10 specific thermal ranges (V2)

PATCH In review Evan Quan 2 participants 5 messages Jan 4, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/3 drm/amd/powerplay: export vega10 specific thermal ranges (V2)

V2: new header file to hold the common SMU7Thermal structure

Change-Id If240a45dd2538e93185802b1fce54fd83de89de0
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 16 ++++++++++
 drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h     | 34 ++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +16 -0
index 2d55dab..455becd 100644
@@ -49,6 +49,7 @@
 #include "cgs_linux.h"
 #include "ppinterrupt.h"
 #include "pp_overdriver.h"
+#include "pp_thermal.h"
 
 #define VOLTAGE_SCALE  4
 #define VOLTAGE_VID_OFFSET_SCALE1   625
@@ -4988,6 +4989,20 @@ static int vega10_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int vega10_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
+		struct PP_TemperatureRange *thermal_data)
+{
+	struct phm_ppt_v2_information *table_info =
+			(struct phm_ppt_v2_information *)hwmgr->pptable;
+
+	memcpy(thermal_data, &SMU7ThermalWithDelayPolicy[0], sizeof(struct PP_TemperatureRange));
+
+	thermal_data->max = table_info->tdp_table->usSoftwareShutdownTemp *
+		PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+	return 0;
+}
+
 static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
 		const void *info)
 {
@@ -5074,6 +5089,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
 	.set_mclk_od = vega10_set_mclk_od,
 	.avfs_control = vega10_avfs_enable,
 	.notify_cac_buffer_info = vega10_notify_cac_buffer_info,
+	.get_thermal_temperature_range = vega10_get_thermal_temperature_range,
 	.register_internal_thermal_interrupt = vega10_register_thermal_interrupt,
 	.start_thermal_controller = vega10_start_thermal_controller,
 };
drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h new file +34 -0
new file mode 100644
index 0000000..82b810a
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2018 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+#ifndef PP_THERMAL_H
+#define PP_THERMAL_H
+
+#include "power_state.h"
+
+static const struct PP_TemperatureRange SMU7ThermalWithDelayPolicy[] =
+{
+	{-273150,  99000},
+	{ 120000, 120000},
+};
+
+#endif
Signature · 6 lines
2.7.4

_______________________________________________
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): 1515039437-31623-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/3 drm/amd/powerplay: export the thermal ranges of VI asics (V2)

V2: move the SMU7Thermal structure to newly created header file

Change-Id I569179443c73c793153d5c499dd2f203f89e3ca2
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 21 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h   |  6 ++++++
 2 files changed, 27 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +21 -0
index 8d7fd06..df25d91 100644
@@ -48,6 +48,7 @@
 #include "smu7_thermal.h"
 #include "smu7_clockpowergating.h"
 #include "processpptables.h"
+#include "pp_thermal.h"
 
 #define MC_CG_ARB_FREQ_F0           0x0a
 #define MC_CG_ARB_FREQ_F1           0x0b
@@ -4655,6 +4656,25 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int smu7_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
+		struct PP_TemperatureRange *thermal_data)
+{
+	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+	struct phm_ppt_v1_information *table_info =
+			(struct phm_ppt_v1_information *)hwmgr->pptable;
+
+	memcpy(thermal_data, &SMU7ThermalPolicy[0], sizeof(struct PP_TemperatureRange));
+
+	if (hwmgr->pp_table_version == PP_TABLE_V1)
+		thermal_data->max = table_info->cac_dtp_table->usSoftwareShutdownTemp *
+			PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+	else if (hwmgr->pp_table_version == PP_TABLE_V0)
+		thermal_data->max = data->thermal_temp_setting.temperature_shutdown *
+			PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
 	.backend_init = &smu7_hwmgr_backend_init,
 	.backend_fini = &smu7_hwmgr_backend_fini,
@@ -4707,6 +4727,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
 	.disable_smc_firmware_ctf = smu7_thermal_disable_alert,
 	.start_thermal_controller = smu7_start_thermal_controller,
 	.notify_cac_buffer_info = smu7_notify_cac_buffer_info,
+	.get_thermal_temperature_range = smu7_get_thermal_temperature_range,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h +6 -0
index 82b810a..201d2b6 100644
@@ -31,4 +31,10 @@ static const struct PP_TemperatureRange SMU7ThermalWithDelayPolicy[] =
 	{ 120000, 120000},
 };
 
+static const struct PP_TemperatureRange SMU7ThermalPolicy[] =
+{
+	{-273150,  99000},
+	{ 120000, 120000},
+};
+
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
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): 1515039437-31623-2-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/3] drm/amd/powerplay: export the thermal ranges of VI asics (V2)

Quoted 60 lines · Evan Quan

V2: move the SMU7Thermal structure to newly created header file

Change-Id I569179443c73c793153d5c499dd2f203f89e3ca2
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 21 +++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h   |  6 ++++++
 2 files changed, 27 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +21 -0
index 8d7fd06..df25d91 100644
@@ -48,6 +48,7 @@
 #include "smu7_thermal.h"
 #include "smu7_clockpowergating.h"
 #include "processpptables.h"
+#include "pp_thermal.h"
 
 #define MC_CG_ARB_FREQ_F0           0x0a
 #define MC_CG_ARB_FREQ_F1           0x0b
@@ -4655,6 +4656,25 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
        return 0;
 }
 
+static int smu7_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
+               struct PP_TemperatureRange *thermal_data)
+{
+       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+       struct phm_ppt_v1_information *table_info =
+                       (struct phm_ppt_v1_information *)hwmgr->pptable;
+
+       memcpy(thermal_data, &SMU7ThermalPolicy[0], sizeof(struct PP_TemperatureRange));
+
+       if (hwmgr->pp_table_version == PP_TABLE_V1)
+               thermal_data->max = table_info->cac_dtp_table->usSoftwareShutdownTemp *
+                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       else if (hwmgr->pp_table_version == PP_TABLE_V0)
+               thermal_data->max = data->thermal_temp_setting.temperature_shutdown *
+                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+       return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
        .backend_init = &smu7_hwmgr_backend_init,
        .backend_fini = &smu7_hwmgr_backend_fini,
@@ -4707,6 +4727,7 @@ static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
        .disable_smc_firmware_ctf = smu7_thermal_disable_alert,
        .start_thermal_controller = smu7_start_thermal_controller,
        .notify_cac_buffer_info = smu7_notify_cac_buffer_info,
+       .get_thermal_temperature_range = smu7_get_thermal_temperature_range,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h +0 -0
index 82b810a..201d2b6 100644

drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h static const struct PP_TemperatureRange SMU7ThermalWithDelayPolicy[] = · line 38

Quoted 8 lines
drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h +5 -0
@@ -31,4 +31,10 @@ static const struct PP_TemperatureRange SMU7ThermalWithDelayPolicy[] =
        { 120000, 120000},
 };
 
+static const struct PP_TemperatureRange SMU7ThermalPolicy[] =
+{
+       {-273150,  99000},
+       { 120000, 120000},
+};

This is identical to the other temp range you added in patch 1.

Alex

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/inc/pp_thermal.h +1 -1
+
 #endif
--

2.7.4

_______________________________________________
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

author
#5 lore raw

PATCH 3/3 drm/amd/powerplay: export the thermal ranges of Carrizo (V2)

In reply to a message not in the archive

V2: reuse the SMUThermal structure defined in pp_thermal.h

Change-Id I861e3e6d4ec553171cbf369eca4ac9d834478290
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +15 -0
index b314d09..0b8aa44 100644
@@ -38,6 +38,7 @@
 #include "cz_hwmgr.h"
 #include "power_state.h"
 #include "cz_clockpowergating.h"
+#include "pp_thermal.h"
 
 #define ixSMUSVI_NB_CURRENTVID 0xD8230044
 #define CURRENT_NB_VID_MASK 0xff000000
@@ -1858,6 +1859,19 @@ static int cz_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int cz_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
+		struct PP_TemperatureRange *thermal_data)
+{
+	struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend);
+
+	memcpy(thermal_data, &SMU7ThermalPolicy[0], sizeof(struct PP_TemperatureRange));
+
+	thermal_data->max = (cz_hwmgr->thermal_auto_throttling_treshold +
+			cz_hwmgr->sys_info.htc_hyst_lmt) *
+			PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+	return 0;
+}
 
 static const struct pp_hwmgr_func cz_hwmgr_funcs = {
 	.backend_init = cz_hwmgr_backend_init,
@@ -1890,6 +1904,7 @@ static const struct pp_hwmgr_func cz_hwmgr_funcs = {
 	.power_state_set = cz_set_power_state_tasks,
 	.dynamic_state_management_disable = cz_disable_dpm_tasks,
 	.notify_cac_buffer_info = cz_notify_cac_buffer_info,
+	.get_thermal_temperature_range = cz_get_thermal_temperature_range,
 };
 
 int cz_init_function_pointers(struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.7.4

_______________________________________________
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): 1515039437-31623-3-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH 3/3] drm/amd/powerplay: export the thermal ranges of Carrizo (V2)

Quoted 4 lines · Evan Quan

V2: reuse the SMUThermal structure defined in pp_thermal.h

Change-Id I861e3e6d4ec553171cbf369eca4ac9d834478290

Series is:

Quoted 47 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +15 -1
index b314d09..0b8aa44 100644
@@ -38,6 +38,7 @@
 #include "cz_hwmgr.h"
 #include "power_state.h"
 #include "cz_clockpowergating.h"
+#include "pp_thermal.h"
 
 #define ixSMUSVI_NB_CURRENTVID 0xD8230044
 #define CURRENT_NB_VID_MASK 0xff000000
@@ -1858,6 +1859,19 @@ static int cz_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
        return 0;
 }
 
+static int cz_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
+               struct PP_TemperatureRange *thermal_data)
+{
+       struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend);
+
+       memcpy(thermal_data, &SMU7ThermalPolicy[0], sizeof(struct PP_TemperatureRange));
+
+       thermal_data->max = (cz_hwmgr->thermal_auto_throttling_treshold +
+                       cz_hwmgr->sys_info.htc_hyst_lmt) *
+                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+       return 0;
+}
 
 static const struct pp_hwmgr_func cz_hwmgr_funcs = {
        .backend_init = cz_hwmgr_backend_init,
@@ -1890,6 +1904,7 @@ static const struct pp_hwmgr_func cz_hwmgr_funcs = {
        .power_state_set = cz_set_power_state_tasks,
        .dynamic_state_management_disable = cz_disable_dpm_tasks,
        .notify_cac_buffer_info = cz_notify_cac_buffer_info,
+       .get_thermal_temperature_range = cz_get_thermal_temperature_range,
 };
 
 int cz_init_function_pointers(struct pp_hwmgr *hwmgr)
--

2.7.4

Quoted 4 lines

_______________________________________________
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