All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pp: enable power limit increase in OD mode
@ 2018-10-10 23:25 Greathouse, Joseph
       [not found] ` <1539213914-3487-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Greathouse, Joseph @ 2018-10-10 23:25 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Greathouse, Joseph

OverDrive mode allows users to increase the maximum SCLK and MCLK
frequencies beyond the default on the GPU. However, this may not
results in large performance gains if the GPU then runs into its TDP
power limit. This patch adds the capability to increase the power
limit of a GPU above its default maximum.

This is only allowed when overdrive is enabled in the ppfeaturemask,
since this is an overdrive feature. The TDPODLimit value from the
VBIOS describes how how much higher the TDP should be allowed to go
over its default, in percentage.

Signed-off-by: Joseph Greathouse <Joseph.Greathouse@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 75b56ae..5b0b6b6 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -958,6 +958,7 @@ static int pp_dpm_switch_power_profile(void *handle,
 static int pp_set_power_limit(void *handle, uint32_t limit)
 {
 	struct pp_hwmgr *hwmgr = handle;
+	uint32_t max_power_limit = hwmgr->default_power_limit;
 
 	if (!hwmgr || !hwmgr->pm_en)
 		return -EINVAL;
@@ -970,7 +971,12 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
 	if (limit == 0)
 		limit = hwmgr->default_power_limit;
 
-	if (limit > hwmgr->default_power_limit)
+	if (hwmgr->od_enabled) {
+		max_power_limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+		max_power_limit /= 100;
+	}
+
+	if (limit > max_power_limit)
 		return -EINVAL;
 
 	mutex_lock(&hwmgr->smu_lock);
@@ -989,8 +995,13 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
 
 	mutex_lock(&hwmgr->smu_lock);
 
-	if (default_limit)
+	if (default_limit) {
 		*limit = hwmgr->default_power_limit;
+		if (hwmgr->od_enabled) {
+			*limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+			*limit /= 100;
+		}
+	}
 	else
 		*limit = hwmgr->power_limit;
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amd/pp: enable power limit increase in OD mode
       [not found] ` <1539213914-3487-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
@ 2018-10-11  3:26   ` Alex Deucher
       [not found]     ` <CADnq5_PTpasw+7FdSBc__Oc8MU_n9W-qE0pJuxUGefrFkCw1zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2018-10-11  3:26 UTC (permalink / raw)
  To: Joseph.Greathouse-5C7GfCeVMHo; +Cc: amd-gfx list

