Skip to contentSkip to conversation

enable new capped/uncapped power profiles

PATCH In review Perry Yuan 3 participants 6 messages Feb 24, 2023 – Mar 6, 2023

Subsystems (3)
lore
Share & tools
lore

Perry Yuan

author
#0 lore raw

cover enable new capped/uncapped power profiles

The patchset will enable the capped and uncapped mode

This new capped power mode has limit DRAM Thresholds
and conditions in DF-PState Algorithm based on the workload type set from driver.
The uncapped mode will reset to normal performance level which has no such power limitations.

Perf Centric Workload (Uncapped) 0
Power Centric Workload (Capped) 1

Perry Yuan (3):
drm/amdgpu/pm: add capped/uncapped power profile modes drm/amdgpu: map new capped and uncapped mode power profiles for
Vangogh
drm/amdgpu: skip the invalid workload type

 drivers/gpu/drm/amd/include/kgd_pp_interface.h              | 2 ++
 drivers/gpu/drm/amd/pm/amdgpu_pm.c                          | 2 ++
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu11_driver_if_vangogh.h  | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c            | 6 ++++--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                      | 4 ++--
 7 files changed, 19 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/3 drm/amdgpu/pm: add capped/uncapped power profile modes

Capped and uncapped workload types switching are supported on Vangogh, User can switch the power profile and check current type with below commands.

1) switch to capped mode:
# echo 8 > /sys/class/drm/card0/device/pp_power_profile_mode

2) switch to uncapped mode:
# echo 9 > /sys/class/drm/card0/device/pp_power_profile_mode

3) check current mode:

