Skip to contentSkip to conversation

drm/amdgpu: Stop returning EINVAL during profile switch

PATCH In review Russell, Kent 2 participants 9 messages Mar 25, 2019 – Mar 26, 2019 6 messages not in the archive

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

PATCH 1/3 drm/amdgpu: Stop returning EINVAL during profile switch

Don't return an error after switching to the CUSTOM profile, if there aren't any CUSTOM values passed in. The CUSTOM profile is already applied, so if no other arguments are passed, just return instead of throwing -EINVAL when successful

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 +++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -1
index ed6c638700f5..a98b927282ac 100644
@@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 						1<<hwmgr->power_profile_mode);
 
 	if (hwmgr->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size == 0 || size > 4)
+		/* If size = 0, then just return, it was applied above */
+		if (size == 0)
+			return 0;
+
+		if (size != 4)
 			return -EINVAL;
 
 		data->custom_profile_mode[0] = busy_set_point = input[0];
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -1
index 664544e7fcdc..225b2102c82c 100644
@@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 	}
 
 	if (hwmgr->power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {
-		if (size < 10)
+		if (size < 10 && size != 0)
 			return -EINVAL;
+		/* If size = 0, then just return, it was applied above */
+		if (size == 0)
+			return 0;
 
 		result = vega20_get_activity_monitor_coeff(hwmgr,
 				(uint8_t *)(&activity_monitor),
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/3 drm/amdgpu: Allow changing to CUSTOM profile on smu7

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

Change-Id I6c5e3a1487e12410a6a7670a5cf1a6599253344d
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 27 +++++++++++--------
 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +16 -11
index 83d3d935f3ac..74d55b8fb74e 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,22 @@ 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 */
+		if (size == 0) {
+			tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];
+		} 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
#3 lore raw

PATCH 3/3 drm/amdgpu: Allow changing to BOOTUP profile on smu7

In reply to a message not in the archive

With SMU7 using case statements, against vega10/20 only checking for the CUSTOM profile, SMU7 can't set the power profile back to the BOOTUP_DEFAULT, while newer HWMGRs can. Add the case statement in to align functionality with other ASICs

Change-Id Ibc7df3b94b1a9dabcb88934e534c91209fc75967
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -0
index 74d55b8fb74e..7c3eae2a34b4 100644
@@ -5005,6 +5005,7 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint
 			hwmgr->power_profile_mode = mode;
 		}
 		break;
+	case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:
 	case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
 	case PP_SMC_POWER_PROFILE_POWERSAVING:
 	case PP_SMC_POWER_PROFILE_VIDEO:
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]

#5 lore raw

RE: [PATCH 3/3] drm/amdgpu: Allow changing to BOOTUP profile on smu7

As I know, BOOTUP profile is only available for Vega10 and later ASICs.
The BOOTUP profile for SMU7 has only some dummy settings and is not expected to switch to such mode. The default power profile for SMU7 is FULLSCREEN3D(different with Vega10 and later ASICs).

        hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];
        hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
        hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;

Regards,
Evan

Quoted 37 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: 2019年3月25日 20:42
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Allow changing to BOOTUP profile on smu7

With SMU7 using case statements, against vega10/20 only checking for the CUSTOM profile, SMU7 can't set the power profile back to the BOOTUP_DEFAULT, while newer HWMGRs can. Add the case statement in to align functionality with other ASICs

Change-Id Ibc7df3b94b1a9dabcb88934e534c91209fc75967
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index 74d55b8fb74e..7c3eae2a34b4 100644
@@ -5005,6 +5005,7 @@ static int smu7_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, uint

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
 			hwmgr->power_profile_mode = mode;
 		}
 		break;
+	case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:
 	case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
 	case PP_SMC_POWER_PROFILE_POWERSAVING:
 	case PP_SMC_POWER_PROFILE_VIDEO:
--

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

#7 lore raw

Re: [PATCH 3/3] drm/amdgpu: Allow changing to BOOTUP profile on smu7

Thanks for that confirmation Evan. I will drop this patch.

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: Monday, March 25, 2019 10:26:54 AM
To: Russell, Kent; [email protected]
Cc: Russell, Kent
Subject: RE: [PATCH 3/3] drm/amdgpu: Allow changing to BOOTUP profile on smu7