On Wed, Oct 10, 2018 at 7:25 PM Greathouse, Joseph
<Joseph.Greathouse@amd.com> wrote:
>
> OverDrive mode allows users to increase the maximum SCLK and MCLK
> frequencies beyond the default on the GPU. However, this may not
> results in large performance gains if the GPU then runs into its TDP
> power limit. This patch adds the capability to increase the power
> limit of a GPU above its default maximum.
>
> This is only allowed when overdrive is enabled in the ppfeaturemask,
> since this is an overdrive feature. The TDPODLimit value from the
> VBIOS describes how how much higher the TDP should be allowed to go
> over its default, in percentage.
>
> Signed-off-by: Joseph Greathouse <Joseph.Greathouse@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> index 75b56ae..5b0b6b6 100644
> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> @@ -958,6 +958,7 @@ static int pp_dpm_switch_power_profile(void *handle,
>  static int pp_set_power_limit(void *handle, uint32_t limit)
>  {
>         struct pp_hwmgr *hwmgr = handle;
> +       uint32_t max_power_limit = hwmgr->default_power_limit;
>
>         if (!hwmgr || !hwmgr->pm_en)
>                 return -EINVAL;
> @@ -970,7 +971,12 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
>         if (limit == 0)
>                 limit = hwmgr->default_power_limit;
>
> -       if (limit > hwmgr->default_power_limit)
> +       if (hwmgr->od_enabled) {
> +               max_power_limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
> +               max_power_limit /= 100;
> +       }
> +
> +       if (limit > max_power_limit)
>                 return -EINVAL;
>
>         mutex_lock(&hwmgr->smu_lock);
> @@ -989,8 +995,13 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
>
>         mutex_lock(&hwmgr->smu_lock);
>
> -       if (default_limit)
> +       if (default_limit) {
>                 *limit = hwmgr->default_power_limit;
> +               if (hwmgr->od_enabled) {
> +                       *limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
> +                       *limit /= 100;
> +               }
> +       }
>         else
>                 *limit = hwmgr->power_limit;
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] drm/amd/pp: enable power limit increase in OD mode
       [not found]     ` <CADnq5_PTpasw+7FdSBc__Oc8MU_n9W-qE0pJuxUGefrFkCw1zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-10-18 19:44       ` Greathouse, Joseph
       [not found]         ` <1539891802-4011-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Greathouse, Joseph @ 2018-10-18 19:44 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Greathouse, Joseph

OverDrive mode allows users to increase the maximum SCLK and MCLK
frequencies beyond the default on the GPU. However, this may not
results in large performance gains if the GPU then runs into its TDP
power limit. This patch adds the capability to increase the power
limit of a GPU above its default maximum.

This is only allowed when overdrive is enabled in the ppfeaturemask,
since this is an overdrive feature. The TDPODLimit value from the
VBIOS describes how how much higher the TDP should be allowed to go
over its default, in percentage.

v2: Moved dereference of hwmgr to after its validity check

Signed-off-by: Joseph Greathouse <Joseph.Greathouse@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index e8964ca..586f1ff 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -963,6 +963,7 @@ static int pp_dpm_switch_power_profile(void *handle,
 static int pp_set_power_limit(void *handle, uint32_t limit)
 {
 	struct pp_hwmgr *hwmgr = handle;
+	uint32_t max_power_limit;
 
 	if (!hwmgr || !hwmgr->pm_en)
 		return -EINVAL;
@@ -975,7 +976,13 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
 	if (limit == 0)
 		limit = hwmgr->default_power_limit;
 
-	if (limit > hwmgr->default_power_limit)
+	max_power_limit = hwmgr->default_power_limit;
+	if (hwmgr->od_enabled) {
+		max_power_limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+		max_power_limit /= 100;
+	}
+
+	if (limit > max_power_limit)
 		return -EINVAL;
 
 	mutex_lock(&hwmgr->smu_lock);
@@ -994,8 +1001,13 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
 
 	mutex_lock(&hwmgr->smu_lock);
 
-	if (default_limit)
+	if (default_limit) {
 		*limit = hwmgr->default_power_limit;
+		if (hwmgr->od_enabled) {
+			*limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+			*limit /= 100;
+		}
+	}
 	else
 		*limit = hwmgr->power_limit;
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/amd/pp: enable power limit increase in OD mode
       [not found]         ` <1539891802-4011-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
@ 2018-10-18 19:45           ` Deucher, Alexander
  0 siblings, 0 replies; 4+ messages in thread
From: Deucher, Alexander @ 2018-10-18 19:45 UTC (permalink / raw)
  To: Greathouse, Joseph, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 3122 bytes --]

Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Greathouse, Joseph <Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
Sent: Thursday, October 18, 2018 3:44:39 PM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Greathouse, Joseph
Subject: [PATCH v2] drm/amd/pp: enable power limit increase in OD mode

OverDrive mode allows users to increase the maximum SCLK and MCLK
frequencies beyond the default on the GPU. However, this may not
results in large performance gains if the GPU then runs into its TDP
power limit. This patch adds the capability to increase the power
limit of a GPU above its default maximum.

This is only allowed when overdrive is enabled in the ppfeaturemask,
since this is an overdrive feature. The TDPODLimit value from the
VBIOS describes how how much higher the TDP should be allowed to go
over its default, in percentage.

v2: Moved dereference of hwmgr to after its validity check

Signed-off-by: Joseph Greathouse <Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index e8964ca..586f1ff 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -963,6 +963,7 @@ static int pp_dpm_switch_power_profile(void *handle,
 static int pp_set_power_limit(void *handle, uint32_t limit)
 {
         struct pp_hwmgr *hwmgr = handle;
+       uint32_t max_power_limit;

         if (!hwmgr || !hwmgr->pm_en)
                 return -EINVAL;
@@ -975,7 +976,13 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
         if (limit == 0)
                 limit = hwmgr->default_power_limit;

-       if (limit > hwmgr->default_power_limit)
+       max_power_limit = hwmgr->default_power_limit;
+       if (hwmgr->od_enabled) {
+               max_power_limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+               max_power_limit /= 100;
+       }
+
+       if (limit > max_power_limit)
                 return -EINVAL;

         mutex_lock(&hwmgr->smu_lock);
@@ -994,8 +1001,13 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)

         mutex_lock(&hwmgr->smu_lock);

-       if (default_limit)
+       if (default_limit) {
                 *limit = hwmgr->default_power_limit;
+               if (hwmgr->od_enabled) {
+                       *limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+                       *limit /= 100;
+               }
+       }
         else
                 *limit = hwmgr->power_limit;

--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 5896 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-18 19:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 23:25 [PATCH] drm/amd/pp: enable power limit increase in OD mode Greathouse, Joseph
     [not found] ` <1539213914-3487-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
2018-10-11  3:26   ` Alex Deucher
     [not found]     ` <CADnq5_PTpasw+7FdSBc__Oc8MU_n9W-qE0pJuxUGefrFkCw1zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-18 19:44       ` [PATCH v2] " Greathouse, Joseph
     [not found]         ` <1539891802-4011-1-git-send-email-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org>
2018-10-18 19:45           ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.