Skip to contentSkip to conversation

Add documentation power related sysfs interfaces

PATCH In review Alex Deucher 4 participants 11 messages Apr 19, 2018 – Apr 20, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add documentation power related sysfs interfaces

Provide some initial documenation on how to use the power sysfs APIs.

Alex Deucher (6):
drm/amdgpu/pm: document power_dpm_force_performance_level drm/amdgpu/pm: document power_dpm_state drm/amdgpu/pm: document pp_table
drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie drm/amdgpu/pm: document pp_power_profile_mode drm/amdgpu/pm: document pp_od_clk_voltage

 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
Signature · 6 lines
2.13.6

_______________________________________________
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): 20180419200514.29136-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/6 drm/amdgpu/pm: document power_dpm_force_performance_level

Provide documentation for power_dpm_force_performance_level which is used to adjust things related to GPU power states.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 53 ++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +53 -0
index 744f105a2c75..ee11e92cc4d2 100644
@@ -131,6 +131,59 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
 	return count;
 }
 
+
+/**
+ * DOC: power_dpm_force_performance_level
+ *
+ * The amdgpu driver provides a sysfs API for adjusting certain power
+ * related parameters.  The file power_dpm_force_performance_level is
+ * used for this.  It accepts the following arguments:
+ * - auto
+ * - low
+ * - high
+ * - manual
+ * - GPU fan
+ * - profile_standard
+ * - profile_min_sclk
+ * - profile_min_mclk
+ * - profile_peak
+ *
+ * auto
+ *
+ * When auto is selected, the driver will attempt to dynamically select
+ * the optimal power profile for current conditions in the driver.
+ *
+ * low
+ *
+ * When low is selected, the clocks are forced to the lowest power state.
+ *
+ * high
+ *
+ * When high is selected, the clocks are forced to the highest power state.
+ *
+ * manual
+ *
+ * When manual is selected, the user can manually adjust which power states
+ * are enabled for each clock domain via the sysfs pp_dpm_mclk, pp_dpm_sclk,
+ * and pp_dpm_pcie files and adjust the power state transition heuristics
+ * via the pp_power_profile_mode sysfs file.
+ *
+ * profile_standard
+ * profile_min_sclk
+ * profile_min_mclk
+ * profile_peak
+ *
+ * When the profiling modes are selected, clock and power gating are
+ * disabled and the clocks are set for different profiling cases. This
+ * mode is recommended for profiling specific work loads where you do
+ * not want clock or power gating for clock fluctuation to interfere
+ * with your results. profile_standard sets the clocks to a fixed clock
+ * level which varies from asic to asic.  profile_min_sclk forces the sclk
+ * to the lowest level.  profile_min_mclk forces the mclk to the lowest level.
+ * profile_peak sets all clocks (mclk, sclk, pcie) to the highest levels.
+ *
+ */
+
 static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
 						struct device_attribute *attr,
 								char *buf)
Signature · 6 lines
2.13.6

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

PATCH 2/6 drm/amdgpu/pm: document power_dpm_state

In reply to a message not in the archive

This is a legacy file and is only provided for
backwards compatibility.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +31 -0
index ee11e92cc4d2..e33e0f4c4a28 100644
@@ -77,6 +77,37 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
 	}
 }
 
+/**
+ * DOC: power_dpm_state
+ *
+ * This is a legacy interface and is only provided for backwards compatibility.
+ * The amdgpu driver provides a sysfs API for adjusting certain power
+ * related parameters.  The file power_dpm_state is used for this.
+ * It accepts the following arguments:
+ * - battery
+ * - balanced
+ * - performance
+ *
+ * battery
+ *
+ * On older GPUs, the vbios provided a special power state for battery
+ * operation.  Selecting battery switched to this state.  This is no
+ * longer provided on newer GPUs so the option does nothing in that case.
+ *
+ * balanced
+ *
+ * On older GPUs, the vbios provided a special power state for balanced
+ * operation.  Selecting balanced switched to this state.  This is no
+ * longer provided on newer GPUs so the option does nothing in that case.
+ *
+ * performance
+ *
+ * On older GPUs, the vbios provided a special power state for performance
+ * operation.  Selecting performance switched to this state.  This is no
+ * longer provided on newer GPUs so the option does nothing in that case.
+ *
+ */
+
 static ssize_t amdgpu_get_dpm_state(struct device *dev,
 				    struct device_attribute *attr,
 				    char *buf)
Signature · 6 lines
2.13.6

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

PATCH 3/6 drm/amdgpu/pm: document pp_table

