Documentation/amdgpu: Add PM policy documentation
authorLijo Lazar <lijo.lazar@amd.com>
Mon, 13 May 2024 06:34:50 +0000 (12:04 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 20 May 2024 20:20:26 +0000 (16:20 -0400)
Add documentation about the newly added pm_policy node in sysfs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Documentation/gpu/amdgpu/thermal.rst
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 2f6166f81e6a6ee635781cf9e637b3b873dd00d7..6d942b5c58f0547bf1aa7abb0db0e9d522eb09b7 100644 (file)
@@ -49,6 +49,12 @@ pp_power_profile_mode
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: pp_power_profile_mode
 
+pm_policy
+---------------------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: pm_policy
+
 \*_busy_percent
 ---------------
 
index 125fd1a25351bf2b73829eb7abb3eea6f8e71e6d..d5d6ab484e5add38c925287527e8378663ed7147 100644 (file)
@@ -2220,6 +2220,59 @@ struct amdgpu_pm_policy_attr {
        enum pp_pm_policy id;
 };
 
+/**
+ * DOC: pm_policy
+ *
+ * Certain SOCs can support different power policies to optimize application
+ * performance. However, this policy is provided only at SOC level and not at a
+ * per-process level. This is useful especially when entire SOC is utilized for
+ * dedicated workload.
+ *
+ * The amdgpu driver provides a sysfs API for selecting the policy. Presently,
+ * only two types of policies are supported through this interface.
+ *
+ *  Pstate Policy Selection - This is to select different Pstate profiles which
+ *  decides clock/throttling preferences.
+ *
+ *  XGMI PLPD Policy Selection - When multiple devices are connected over XGMI,
+ *  this helps to select policy to be applied for per link power down.
+ *
+ * The list of available policies and policy levels vary between SOCs. They can
+ * be viewed under pm_policy node directory. If SOC doesn't support any policy,
+ * this node won't be available. The different policies supported will be
+ * available as separate nodes under pm_policy.
+ *
+ *     cat /sys/bus/pci/devices/.../pm_policy/<policy_type>
+ *
+ * Reading the policy file shows the different levels supported. The level which
+ * is applied presently is denoted by * (asterisk). E.g.,
+ *
+ * .. code-block:: console
+ *
+ *     cat /sys/bus/pci/devices/.../pm_policy/soc_pstate
+ *     0 : soc_pstate_default
+ *     1 : soc_pstate_0
+ *     2 : soc_pstate_1*
+ *     3 : soc_pstate_2
+ *
+ *     cat /sys/bus/pci/devices/.../pm_policy/xgmi_plpd
+ *     0 : plpd_disallow
+ *     1 : plpd_default
+ *     2 : plpd_optimized*
+ *
+ * To apply a specific policy
+ *
+ * "echo  <level> > /sys/bus/pci/devices/.../pm_policy/<policy_type>"
+ *
+ * For the levels listed in the example above, to select "plpd_optimized" for
+ * XGMI and "soc_pstate_2" for soc pstate policy -
+ *
+ * .. code-block:: console
+ *
+ *     echo "2" > /sys/bus/pci/devices/.../pm_policy/xgmi_plpd
+ *     echo "3" > /sys/bus/pci/devices/.../pm_policy/soc_pstate
+ *
+ */
 static ssize_t amdgpu_get_pm_policy_attr(struct device *dev,
                                         struct device_attribute *attr,
                                         char *buf)