Skip to contentSkip to conversation

drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

PATCH In review Russell, Kent 3 participants 11 messages Mar 27, 2019 – Apr 1, 2019 9 messages not in the archive

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

PATCH 1/2 drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14 +++++++++++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14 +++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +13 -1
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 						1 << power_profile_mode);
 
 	if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size == 0 || size > 4)
+		if (size != 0 && size != 4)
 			return -EINVAL;
 
+		/* If size = 0 and the CUSTOM profile has been set already
+		 * (check BUSY_SET_POINT since that is always >0 for a valid
+		 * profile) then just apply the profile.
+		 */
+		if (size == 0) {
+			if (data->custom_profile_mode[0] != 0)
+				goto out;
+			else
+				return -EINVAL;
+		}
+
 		data->custom_profile_mode[0] = busy_set_point = input[0];
 		data->custom_profile_mode[1] = FPS = input[1];
 		data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 					use_rlc_busy << 16 | min_active_level<<24);
 	}
 
+out:
 	hwmgr->power_profile_mode = power_profile_mode;
 
 	return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +13 -1
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 	}
 
 	if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size < 10)
+		if (size < 10 && size != 0)
 			return -EINVAL;
 
 		result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 				"[SetPowerProfile] Failed to get activity monitor!",
 				return result);
 
+		/* If size = 0 and the CUSTOM profile has been set already
+		 * (check BoosterFreqType since that is always >0 for a valid
+		 * profile) then just apply the profile.
+		 */
+		if (size == 0) {
+			if (activity_monitor.Soc_BoosterFreqType != 0)
+				goto out;
+			else
+				return -EINVAL;
+		}
+
 		switch (input[0]) {
 		case 0: /* Gfxclk */
 			activity_monitor.Gfx_FPS = input[1];
@@ -3908,6 +3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 				return result);
 	}
 
+out:
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type =
 		conv_power_profile_to_pplib_workload(power_profile_mode);
Signature · 6 lines
2.17.1

_______________________________________________
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

PATCH 2/2 drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

Allow changing to the CUSTOM profile without requiring the parameters being passed in each time. Store the values in the smu7_profiling table since it's defined here anyways

v2: Add check that CUSTOM was previously set

Change-Id I6c5e3a1487e12410a6a7670a5cf1a6599253344d
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 32 ++++++++++++-------
 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +21 -11
index 83d3d935f3ac..048757e8f494 100644
@@ -77,7 +77,7 @@
 #define PCIE_BUS_CLK                10000
 #define TCLK                        (PCIE_BUS_CLK / 10)
 
-static const struct profile_mode_setting smu7_profiling[7] =
+static struct profile_mode_setting smu7_profiling[7] =
 					{{0, 0, 0, 0, 0, 0, 0, 0},
 					 {1, 0, 100, 30, 1, 0, 100, 10},
 					 {1, 10, 0, 30, 0, 0, 0, 0},
@@ -4984,17 +4984,27 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint
 	mode = input[size];
 	switch (mode) {
 	case PP_SMC_POWER_PROFILE_CUSTOM:
-		if (size < 8)
+		if (size < 8 && size != 0)
 			return -EINVAL;
-
-		tmp.bupdate_sclk = input[0];
-		tmp.sclk_up_hyst = input[1];
-		tmp.sclk_down_hyst = input[2];
-		tmp.sclk_activity = input[3];
-		tmp.bupdate_mclk = input[4];
-		tmp.mclk_up_hyst = input[5];
-		tmp.mclk_down_hyst = input[6];
-		tmp.mclk_activity = input[7];
+		/* If only CUSTOM is passed in, use the saved values. Check
+		 * that we actually have a CUSTOM profile by ensuring that
+		 * the "use sclk" or the "use mclk" bits are set
+		 */
+		tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];
+		if (size == 0) {
+			if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk == 0)
+				return -EINVAL;
+		} else {
+			tmp.bupdate_sclk = input[0];
+			tmp.sclk_up_hyst = input[1];
+			tmp.sclk_down_hyst = input[2];
+			tmp.sclk_activity = input[3];
+			tmp.bupdate_mclk = input[4];
+			tmp.mclk_up_hyst = input[5];
+			tmp.mclk_down_hyst = input[6];
+			tmp.mclk_activity = input[7];
+			smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM] = tmp;
+		}
 		if (!smum_update_dpm_settings(hwmgr, &tmp)) {
 			memcpy(&data->current_profile_setting, &tmp, sizeof(struct profile_mode_setting));
 			hwmgr->power_profile_mode = mode;
Signature · 6 lines
2.17.1

_______________________________________________
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]