As I know, BOOTUP profile is only available for Vega10 and later ASICs.
The BOOTUP profile for SMU7 has only some dummy settings and is not expected to switch to such mode. The default power profile for SMU7 is FULLSCREEN3D(different with Vega10 and later ASICs).

        hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];
        hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
        hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;

Regards,
Evan

Quoted 37 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: 2019年3月25日 20:42
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Allow changing to BOOTUP profile on
smu7

With SMU7 using case statements, against vega10/20 only checking for the CUSTOM profile, SMU7 can't set the power profile back to the BOOTUP_DEFAULT, while newer HWMGRs can. Add the case statement in to align functionality with other ASICs

Change-Id Ibc7df3b94b1a9dabcb88934e534c91209fc75967
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index 74d55b8fb74e..7c3eae2a34b4 100644
@@ -5005,6 +5005,7 @@ static int smu7_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, uint

                       hwmgr->power_profile_mode = mode;
               }
               break;

+ case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT:
case PP_SMC_POWER_PROFILE_FULLSCREEN3D:
case PP_SMC_POWER_PROFILE_POWERSAVING:
case PP_SMC_POWER_PROFILE_VIDEO:
--
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

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

How can you tell whether it was already applied before or 1st time to switch to compute mode? For the latter case, other settings/parameters do need.

Regards,
Evan

Quoted 65 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: 2019年3月25日 20:42
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

Don't return an error after switching to the CUSTOM profile, if there aren't any CUSTOM values passed in. The CUSTOM profile is already applied, so if no other arguments are passed, just return instead of throwing -EINVAL when successful

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 +++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index ed6c638700f5..a98b927282ac 100644
@@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui
1<<hwmgr-

Quoted 1 line

power_profile_mode);

if (hwmgr->power_profile_mode ==
PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -1
-		if (size == 0 || size > 4)
+		/* If size = 0, then just return, it was applied above */
+		if (size == 0)
+			return 0;
+
+		if (size != 4)
 			return -EINVAL;
 
 		data->custom_profile_mode[0] = busy_set_point = input[0];
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 664544e7fcdc..225b2102c82c 100644
@@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
 	}
 
 	if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -2
-		if (size < 10)
+		if (size < 10 && size != 0)
 			return -EINVAL;