In reply to a message not in the archive

This file is for uploading new powerplay tables.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +11 -0
index e33e0f4c4a28..9982f1b1f8c4 100644
@@ -408,6 +408,17 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev,
 	return count;
 }
 
+/**
+ * DOC: pp_table
+ *
+ * The amdgpu driver provides a sysfs API for uploading new powerplay
+ * tables.  The file pp_table is used for this.  Reading the file
+ * will dump the current power play table.  Writing to the file
+ * will attempt to upload a new powerplay table and re-initialize
+ * powerplay using that new table.
+ *
+ */
+
 static ssize_t amdgpu_get_pp_table(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
Signature · 6 lines
2.13.6

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

PATCH 4/6 drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie

In reply to a message not in the archive

Used for manually masking dpm states.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +18 -0
index 9982f1b1f8c4..3f1715b1a547 100644
@@ -539,6 +539,24 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 
 }
 
+/**
+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie
+ *
+ * The amdgpu driver provides a sysfs API for adjusting what power levels
+ * are enabled for a given power state.  The files pp_dpm_sclk, pp_dpm_mclk,
+ * and pp_dpm_pcie are used for this.
+ *
+ * Reading back the files will show you the available power levels within
+ * the power state and the clock information for those levels.  There
+ * will be a '*' next to the level that is currently active.
+ *
+ * To manually adjust these states, first select manual using
+ * power_dpm_force_performance_level.  Writing a string of the level
+ * numbers to the file will select which levels you want to enable.
+ * E.g., writing 456 to the file will enable levels 4, 5, and 6.
+ *
+ */
+
 static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
Signature · 6 lines
2.13.6

_______________________________________________
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): 20180419200514.29136-5-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#7 lore raw

RE: [PATCH 4/6] drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie

Hi Alex,

Quoted 1 line

There will be a '*' next to the level that is currently active.

We need to add a level for deep sleep state.
Otherwise, On Vega/Rv, when gpu in deepsleep, we can't set "*" for the current level.

Best Regards
Rex

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Alex Deucher
Sent: Friday, April 20, 2018 4:05 AM
To: [email protected]
Cc: Deucher, Alexander
Subject: [PATCH 4/6] drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie

Used for manually masking dpm states.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +18 -0
index 9982f1b1f8c4..3f1715b1a547 100644
@@ -539,6 +539,24 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 
 }
 
+/**
+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie
+ *
+ * The amdgpu driver provides a sysfs API for adjusting what power levels
+ * are enabled for a given power state.  The files pp_dpm_sclk, pp_dpm_mclk,
+ * and pp_dpm_pcie are used for this.
+ *
+ * Reading back the files will show you the available power levels within
+ * the power state and the clock information for those levels.  There
+ * will be a '*' next to the level that is currently active.
+ *
+ * To manually adjust these states, first select manual using
+ * power_dpm_force_performance_level.  Writing a string of the level
+ * numbers to the file will select which levels you want to enable.
+ * E.g., writing 456 to the file will enable levels 4, 5, and 6.
+ *
+ */
+
 static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
Signature · 10 lines
2.13.6

_______________________________________________
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): CY4PR12MB1687A0B523B78812CA764ECBFBB40-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#9 lore raw

Re: [PATCH 4/6] drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie

Quoted 6 lines · Rex

Hi Alex,

Quoted 1 line

There will be a '*' next to the level that is currently active.

We need to add a level for deep sleep state.
Otherwise, On Vega/Rv, when gpu in deepsleep, we can't set "*" for the current level.

I dropped that sentence for now. We can revisit it later. Thanks!

Alex

Quoted 51 lines

Best Regards
Rex

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Alex Deucher
Sent: Friday, April 20, 2018 4:05 AM
To: [email protected]
Cc: Deucher, Alexander
Subject: [PATCH 4/6] drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie

Used for manually masking dpm states.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +18 -1
index 9982f1b1f8c4..3f1715b1a547 100644
@@ -539,6 +539,24 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
 
 }
 
+/**
+ * DOC: pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie
+ *
+ * The amdgpu driver provides a sysfs API for adjusting what power levels
+ * are enabled for a given power state.  The files pp_dpm_sclk, pp_dpm_mclk,
+ * and pp_dpm_pcie are used for this.
+ *
+ * Reading back the files will show you the available power levels within
+ * the power state and the clock information for those levels.  There
+ * will be a '*' next to the level that is currently active.
+ *
+ * To manually adjust these states, first select manual using
+ * power_dpm_force_performance_level.  Writing a string of the level
+ * numbers to the file will select which levels you want to enable.
+ * E.g., writing 456 to the file will enable levels 4, 5, and 6.
+ *
+ */
+
 static ssize_t amdgpu_get_pp_dpm_sclk(struct device *dev,
                struct device_attribute *attr,
                char *buf)