#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

I think you should use smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM].bupdate_sclk/bupdate_mclk to judge whether there is saved custom profile. That's where previous custom profile settings store in.
'tmp' is a temporary structures and you should not rely on that.

Regards,
Evan

Quoted 81 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

Allow changing to the CUSTOM profile without requiring the parameters being passed in each time. Store the values in the smu7_profiling table since it's defined here anyways

v2: Add check that CUSTOM was previously set

Change-Id I6c5e3a1487e12410a6a7670a5cf1a6599253344d
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 32 ++++++++++++--
-----
 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
index 83d3d935f3ac..048757e8f494 100644
@@ -77,7 +77,7 @@
 #define PCIE_BUS_CLK                10000
 #define TCLK                        (PCIE_BUS_CLK / 10)
 
-static const struct profile_mode_setting smu7_profiling[7] =
+static struct profile_mode_setting smu7_profiling[7] =
 					{{0, 0, 0, 0, 0, 0, 0, 0},
 					 {1, 0, 100, 30, 1, 0, 100, 10},
 					 {1, 10, 0, 30, 0, 0, 0, 0},
@@ -4984,17 +4984,27 @@ static int smu7_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, uint

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -10
 	mode = input[size];
 	switch (mode) {
 	case PP_SMC_POWER_PROFILE_CUSTOM:
-		if (size < 8)
+		if (size < 8 && size != 0)
 			return -EINVAL;
-
-		tmp.bupdate_sclk = input[0];
-		tmp.sclk_up_hyst = input[1];
-		tmp.sclk_down_hyst = input[2];
-		tmp.sclk_activity = input[3];
-		tmp.bupdate_mclk = input[4];
-		tmp.mclk_up_hyst = input[5];
-		tmp.mclk_down_hyst = input[6];
-		tmp.mclk_activity = input[7];
+		/* If only CUSTOM is passed in, use the saved values. Check
+		 * that we actually have a CUSTOM profile by ensuring that
+		 * the "use sclk" or the "use mclk" bits are set
+		 */
+		tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];
+		if (size == 0) {
+			if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk ==

0)

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +11 -0
+				return -EINVAL;
+		} else {
+			tmp.bupdate_sclk = input[0];
+			tmp.sclk_up_hyst = input[1];
+			tmp.sclk_down_hyst = input[2];
+			tmp.sclk_activity = input[3];
+			tmp.bupdate_mclk = input[4];
+			tmp.mclk_up_hyst = input[5];
+			tmp.mclk_down_hyst = input[6];
+			tmp.mclk_activity = input[7];
+			smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM]

= tmp;

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -0
+		}
 		if (!smum_update_dpm_settings(hwmgr, &tmp)) {
 			memcpy(&data->current_profile_setting, &tmp,

sizeof(struct profile_mode_setting));
hwmgr->power_profile_mode = mode;
--
2.17.1

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

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

#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

Hi Evan,

I set tmp=smu7_profiling[PP_SMC_PROFILE_CUSTOM] before checking the bupdate parameters (see below). That way I don't have ugly 100-character-long checks in the if size==0 check. Then if its invalid I just return -EINVAL, or if it'svalid then we use it to writeto the SMU. If parameters are passed in, tmp is overwritten with the passed-in values and we use it as before.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:26:41 PM
To: Russell, Kent; [email protected]
Cc: Russell, Kent
Subject: RE: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

I think you should use smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM].bupdate_sclk/bupdate_mclk to judge whether there is saved custom profile. That's where previous custom profile settings store in.
'tmp' is a temporary structures and you should not rely on that.

Regards,
Evan

Quoted 78 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on
smu7 v2

Allow changing to the CUSTOM profile without requiring the parameters being passed in each time. Store the values in the smu7_profiling table since it's defined here anyways

