dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M
@ 2020-07-17  7:09 Qiu Wenbo
  2020-07-17  9:07 ` Quan, Evan
  2020-07-21 17:12 ` Alex Deucher
  0 siblings, 2 replies; 3+ messages in thread
From: Qiu Wenbo @ 2020-07-17  7:09 UTC (permalink / raw)
  To: Evan Quan, amd-gfx
  Cc: Chen Wandun, David Airlie, Qiu Wenbo, YueHaibing, linux-kernel,
	dri-devel, Eric Huang, Alex Deucher, yu kuai,
	Christian König

Avoid kernel crash when vddci_control is SMU7_VOLTAGE_CONTROL_NONE and
vddci_voltage_table is empty. It has been tested on Intel Hades Canyon
(i7-8809G).

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=208489
Fixes: ac7822b0026f ("drm/amd/powerplay: add smumgr support for VEGAM (v2)")
Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
---
 drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 3da71a088b92..0ecc18b55ffb 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -644,9 +644,6 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
 
 	/* sclk is bigger than max sclk in the dependence table */
 	*voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
-	vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
-			(dep_table->entries[i - 1].vddc -
-					(uint16_t)VDDC_VDDCI_DELTA));
 
 	if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
 		*voltage |= (data->vbios_boot_state.vddci_bootup_value *
@@ -654,8 +651,13 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
 	else if (dep_table->entries[i - 1].vddci)
 		*voltage |= (dep_table->entries[i - 1].vddci *
 				VOLTAGE_SCALE) << VDDC_SHIFT;
-	else
+	else {
+		vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
+				(dep_table->entries[i - 1].vddc -
+						(uint16_t)VDDC_VDDCI_DELTA));
+
 		*voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
+	}
 
 	if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
 		*mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* RE: [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M
  2020-07-17  7:09 [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M Qiu Wenbo
@ 2020-07-17  9:07 ` Quan, Evan
  2020-07-21 17:12 ` Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Quan, Evan @ 2020-07-17  9:07 UTC (permalink / raw)
  To: Qiu Wenbo, amd-gfx
  Cc: David Airlie, YueHaibing, linux-kernel, dri-devel, Huang,
	JinHuiEric, Chen Wandun, Deucher, Alexander, yu kuai, Koenig,
	Christian

[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Evan Quan <evan.quan@amd.com>

-----Original Message-----
From: Qiu Wenbo <qiuwenbo@phytium.com.cn>
Sent: Friday, July 17, 2020 3:10 PM
To: Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Qiu Wenbo <qiuwenbo@phytium.com.cn>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter <daniel@ffwll.ch>; Chen Wandun <chenwandun@huawei.com>; YueHaibing <yuehaibing@huawei.com>; yu kuai <yukuai3@huawei.com>; Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M

Avoid kernel crash when vddci_control is SMU7_VOLTAGE_CONTROL_NONE and
vddci_voltage_table is empty. It has been tested on Intel Hades Canyon
(i7-8809G).

Bug: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D208489&amp;data=02%7C01%7Cevan.quan%40amd.com%7Cff6bf841473b46539e1708d82a20723d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637305666456662890&amp;sdata=%2FMXKE9MMkUF2JPR3JiCTNdgAyyRnQXkxpZfS9eTPrW8%3D&amp;reserved=0
Fixes: ac7822b0026f ("drm/amd/powerplay: add smumgr support for VEGAM (v2)")
Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
---
 drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 3da71a088b92..0ecc18b55ffb 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -644,9 +644,6 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,

 /* sclk is bigger than max sclk in the dependence table */
 *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
-vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
-(dep_table->entries[i - 1].vddc -
-(uint16_t)VDDC_VDDCI_DELTA));

 if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
 *voltage |= (data->vbios_boot_state.vddci_bootup_value *
@@ -654,8 +651,13 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
 else if (dep_table->entries[i - 1].vddci)
 *voltage |= (dep_table->entries[i - 1].vddci *
 VOLTAGE_SCALE) << VDDC_SHIFT;
-else
+else {
+vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
+(dep_table->entries[i - 1].vddc -
+(uint16_t)VDDC_VDDCI_DELTA));
+
 *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
+}

 if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
 *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;
--
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M
  2020-07-17  7:09 [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M Qiu Wenbo
  2020-07-17  9:07 ` Quan, Evan
@ 2020-07-21 17:12 ` Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2020-07-21 17:12 UTC (permalink / raw)
  To: Qiu Wenbo
  Cc: David Airlie, YueHaibing, LKML, amd-gfx list, Alex Deucher,
	Maling list - DRI developers, Chen Wandun, Eric Huang, yu kuai,
	Evan Quan, Christian König

Applied.  Thanks!

Alex

On Fri, Jul 17, 2020 at 8:23 AM Qiu Wenbo <qiuwenbo@phytium.com.cn> wrote:
>
> Avoid kernel crash when vddci_control is SMU7_VOLTAGE_CONTROL_NONE and
> vddci_voltage_table is empty. It has been tested on Intel Hades Canyon
> (i7-8809G).
>
> Bug: https://bugzilla.kernel.org/show_bug.cgi?id=208489
> Fixes: ac7822b0026f ("drm/amd/powerplay: add smumgr support for VEGAM (v2)")
> Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
> ---
>  drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> index 3da71a088b92..0ecc18b55ffb 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> @@ -644,9 +644,6 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
>
>         /* sclk is bigger than max sclk in the dependence table */
>         *voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
> -       vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
> -                       (dep_table->entries[i - 1].vddc -
> -                                       (uint16_t)VDDC_VDDCI_DELTA));
>
>         if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
>                 *voltage |= (data->vbios_boot_state.vddci_bootup_value *
> @@ -654,8 +651,13 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
>         else if (dep_table->entries[i - 1].vddci)
>                 *voltage |= (dep_table->entries[i - 1].vddci *
>                                 VOLTAGE_SCALE) << VDDC_SHIFT;
> -       else
> +       else {
> +               vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
> +                               (dep_table->entries[i - 1].vddc -
> +                                               (uint16_t)VDDC_VDDCI_DELTA));
> +
>                 *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
> +       }
>
>         if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
>                 *mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-07-21 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  7:09 [PATCH] drm/amd/powerplay: fix a crash when overclocking Vega M Qiu Wenbo
2020-07-17  9:07 ` Quan, Evan
2020-07-21 17:12 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).