--

2.13.6

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

#10 lore raw

PATCH 5/6 drm/amdgpu/pm: document pp_power_profile_mode

In reply to a message not in the archive

sysfs file for adjusting power level heuristics.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +20 -0
index 3f1715b1a547..9d52618a5c4c 100644
@@ -781,6 +781,26 @@ static ssize_t amdgpu_set_pp_mclk_od(struct device *dev,
 	return count;
 }
 
+/**
+ * DOC: pp_power_profile_mode
+ *
+ * The amdgpu driver provides a sysfs API for adjusting the heuristics
+ * related to switching between power levels in a power state.  The file
+ * pp_power_profile_mode is used for this.
+ *
+ * Reading this file outputs a list of all of the predefined power profiles
+ * and the relevant heuristics settings for that profile.
+ *
+ * To select a profile or create a custom profile, first select manual using
+ * power_dpm_force_performance_level.  Writing the number of a predefined
+ * profile to pp_power_profile_mode will enable those heuristics.  To
+ * create a custom set of heuristics, write a string of numbers to the file
+ * starting with the number of the custom profile along with a setting
+ * for each heuristic parameter.  Due to differences across asic families
+ * the heuristic parameters vary from family to family.
+ *
+ */
+
 static ssize_t amdgpu_get_pp_power_profile_mode(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
Signature · 6 lines
2.13.6

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

PATCH 6/6 drm/amdgpu/pm: document pp_od_clk_voltage

In reply to a message not in the archive

sysfs interface for fine grained clock and voltage control.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +23 -0
index 9d52618a5c4c..d7f322061de3 100644
@@ -455,6 +455,29 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
 	return count;
 }
 
+/**
+ * DOC: pp_od_clk_voltage
+ *
+ * The amdgpu driver provides a sysfs API for adjusting the clocks and voltages
+ * in each power level within a power state.  The pp_od_clk_voltage is used for
+ * this.
+ *
+ * Reading the file will display:
+ * - a list of engine clock levels and voltages labeled OD_SCLK
+ * - a list of memory clock levels and voltages labeled OD_MCLK
+ * - a list of valid ranges for sclk, mclk, and voltage labeled OD_RANGE
+ *
+ * To manually adjust these settings, first select manual using
+ * power_dpm_force_performance_level. Enter a new value for each
+ * level by writing a string that contains "s/m level clock voltage" to
+ * the file.  E.g., "s 1 500 820" will update sclk level 1 to be 500 MHz
+ * at 820 mV; "m 0 350 810" will update mclk level 0 to be 350 MHz at
+ * 810 mV.  When you have edited all of the states as needed, write
+ * "c" (commit) to the file to commit your changes.  If you want to reset to the
+ * default power levels, write "r" (reset) to the file to reset them.
+ *
+ */
+
 static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf,
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw
In reply to a message not in the archive

Thanks. It's great to see this documented. I haven't confirmed that the information is 100% accurate. Acked-by: Felix Kuehling <[email protected]>

Quoted 11 lines · Alex Deucher

Provide some initial documenation on how to use the power sysfs APIs.

Alex Deucher (6):
drm/amdgpu/pm: document power_dpm_force_performance_level drm/amdgpu/pm: document power_dpm_state drm/amdgpu/pm: document pp_table
drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie drm/amdgpu/pm: document pp_power_profile_mode drm/amdgpu/pm: document pp_od_clk_voltage

Quoted 3 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)

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

#13 lore raw
In reply to a message not in the archive
Quoted 3 lines · Alex Deucher

Provide some initial documenation on how to use the power sysfs APIs.

Series are Reviewed-by: Huang Rui <[email protected]>

Quoted 8 lines

Alex Deucher (6):
drm/amdgpu/pm: document power_dpm_force_performance_level drm/amdgpu/pm: document power_dpm_state drm/amdgpu/pm: document pp_table
drm/amdgpu/pm: document pp_dpm_sclk pp_dpm_mclk pp_dpm_pcie drm/amdgpu/pm: document pp_power_profile_mode drm/amdgpu/pm: document pp_od_clk_voltage

Quoted 10 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 156 +++++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
Signature · 6 lines
2.13.6

_______________________________________________
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