v2: Add check that CUSTOM was previously set

Change-Id I6c5e3a1487e12410a6a7670a5cf1a6599253344d
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 32 ++++++++++++--
-----
 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
index 83d3d935f3ac..048757e8f494 100644
@@ -77,7 +77,7 @@
 #define PCIE_BUS_CLK                10000
 #define TCLK                        (PCIE_BUS_CLK / 10)
 
-static const struct profile_mode_setting smu7_profiling[7] =
+static struct profile_mode_setting smu7_profiling[7] =
                                       {{0, 0, 0, 0, 0, 0, 0, 0},
                                        {1, 0, 100, 30, 1, 0, 100, 10},
                                        {1, 10, 0, 30, 0, 0, 0, 0},
@@ -4984,17 +4984,27 @@ static int smu7_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, uint

       mode = input[size];
       switch (mode) {
       case PP_SMC_POWER_PROFILE_CUSTOM:
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -10
-             if (size < 8)
+             if (size < 8 && size != 0)
                       return -EINVAL;
-
-             tmp.bupdate_sclk = input[0];
-             tmp.sclk_up_hyst = input[1];
-             tmp.sclk_down_hyst = input[2];
-             tmp.sclk_activity = input[3];
-             tmp.bupdate_mclk = input[4];
-             tmp.mclk_up_hyst = input[5];
-             tmp.mclk_down_hyst = input[6];
-             tmp.mclk_activity = input[7];
+             /* If only CUSTOM is passed in, use the saved values. Check
+              * that we actually have a CUSTOM profile by ensuring that
+              * the "use sclk" or the "use mclk" bits are set
+              */
+             tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];
+             if (size == 0) {
+                     if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk ==

0)

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +11 -0
+                             return -EINVAL;
+             } else {
+                     tmp.bupdate_sclk = input[0];
+                     tmp.sclk_up_hyst = input[1];
+                     tmp.sclk_down_hyst = input[2];
+                     tmp.sclk_activity = input[3];
+                     tmp.bupdate_mclk = input[4];
+                     tmp.mclk_up_hyst = input[5];
+                     tmp.mclk_down_hyst = input[6];
+                     tmp.mclk_activity = input[7];
+                     smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM]

= tmp;
+ }

               if (!smum_update_dpm_settings(hwmgr, &tmp)) {
                       memcpy(&data->current_profile_setting, &tmp,
sizeof(struct profile_mode_setting));
                       hwmgr->power_profile_mode = mode;
Quoted 7 lines

--
2.17.1

_______________________________________________
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): BN6PR12MB161820CAB9F87E2C6B5EE6D885590-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#8 lore raw

RE: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

Oops, sorry, missed that. That will be fine.

Evan

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: Thursday, March 28, 2019 5:25 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

Hi Evan,

I set tmp=smu7_profiling[PP_SMC_PROFILE_CUSTOM] before checking the bupdate parameters (see below). That way I don't have ugly 100-character-long checks in the if size==0 check. Then if its invalid I just return -EINVAL, or if it'svalid then we use it to writeto the SMU. If parameters are passed in, tmp is overwritten with the passed-in values and we use it as before.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:26:41 PM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2

I think you should use smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM].bupdate_sclk/bupdate_mclk to judge whether there is saved custom profile. That's where previous custom profile settings store in.
'tmp' is a temporary structures and you should not rely on that.

Regards,
Evan

Quoted 78 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on
smu7 v2

Allow changing to the CUSTOM profile without requiring the parameters being passed in each time. Store the values in the smu7_profiling table since it's defined here anyways

v2: Add check that CUSTOM was previously set

Change-Id I6c5e3a1487e12410a6a7670a5cf1a6599253344d
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 32 ++++++++++++--
-----
 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
index 83d3d935f3ac..048757e8f494 100644
@@ -77,7 +77,7 @@
 #define PCIE_BUS_CLK                10000
 #define TCLK                        (PCIE_BUS_CLK / 10)
 
-static const struct profile_mode_setting smu7_profiling[7] =
+static struct profile_mode_setting smu7_profiling[7] =
                                       {{0, 0, 0, 0, 0, 0, 0, 0},
                                        {1, 0, 100, 30, 1, 0, 100, 10},
                                        {1, 10, 0, 30, 0, 0, 0, 0},
@@ -4984,17 +4984,27 @@ static int smu7_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, uint

       mode = input[size];
       switch (mode) {
       case PP_SMC_POWER_PROFILE_CUSTOM:
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -10
-             if (size < 8)
+             if (size < 8 && size != 0)
                       return -EINVAL;
-
-             tmp.bupdate_sclk = input[0];
-             tmp.sclk_up_hyst = input[1];
-             tmp.sclk_down_hyst = input[2];
-             tmp.sclk_activity = input[3];
-             tmp.bupdate_mclk = input[4];
-             tmp.mclk_up_hyst = input[5];
-             tmp.mclk_down_hyst = input[6];
-             tmp.mclk_activity = input[7];
+             /* If only CUSTOM is passed in, use the saved values. Check
+              * that we actually have a CUSTOM profile by ensuring that
+              * the "use sclk" or the "use mclk" bits are set
+              */
+             tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];
+             if (size == 0) {
+                     if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk ==

0)

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +11 -0
+                             return -EINVAL;
+             } else {
+                     tmp.bupdate_sclk = input[0];
+                     tmp.sclk_up_hyst = input[1];
+                     tmp.sclk_down_hyst = input[2];
+                     tmp.sclk_activity = input[3];
+                     tmp.bupdate_mclk = input[4];
+                     tmp.mclk_up_hyst = input[5];
+                     tmp.mclk_down_hyst = input[6];
+                     tmp.mclk_activity = input[7];
+                     smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM]

= tmp;
+ }

               if (!smum_update_dpm_settings(hwmgr, &tmp)) {
                       memcpy(&data->current_profile_setting, &tmp,
sizeof(struct profile_mode_setting));
                       hwmgr->power_profile_mode = mode;
Quoted 7 lines

--
2.17.1

_______________________________________________
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

#9 lore raw
In reply to a message not in the archive

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 105 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
 						1 << power_profile_mode);
 
 	if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size == 0 || size > 4)
+		if (size != 0 && size != 4)
 			return -EINVAL;
 
+		/* If size = 0 and the CUSTOM profile has been set already
+		 * (check BUSY_SET_POINT since that is always >0 for a valid
+		 * profile) then just apply the profile.
+		 */
+		if (size == 0) {
+			if (data->custom_profile_mode[0] != 0)
+				goto out;
+			else
+				return -EINVAL;
+		}
+
 		data->custom_profile_mode[0] = busy_set_point = input[0];
 		data->custom_profile_mode[1] = FPS = input[1];
 		data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
use_rlc_busy << 16 |
min_active_level<<24);

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
 	}
 
+out:
 	hwmgr->power_profile_mode = power_profile_mode;
 
 	return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
 	}
 
 	if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size < 10)
+		if (size < 10 && size != 0)
 			return -EINVAL;
 
 		result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
 				return result);
 
+		/* If size = 0 and the CUSTOM profile has been set already
+		 * (check BoosterFreqType since that is always >0 for a valid
+		 * profile) then just apply the profile.
+		 */
+		if (size == 0) {
+			if (activity_monitor.Soc_BoosterFreqType != 0)
+				goto out;
+			else
+				return -EINVAL;
+		}
+
 		switch (input[0]) {
 		case 0: /* Gfxclk */
 			activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -0
 				return result);
 	}
 
+out:
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type =
Quoted 8 lines
	conv_power_profile_to_pplib_workload(power_profile_mode);

--
2.17.1

_______________________________________________
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): MN2PR12MB3344EAC6FE032D423A0358DFE4590-rweVpJHSKToDMgCC8P//[email protected]

#11 lore raw

Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:36:02 PM
To: Russell, Kent; [email protected]
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1 << power_profile_mode);

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
-             if (size == 0 || size > 4)
+             if (size != 0 && size != 4)
                       return -EINVAL;
 
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BUSY_SET_POINT since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (data->custom_profile_mode[0] != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               data->custom_profile_mode[0] = busy_set_point = input[0];
               data->custom_profile_mode[1] = FPS = input[1];
               data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                       use_rlc_busy << 16 |
min_active_level<<24);
       }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
