[2/2] drm/amd/powerplay: check SMU engine readiness before proceeding on S3 resume

Submitted by Quan, Evan on Sept. 11, 2019, 11:50 a.m.

Details

Message ID 20190911115001.13864-2-evan.quan@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Quan, Evan Sept. 11, 2019, 11:50 a.m.
This is especially needed for non-psp loading way.

Change-Id: I1e523168ed4892c34c8cbb66077c3f9288dd8006
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 28 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 25f3c9e1b404..95969c98a108 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1213,11 +1213,10 @@  static int smu_free_memory_pool(struct smu_context *smu)
 	return ret;
 }
 
-static int smu_hw_init(void *handle)
+static int smu_start_smc_engine(struct smu_context *smu)
 {
-	int ret;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	struct smu_context *smu = &adev->smu;
+	struct amdgpu_device *adev = smu->adev;
+	int ret = 0;
 
 	if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
 		if (adev->asic_type < CHIP_NAVI10) {
@@ -1228,8 +1227,21 @@  static int smu_hw_init(void *handle)
 	}
 
 	ret = smu_check_fw_status(smu);
+	if (ret)
+		pr_err("SMC is not ready\n");
+
+	return ret;
+}
+
+static int smu_hw_init(void *handle)
+{
+	int ret;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct smu_context *smu = &adev->smu;
+
+	ret = smu_start_smc_engine(smu);
 	if (ret) {
-		pr_err("SMC firmware status is not correct\n");
+		pr_err("SMU is not ready yet!\n");
 		return ret;
 	}
 
@@ -1389,6 +1401,12 @@  static int smu_resume(void *handle)
 
 	mutex_lock(&smu->mutex);
 
+	ret = smu_start_smc_engine(smu);
+	if (ret) {
+		pr_err("SMU is not ready yet!\n");
+		return ret;
+	}
+
 	ret = smu_smc_table_hw_init(smu, false);
 	if (ret)
 		goto failed;

Comments

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

On Wed, Sep 11, 2019 at 7:50 AM Quan, Evan <Evan.Quan@amd.com> wrote:
>
> This is especially needed for non-psp loading way.
>
> Change-Id: I1e523168ed4892c34c8cbb66077c3f9288dd8006
> Signed-off-by: Evan Quan <evan.quan@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 28 ++++++++++++++++++----
>  1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 25f3c9e1b404..95969c98a108 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1213,11 +1213,10 @@ static int smu_free_memory_pool(struct smu_context *smu)
>         return ret;
>  }
>
> -static int smu_hw_init(void *handle)
> +static int smu_start_smc_engine(struct smu_context *smu)
>  {
> -       int ret;
> -       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> -       struct smu_context *smu = &adev->smu;
> +       struct amdgpu_device *adev = smu->adev;
> +       int ret = 0;
>
>         if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
>                 if (adev->asic_type < CHIP_NAVI10) {
> @@ -1228,8 +1227,21 @@ static int smu_hw_init(void *handle)
>         }
>
>         ret = smu_check_fw_status(smu);
> +       if (ret)
> +               pr_err("SMC is not ready\n");
> +
> +       return ret;
> +}
> +
> +static int smu_hw_init(void *handle)
> +{
> +       int ret;
> +       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> +       struct smu_context *smu = &adev->smu;
> +
> +       ret = smu_start_smc_engine(smu);
>         if (ret) {
> -               pr_err("SMC firmware status is not correct\n");
> +               pr_err("SMU is not ready yet!\n");
>                 return ret;
>         }
>
> @@ -1389,6 +1401,12 @@ static int smu_resume(void *handle)
>
>         mutex_lock(&smu->mutex);
>
> +       ret = smu_start_smc_engine(smu);
> +       if (ret) {
> +               pr_err("SMU is not ready yet!\n");
> +               return ret;
> +       }
> +
>         ret = smu_smc_table_hw_init(smu, false);
>         if (ret)
>                 goto failed;
> --
> 2.23.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx