All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: add flag for runtime suspend
@ 2020-02-07 15:18 Alex Deucher
  2020-02-07 15:18 ` [PATCH 2/3] drm/amdgpu/smu: properly handle runpm/suspend/reset Alex Deucher
  2020-02-07 15:18 ` [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20 Alex Deucher
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Deucher @ 2020-02-07 15:18 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

So we know whether we in are in runtime suspend or
system suspend.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index b4b00e5c82c1..7bc703387f26 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -976,6 +976,7 @@ struct amdgpu_device {
 	int				pstate;
 	/* enable runtime pm on the device */
 	bool                            runpm;
+	bool                            in_runpm;
 
 	bool                            pm_sysfs_en;
 	bool                            ucode_sysfs_en;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f28d040de3ce..1a8659efad53 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1230,6 +1230,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 		}
 	}
 
+	adev->in_runpm = true;
 	if (amdgpu_device_supports_boco(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 	drm_kms_helper_poll_disable(drm_dev);
@@ -1288,6 +1289,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
 	drm_kms_helper_poll_enable(drm_dev);
 	if (amdgpu_device_supports_boco(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
+	adev->in_runpm = false;
 	return 0;
 }
 
-- 
2.24.1

_______________________________________________
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

* [PATCH 2/3] drm/amdgpu/smu: properly handle runpm/suspend/reset
  2020-02-07 15:18 [PATCH 1/3] drm/amdgpu: add flag for runtime suspend Alex Deucher
@ 2020-02-07 15:18 ` Alex Deucher
  2020-02-07 15:18 ` [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20 Alex Deucher
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-02-07 15:18 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

We need some special handling when using baco vs. other
things.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 35 ++++++++++++----------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 0e9d33ee08ab..53ea5343fbed 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu)
 	return ret;
 }
 
-static int smu_disabled_dpms(struct smu_context *smu)
+static int smu_disable_dpm(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	uint32_t smu_version;
 	int ret = 0;
+	bool use_baco = !smu->is_apu &&
+		((adev->in_gpu_reset &&
+		  (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
+		 (adev->in_runpm && amdgpu_asic_supports_baco(adev)));
 
 	ret = smu_get_smc_version(smu, NULL, &smu_version);
 	if (ret) {
@@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu)
 	}
 
 	/*
-	 * For baco reset on Arcturus, this operation
+	 * For baco on Arcturus, this operation
 	 * (disable all smu feature) will be handled by SMU FW.
 	 */
-	if (adev->in_gpu_reset &&
-	    (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) &&
-	    (adev->asic_type == CHIP_ARCTURUS && smu_version > 0x360e00))
-		return 0;
+	if (adev->asic_type == CHIP_ARCTURUS) {
+		if (use_baco && (smu_version > 0x360e00))
+			return 0;
+	}
 
 	/* Disable all enabled SMU features */
 	ret = smu_system_features_control(smu, false);
@@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu)
 		return ret;
 	}
 
-	/* For baco reset, need to leave BACO feature enabled */
-	if (adev->in_gpu_reset &&
-	    (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) &&
-	    !smu->is_apu &&
-	    smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
-		ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
-		if (ret) {
-			pr_warn("set BACO feature enabled failed, return %d\n", ret);
-			return ret;
+	/* For baco, need to leave BACO feature enabled */
+	if (use_baco) {
+		if (smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
+			ret = smu_feature_set_enabled(smu, SMU_FEATURE_BACO_BIT, true);
+			if (ret) {
+				pr_warn("set BACO feature enabled failed, return %d\n", ret);
+				return ret;
+			}
 		}
 	}
 
@@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle)
 		return 0;
 
 	if(!amdgpu_sriov_vf(adev)) {
-		ret = smu_disabled_dpms(smu);
+		ret = smu_disable_dpm(smu);
 		if (ret)
 			return ret;
 	}
-- 
2.24.1

_______________________________________________
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

* [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20
  2020-02-07 15:18 [PATCH 1/3] drm/amdgpu: add flag for runtime suspend Alex Deucher
  2020-02-07 15:18 ` [PATCH 2/3] drm/amdgpu/smu: properly handle runpm/suspend/reset Alex Deucher
@ 2020-02-07 15:18 ` Alex Deucher
  2020-02-10  2:58   ` Quan, Evan
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2020-02-07 15:18 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

We need to handle the runpm case as well as GPU reset.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index 3b3ec5666051..08b6ba39a6d7 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -487,15 +487,16 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
 	int ret = 0;
+	bool use_baco = (adev->in_gpu_reset &&
+			 (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) ||
+		(adev->in_runpm && amdgpu_asic_supports_baco(adev));
 
 	ret = vega20_init_sclk_threshold(hwmgr);
 	PP_ASSERT_WITH_CODE(!ret,
 			"Failed to init sclk threshold!",
 			return ret);
 
-	if (adev->in_gpu_reset &&
-	    (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) {
-
+	if (use_baco) {
 		ret = vega20_baco_apply_vdci_flush_workaround(hwmgr);
 		if (ret)
 			pr_err("Failed to apply vega20 baco workaround!\n");
-- 
2.24.1

_______________________________________________
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 3/3] drm/amdgpu/powerplay: fix baco check for vega20
  2020-02-07 15:18 ` [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20 Alex Deucher
@ 2020-02-10  2:58   ` Quan, Evan
  0 siblings, 0 replies; 4+ messages in thread
From: Quan, Evan @ 2020-02-10  2:58 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: Deucher, Alexander

Thanks for the fixes. The series is reviewed-by: Evan Quan <evan.quan@amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Friday, February 7, 2020 11:19 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20
> 
> We need to handle the runpm case as well as GPU reset.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> index 3b3ec5666051..08b6ba39a6d7 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> @@ -487,15 +487,16 @@ static int vega20_setup_asic_task(struct pp_hwmgr
> *hwmgr)  {
>  	struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr-
> >adev);
>  	int ret = 0;
> +	bool use_baco = (adev->in_gpu_reset &&
> +			 (amdgpu_asic_reset_method(adev) ==
> AMD_RESET_METHOD_BACO)) ||
> +		(adev->in_runpm && amdgpu_asic_supports_baco(adev));
> 
>  	ret = vega20_init_sclk_threshold(hwmgr);
>  	PP_ASSERT_WITH_CODE(!ret,
>  			"Failed to init sclk threshold!",
>  			return ret);
> 
> -	if (adev->in_gpu_reset &&
> -	    (amdgpu_asic_reset_method(adev) ==
> AMD_RESET_METHOD_BACO)) {
> -
> +	if (use_baco) {
>  		ret = vega20_baco_apply_vdci_flush_workaround(hwmgr);
>  		if (ret)
>  			pr_err("Failed to apply vega20 baco workaround!\n");
> --
> 2.24.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
> freedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7C781e5f8feb044301f
> 50408d7abe11d18%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6
> 37166855729019493&amp;sdata=L8aUO%2F8ut25Yf7zVSfMDE207bcyYnYi2hd
> 7ANXL6vEk%3D&amp;reserved=0
_______________________________________________
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

end of thread, other threads:[~2020-02-10  2:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 15:18 [PATCH 1/3] drm/amdgpu: add flag for runtime suspend Alex Deucher
2020-02-07 15:18 ` [PATCH 2/3] drm/amdgpu/smu: properly handle runpm/suspend/reset Alex Deucher
2020-02-07 15:18 ` [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20 Alex Deucher
2020-02-10  2:58   ` Quan, Evan

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.