+out:
       hwmgr->power_profile_mode = power_profile_mode;
 
       return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

                               return result);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BoosterFreqType since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (activity_monitor.Soc_BoosterFreqType != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               switch (input[0]) {
               case 0: /* Gfxclk */
                       activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

                               return result);
       }

+out:

       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
       workload_type =

       conv_power_profile_to_pplib_workload(power_profile_mode);
Quoted 7 lines

--
2.17.1

_______________________________________________
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): BN6PR12MB16180F6EDF5F7F62EB66707385590-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#13 lore raw

OK, I see. Yep, the new settings will be stored in SMU.
But as I know, the SMU comes with some default settings for CUSTOM profile.
I suspect "activity_monitor.Soc_BoosterFreqType != 0" will be also true even without your first CUSTOM profile settings(with input parameters). So, I would prefer to have a local copy of previous custom settigns(as what we do on vega10 and smu7).

Evan
From: Russell, Kent <[email protected]>
Sent: Thursday, March 28, 2019 5:29 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:36:02 PM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1 << power_profile_mode);

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
-             if (size == 0 || size > 4)
+             if (size != 0 && size != 4)
                       return -EINVAL;
 
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BUSY_SET_POINT since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (data->custom_profile_mode[0] != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               data->custom_profile_mode[0] = busy_set_point = input[0];
               data->custom_profile_mode[1] = FPS = input[1];
               data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                       use_rlc_busy << 16 |
min_active_level<<24);
       }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
+out:
       hwmgr->power_profile_mode = power_profile_mode;
 
       return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

                               return result);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BoosterFreqType since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (activity_monitor.Soc_BoosterFreqType != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               switch (input[0]) {
               case 0: /* Gfxclk */
                       activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

                               return result);
       }

+out:

       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
       workload_type =

       conv_power_profile_to_pplib_workload(power_profile_mode);
Quoted 7 lines

--
2.17.1

_______________________________________________
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): MN2PR12MB334492CD00FBCA9764C950F1E4590-rweVpJHSKToDMgCC8P//[email protected]

#15 lore raw

Sorry for all of the questions, Evan. I see that we store the CUSTOM profile for Vega10/Fiji, but is that a limitation of the HW not being able to store it via the SMU? It seems like a lot of extra work to store a local copy, when we can just get the copy from the GPU itself, especially if we don't need to do that on future ASICs. I would assume that the CUSTOM profile that is kept on the GPU is valid, but would it be simpler to just initialize the CUSTOM profile to the same values as the BOOTUP values when we initialize the ASIC, then submit that to the GPU, thus ensuring that the CUSTOM profile always has some valid values? Or conversely, zeroing out the CUSTOM profile on initialization, so that the check is still valid.

I have no problem doing the work, I just want to make sure that it makes the most sense and that we're not having to redo it later if the SMU standardizes things and actually allows all future ASICs to store the CUSTOM profile on the GPU. Thanks!

Kent
From: Quan, Evan
Sent: Thursday, March 28, 2019 10:47 AM
To: Russell, Kent <[email protected]>; [email protected]
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

OK, I see. Yep, the new settings will be stored in SMU.
But as I know, the SMU comes with some default settings for CUSTOM profile.
I suspect "activity_monitor.Soc_BoosterFreqType != 0" will be also true even without your first CUSTOM profile settings(with input parameters). So, I would prefer to have a local copy of previous custom settigns(as what we do on vega10 and smu7).

Evan
From: Russell, Kent <[email protected]<mailto:[email protected]>>
Sent: Thursday, March 28, 2019 5:29 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122
________________________________
From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:36:02 PM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1 << power_profile_mode);

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
-             if (size == 0 || size > 4)
+             if (size != 0 && size != 4)
                       return -EINVAL;
 
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BUSY_SET_POINT since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (data->custom_profile_mode[0] != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               data->custom_profile_mode[0] = busy_set_point = input[0];
               data->custom_profile_mode[1] = FPS = input[1];
               data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                       use_rlc_busy << 16 |
min_active_level<<24);
       }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
+out:
       hwmgr->power_profile_mode = power_profile_mode;
 
       return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

                               return result);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BoosterFreqType since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (activity_monitor.Soc_BoosterFreqType != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               switch (input[0]) {
               case 0: /* Gfxclk */
                       activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

                               return result);
       }