+		/* If size = 0, then just return, it was applied above */
+		if (size == 0)
+			return 0;
 
 		result = vega20_get_activity_monitor_coeff(hwmgr,
 				(uint8_t *)(&activity_monitor),
--

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

#10 lore raw

I set CUSTOM to a weird value like "1 2 3 4 5 6" , then switched to VR profile, then switched back to CUSTOM (just with "echo 6 > profile), and it kept my custom values. Before this patch, it throws EINVAL but still switches it to CUSTOM with the saved values, on both vega10 and vega20.

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: Monday, March 25, 2019 10:14:03 AM
To: Russell, Kent; [email protected]
Cc: Russell, Kent
Subject: RE: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

How can you tell whether it was already applied before or 1st time to switch to compute mode? For the latter case, other settings/parameters do need.

Regards,
Evan

Quoted 65 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Russell, Kent
Sent: 2019年3月25日 20:42
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile
switch

Don't return an error after switching to the CUSTOM profile, if there aren't any CUSTOM values passed in. The CUSTOM profile is already applied, so if no other arguments are passed, just return instead of throwing -EINVAL when successful

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 +++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index ed6c638700f5..a98b927282ac 100644
@@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1<<hwmgr-
Quoted 1 line

power_profile_mode);

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -1
-             if (size == 0 || size > 4)
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
+
+             if (size != 4)
                       return -EINVAL;
 
               data->custom_profile_mode[0] = busy_set_point = input[0];
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 664544e7fcdc..225b2102c82c 100644
@@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -2
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
                               (uint8_t *)(&activity_monitor),
--

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

#12 lore raw

That seems a bug. I will fix that.
It’s OK to store previous CUSTOM profile settings in driver and switch back to that with no need to pass in settings again. That makes sense. But you may need to update the patch(to check whether there is previous custom profile settings).

Regards,
Evan
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: 2019年3月26日 0:00
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

I set CUSTOM to a weird value like "1 2 3 4 5 6" , then switched to VR profile, then switched back to CUSTOM (just with "echo 6 > profile), and it kept my custom values. Before this patch, it throws EINVAL but still switches it to CUSTOM with the saved values, on both vega10 and vega20.

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: Monday, March 25, 2019 10:14:03 AM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

How can you tell whether it was already applied before or 1st time to switch to compute mode? For the latter case, other settings/parameters do need.

Regards,
Evan

Quoted 65 lines

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Russell, Kent
Sent: 2019年3月25日 20:42
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile
switch

Don't return an error after switching to the CUSTOM profile, if there aren't any CUSTOM values passed in. The CUSTOM profile is already applied, so if no other arguments are passed, just return instead of throwing -EINVAL when successful

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 +++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index ed6c638700f5..a98b927282ac 100644
@@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1<<hwmgr-
Quoted 1 line

power_profile_mode);

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -1
-             if (size == 0 || size > 4)
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
+
+             if (size != 4)
                       return -EINVAL;
 
               data->custom_profile_mode[0] = busy_set_point = input[0];
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 664544e7fcdc..225b2102c82c 100644
@@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -2
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
                               (uint8_t *)(&activity_monitor),
--

2.17.1

Quoted 4 lines

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

#14 lore raw

Indeed, it allowed me to apply the profile even with no previous profile set (so it basically just applied all zeros). I’ll rebase my 2 patches on your patch once that is pushed to drm-next.

Kent

From: Quan, Evan
Sent: Tuesday, March 26, 2019 5:10 AM
To: Russell, Kent <[email protected]>; [email protected]
Subject: RE: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

That seems a bug. I will fix that.
It’s OK to store previous CUSTOM profile settings in driver and switch back to that with no need to pass in settings again. That makes sense. But you may need to update the patch(to check whether there is previous custom profile settings).

Regards,
Evan
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Russell, Kent
Sent: 2019年3月26日 0:00
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

I set CUSTOM to a weird value like "1 2 3 4 5 6" , then switched to VR profile, then switched back to CUSTOM (just with "echo 6 > profile), and it kept my custom values. Before this patch, it throws EINVAL but still switches it to CUSTOM with the saved values, on both vega10 and vega20.

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: Monday, March 25, 2019 10:14:03 AM
To: Russell, Kent; [email protected]<mailto:[email protected]>
Cc: Russell, Kent
Subject: RE: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch

How can you tell whether it was already applied before or 1st time to switch to compute mode? For the latter case, other settings/parameters do need.

Regards,
Evan

Quoted 65 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: 2019年3月25日 20:42
To: [email protected]<mailto:[email protected]>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile
switch

Don't return an error after switching to the CUSTOM profile, if there aren't any CUSTOM values passed in. The CUSTOM profile is already applied, so if no other arguments are passed, just return instead of throwing -EINVAL when successful

Change-Id I114cc9783226ee9ebb146863897e951527a85e20
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 6 +++++-
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -0
index ed6c638700f5..a98b927282ac 100644
@@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

                                               1<<hwmgr-
Quoted 1 line

power_profile_mode);

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +5 -1
-             if (size == 0 || size > 4)
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
+
+             if (size != 4)
                       return -EINVAL;
 
               data->custom_profile_mode[0] = busy_set_point = input[0];
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +0 -0
index 664544e7fcdc..225b2102c82c 100644
@@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct

pp_hwmgr *hwmgr, long *input, ui

       }

       if (hwmgr->power_profile_mode ==

PP_SMC_POWER_PROFILE_CUSTOM) {

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -2
-             if (size < 10)
+             if (size < 10 && size != 0)
                       return -EINVAL;
+             /* If size = 0, then just return, it was applied above */
+             if (size == 0)
+                     return 0;
 
               result = vega20_get_activity_monitor_coeff(hwmgr,
                               (uint8_t *)(&activity_monitor),
--

2.17.1

Quoted 4 lines

_______________________________________________
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