$ cat /sys/class/drm/card0/device/pp_power_profile_mode
 1 3D_FULL_SCREEN
 3          VIDEO
 4             VR
 5        COMPUTE
 6         CUSTOM
 8         CAPPED
 9       UNCAPPED*
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 2 ++
 drivers/gpu/drm/amd/pm/amdgpu_pm.c             | 2 ++
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c         | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index f3d64c78feaa..faa2e1dd6d2d 100644
@@ -160,6 +160,8 @@ enum PP_SMC_POWER_PROFILE {
 	PP_SMC_POWER_PROFILE_COMPUTE      = 0x5,
 	PP_SMC_POWER_PROFILE_CUSTOM       = 0x6,
 	PP_SMC_POWER_PROFILE_WINDOW3D     = 0x7,
+	PP_SMC_POWER_PROFILE_CAPPED	  = 0x8,
+	PP_SMC_POWER_PROFILE_UNCAPPED	  = 0x9,
 	PP_SMC_POWER_PROFILE_COUNT,
 };
 
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -0
index 236657eece47..c73b4cf017f0 100644
@@ -91,6 +91,8 @@ const char * const amdgpu_pp_profile_name[] = {
 	"COMPUTE",
 	"CUSTOM",
 	"WINDOW_3D",
+	"CAPPED",
+	"UNCAPPED",
 };
 
 /**
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -2
index 768b6e7dbd77..81c675e4a1a1 100644
@@ -472,13 +472,13 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
 		return mapping.map_to;
 
 	case CMN2ASIC_MAPPING_WORKLOAD:
-		if (index > PP_SMC_POWER_PROFILE_WINDOW3D ||
+		if (index >= PP_SMC_POWER_PROFILE_COUNT ||
 		    !smu->workload_map)
 			return -EINVAL;
 
 		mapping = smu->workload_map[index];
 		if (!mapping.valid_mapping)
-			return -EINVAL;
+			return -ENOTSUPP;
 
 		return mapping.map_to;
 
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/3 drm/amdgpu: map new capped and uncapped mode power profiles for Vangogh

In reply to Perry Yuan

Capped and Uncapped workload types are supported, each workload type has different performance thresholds and pstate conditions.

* capped mode is used by power centric workload
* uncapped mode is used by perf centric workload

---
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu11_driver_if_vangogh.h  | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c            | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu11_driver_if_vangogh.h +3 -1
index 8361ebd8d876..21e6028a49e6 100644
@@ -238,7 +238,9 @@ typedef struct {
 #define WORKLOAD_PPLIB_VR_BIT 3
 #define WORKLOAD_PPLIB_COMPUTE_BIT 4
 #define WORKLOAD_PPLIB_CUSTOM_BIT 5
-#define WORKLOAD_PPLIB_COUNT 6
+#define WORKLOAD_PPLIB_CAPPED_BIT 6
+#define WORKLOAD_PPLIB_UNCAPPED_BIT 7
+#define WORKLOAD_PPLIB_COUNT 8
 
 #define TABLE_BIOS_IF            0 // Called by BIOS
 #define TABLE_WATERMARKS         1 // Called by DAL through VBIOS
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -2
index cb10c7e31264..3673ba1a2cad 100644
@@ -203,6 +203,8 @@ static struct cmn2asic_mapping vangogh_workload_map[PP_SMC_POWER_PROFILE_COUNT]
 	WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR,			WORKLOAD_PPLIB_VR_BIT),
 	WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE,		WORKLOAD_PPLIB_COMPUTE_BIT),
 	WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM,		WORKLOAD_PPLIB_CUSTOM_BIT),
+	WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CAPPED,		WORKLOAD_PPLIB_CAPPED_BIT),
+	WORKLOAD_MAP(PP_SMC_POWER_PROFILE_UNCAPPED,		WORKLOAD_PPLIB_UNCAPPED_BIT),
 };
 
 static const uint8_t vangogh_throttler_map[] = {
@@ -1046,7 +1048,7 @@ static int vangogh_get_power_profile_mode(struct smu_context *smu,
 	if (!buf)
 		return -EINVAL;
 
-	for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {
+	for (i = 0; i < PP_SMC_POWER_PROFILE_COUNT; i++) {
 		/*
 		 * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT
 		 * Not all profile modes are supported on vangogh.
@@ -1070,7 +1072,7 @@ static int vangogh_set_power_profile_mode(struct smu_context *smu, long *input,
 	int workload_type, ret;
 	uint32_t profile_mode = input[size];
 
-	if (profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
+	if (profile_mode >= PP_SMC_POWER_PROFILE_COUNT) {
 		dev_err(smu->adev->dev, "Invalid power profile mode %d\n", profile_mode);
 		return -EINVAL;
 	}
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/3 drm/amdgpu: skip the invalid workload type

In reply to Perry Yuan

If some invalid workload types exposed by the power profile sysfs node, it will be failed to set the unsuported profiles.
So we can skip to show the invalid workload type in the profiles list to avoid that failure happen.

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +3 -1
index aebdd9747c37..c76dced727b9 100644
@@ -1561,7 +1561,9 @@ static int smu_v13_0_0_get_power_profile_mode(struct smu_context *smu,
 		workload_type = smu_cmn_to_asic_specific_index(smu,
 							       CMN2ASIC_MAPPING_WORKLOAD,
 							       i);
-		if (workload_type < 0)
+		if (workload_type == -ENOTSUPP)
+			continue;
+		else if (workload_type < 0)
 			return -EINVAL;
 
 		result = smu_cmn_update_table(smu,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +3 -1
index 5c6c6ad011ca..8aa3fda156a6 100644
@@ -1477,7 +1477,9 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
 		workload_type = smu_cmn_to_asic_specific_index(smu,
 							       CMN2ASIC_MAPPING_WORKLOAD,
 							       i);
-		if (workload_type < 0) {
+		if (workload_type == -ENOTSUPP)
+			continue;
+		else if (workload_type < 0) {
 			result = -EINVAL;
 			goto out;
 		}
Signature · 1 line
2.34.1
#4 lore raw
In reply to Perry Yuan

[AMD Official Use Only - General]

Series is reviewed-by: Evan Quan <[email protected]>

Quoted 37 lines

-----Original Message-----
From: Yuan, Perry <[email protected]>
Sent: Friday, February 24, 2023 4:33 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; Li, Candice <[email protected]>; [email protected]
Cc: Huang, Shimmer <[email protected]>; Liu, Kun <[email protected]>
Subject: [PATCH 0/3] enable new capped/uncapped power profiles

The patchset will enable the capped and uncapped mode

This new capped power mode has limit DRAM Thresholds and conditions in DF-PState Algorithm based on the workload type set from driver. The uncapped mode will reset to normal performance level which has no such power limitations.

Perf Centric Workload (Uncapped) 0
Power Centric Workload (Capped) 1

Perry Yuan (3):
drm/amdgpu/pm: add capped/uncapped power profile modes drm/amdgpu: map new capped and uncapped mode power profiles for
Vangogh
drm/amdgpu: skip the invalid workload type

 drivers/gpu/drm/amd/include/kgd_pp_interface.h              | 2 ++
 drivers/gpu/drm/amd/pm/amdgpu_pm.c                          | 2 ++
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu11_driver_if_vangogh.h  | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c            | 6 ++++--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                      | 4 ++--
 7 files changed, 19 insertions(+), 7 deletions(-)

--
2.34.1

maintainer Acked-by on the v1 series
#5 lore raw
In reply to Perry Yuan

[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Perry Yuan
Sent: Friday, February 24, 2023 4:33 PM
To: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Lazar, Lijo <[email protected]>; Li, Candice <[email protected]>; [email protected]
Cc: Huang, Shimmer <[email protected]>; Liu, Kun <[email protected]>
Subject: [PATCH 0/3] enable new capped/uncapped power profiles

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

The patchset will enable the capped and uncapped mode

This new capped power mode has limit DRAM Thresholds and conditions in DF-PState Algorithm based on the workload type set from driver. The uncapped mode will reset to normal performance level which has no such power limitations.

Perf Centric Workload (Uncapped) 0
Power Centric Workload (Capped) 1

Perry Yuan (3):
drm/amdgpu/pm: add capped/uncapped power profile modes drm/amdgpu: map new capped and uncapped mode power profiles for
Vangogh
drm/amdgpu: skip the invalid workload type

 drivers/gpu/drm/amd/include/kgd_pp_interface.h              | 2 ++
 drivers/gpu/drm/amd/pm/amdgpu_pm.c                          | 2 ++
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu11_driver_if_vangogh.h  | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c            | 6 ++++--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c        | 4 +++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                      | 4 ++--
 7 files changed, 19 insertions(+), 7 deletions(-)

--
2.34.1