+out:

       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
       workload_type =

       conv_power_profile_to_pplib_workload(power_profile_mode);
Quoted 7 lines

--
2.17.1

_______________________________________________
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): DM5PR12MB1625F1CB987EC4A655678D4B855A0-2J9CzHegvk/[email protected]

#17 lore raw

Only vega and newer have the concept of profiles in the SMU. Vegas has a set of profiles that the SMU tracks directly. SMU7 parts don't really have profiles per se; there just one "state" and the driver loads all the params into that state when you request a profile (custom or hardcoded).

Alex

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Russell, Kent <[email protected]>
Sent: Friday, March 29, 2019 7:07 AM
To: Quan, Evan; [email protected]
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Sorry for all of the questions, Evan. I see that we store the CUSTOM profile for Vega10/Fiji, but is that a limitation of the HW not being able to store it via the SMU? It seems like a lot of extra work to store a local copy, when we can just get the copy from the GPU itself, especially if we don’t need to do that on future ASICs. I would assume that the CUSTOM profile that is kept on the GPU is valid, but would it be simpler to just initialize the CUSTOM profile to the same values as the BOOTUP values when we initialize the ASIC, then submit that to the GPU, thus ensuring that the CUSTOM profile always has some valid values? Or conversely, zeroing out the CUSTOM profile on initialization, so that the check is still valid.

I have no problem doing the work, I just want to make sure that it makes the most sense and that we’re not having to redo it later if the SMU standardizes things and actually allows all future ASICs to store the CUSTOM profile on the GPU. Thanks!

Kent

From: Quan, Evan
Sent: Thursday, March 28, 2019 10:47 AM
To: Russell, Kent <[email protected]>; [email protected]
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

OK, I see. Yep, the new settings will be stored in SMU.

But as I know, the SMU comes with some default settings for CUSTOM profile.

I suspect “activity_monitor.Soc_BoosterFreqType != 0” will be also true even without your first CUSTOM profile settings(with input parameters).

So, I would prefer to have a local copy of previous custom settigns(as what we do on vega10 and smu7).

Evan

From: Russell, Kent <[email protected]<mailto:[email protected]>>
Sent: Thursday, March 28, 2019 5:29 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122

________________________________

From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:36:02 PM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1 << power_profile_mode);

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
-             if (size == 0 || size > 4)
+             if (size != 0 && size != 4)
                       return -EINVAL;
 
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BUSY_SET_POINT since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (data->custom_profile_mode[0] != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               data->custom_profile_mode[0] = busy_set_point = input[0];
               data->custom_profile_mode[1] = FPS = input[1];
               data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                       use_rlc_busy << 16 |
min_active_level<<24);
       }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
+out:
       hwmgr->power_profile_mode = power_profile_mode;
 
       return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

                               return result);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BoosterFreqType since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (activity_monitor.Soc_BoosterFreqType != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               switch (input[0]) {
               case 0: /* Gfxclk */
                       activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

                               return result);
       }

+out:

       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
       workload_type =

       conv_power_profile_to_pplib_workload(power_profile_mode);
Quoted 7 lines

--
2.17.1

_______________________________________________
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): BN6PR12MB18091C286A136C72F6208D5FF75A0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#19 lore raw

Alex is right. Vega10 can also track the CUSTOM profile internally actually.

Quoted 1 line

but would it be simpler to just initialize the CUSTOM profile to the same values as the BOOTUP values when we initialize the ASIC, then submit that to the GPU, thus ensuring that the CUSTOM profile always has some valid values?

To me, that sounds not so "CUSTOM". It's better to have these settings specified by user.

Quoted 1 line

Or conversely, zeroing out the CUSTOM profile on initialization, so that the check is still valid.

That should be fine. Or you can add a new flag(to indict whether there is already custom profile settings) in struct vega20_hwmgr and initialized as zero on bootup.

Regards,
Evan
From: Deucher, Alexander <[email protected]>
Sent: Friday, March 29, 2019 10:29 PM
To: Russell, Kent <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Only vega and newer have the concept of profiles in the SMU. Vegas has a set of profiles that the SMU tracks directly. SMU7 parts don't really have profiles per se; there just one "state" and the driver loads all the params into that state when you request a profile (custom or hardcoded).

Alex

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Russell, Kent <[email protected]<mailto:[email protected]>>
Sent: Friday, March 29, 2019 7:07 AM
To: Quan, Evan; [email protected]<mailto:amd-gfx-PD4FTy7X32lzq7FAFJ/[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Sorry for all of the questions, Evan. I see that we store the CUSTOM profile for Vega10/Fiji, but is that a limitation of the HW not being able to store it via the SMU? It seems like a lot of extra work to store a local copy, when we can just get the copy from the GPU itself, especially if we don't need to do that on future ASICs. I would assume that the CUSTOM profile that is kept on the GPU is valid, but would it be simpler to just initialize the CUSTOM profile to the same values as the BOOTUP values when we initialize the ASIC, then submit that to the GPU, thus ensuring that the CUSTOM profile always has some valid values? Or conversely, zeroing out the CUSTOM profile on initialization, so that the check is still valid.

I have no problem doing the work, I just want to make sure that it makes the most sense and that we're not having to redo it later if the SMU standardizes things and actually allows all future ASICs to store the CUSTOM profile on the GPU. Thanks!

Kent

From: Quan, Evan
Sent: Thursday, March 28, 2019 10:47 AM
To: Russell, Kent <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

OK, I see. Yep, the new settings will be stored in SMU.

But as I know, the SMU comes with some default settings for CUSTOM profile.

I suspect "activity_monitor.Soc_BoosterFreqType != 0" will be also true even without your first CUSTOM profile settings(with input parameters).

So, I would prefer to have a local copy of previous custom settigns(as what we do on vega10 and smu7).

Evan

From: Russell, Kent <[email protected]<mailto:[email protected]>>
Sent: Thursday, March 28, 2019 5:29 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.

Kent

KENT RUSSELL
Sr. Software Engineer | Linux Compute Kernel
1 Commerce Valley Drive East
Markham, ON L3T 7X6
O +(1) 289-695-2122 | Ext 72122

________________________________

From: Quan, Evan
Sent: Wednesday, March 27, 2019 9:36:02 PM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2

For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.

Regards
Evan

Quoted 106 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> On Behalf Of Russell, Kent
Sent: Wednesday, March 27, 2019 9:59 PM
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on
Vega10/20 v2

Don't return an error if the CUSTOM profile is selected, just apply it with the values saved to the GPU

v2: Remove reference to fixed bug, check that CUSTOM profile was set

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14
+++++++++++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14
+++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index 85a536924571..7e9e7e254a0d 100644
@@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1 << power_profile_mode);

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +12 -1
-             if (size == 0 || size > 4)
+             if (size != 0 && size != 4)
                       return -EINVAL;
 
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BUSY_SET_POINT since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (data->custom_profile_mode[0] != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               data->custom_profile_mode[0] = busy_set_point = input[0];
               data->custom_profile_mode[1] = FPS = input[1];
               data->custom_profile_mode[2] = use_rlc_busy = input[2];
@@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                       use_rlc_busy << 16 |
min_active_level<<24);
       }
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
+out:
       hwmgr->power_profile_mode = power_profile_mode;
 
       return 0;
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 70dc641bf94d..6dc16a9e766b 100644
@@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -1
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
@@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
"[SetPowerProfile] Failed to get activity
monitor!",

                               return result);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +12 -0
+             /* If size = 0 and the CUSTOM profile has been set already
+              * (check BoosterFreqType since that is always >0 for a valid
+              * profile) then just apply the profile.
+              */
+             if (size == 0) {
+                     if (activity_monitor.Soc_BoosterFreqType != 0)
+                             goto out;
+                     else
+                             return -EINVAL;
+             }
+
               switch (input[0]) {
               case 0: /* Gfxclk */
                       activity_monitor.Gfx_FPS = input[1]; @@ -3908,6
+3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr

*hwmgr, long *input, ui

                               return result);
       }

+out:

       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
       workload_type =

       conv_power_profile_to_pplib_workload(power_profile_mode);
Quoted 7 lines

--
2.17.1

_______________________________________________
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