Skip to contentSkip to conversation

drm/amd/powerplay: avoid DPM reenable process on Navi1x ASICs

PATCH In review Evan Quan 3 participants 4 messages Nov 11, 2019 – Nov 12, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: avoid DPM reenable process on Navi1x ASICs

Otherwise, without RLC reinitialization, the DPM reenablement will fail. That affects the custom pptable uploading.

Change-Id I6fe2ed5ce23f2a5b66f371c0b6d1f924837e5af6
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 32 +++++++++++++++----
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +25 -7
index 76a4154b3be2..a4d67b30fd72 100644
@@ -1293,10 +1293,25 @@ static int smu_hw_fini(void *handle)
 		return ret;
 	}
 
-	ret = smu_stop_dpms(smu);
-	if (ret) {
-		pr_warn("Fail to stop Dpms!\n");
-		return ret;
+	/*
+	 * For custom pptable uploading, skip the DPM features
+	 * disable process on Navi1x ASICs.
+	 *   - As the gfx related features are under control of
+	 *     RLC on those ASICs. RLC reinitialization will be
+	 *     needed to reenable them. That will cost much more
+	 *     efforts.
+	 *
+	 *   - SMU firmware can handle the DPM reenablement
+	 *     properly.
+	 */
+	if (!smu->uploading_custom_pp_table ||
+	    !((adev->asic_type >= CHIP_NAVI10) &&
+	      (adev->asic_type <= CHIP_NAVI12))) {
+		ret = smu_stop_dpms(smu);
+		if (ret) {
+			pr_warn("Fail to stop Dpms!\n");
+			return ret;
+		}
 	}
 
 	kfree(table_context->driver_pptable);
@@ -1324,13 +1339,16 @@ int smu_reset(struct smu_context *smu)
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
 
+	smu->uploading_custom_pp_table = true;
+
 	ret = smu_hw_fini(adev);
 	if (ret)
-		return ret;
+		goto out;
 
 	ret = smu_hw_init(adev);
-	if (ret)
-		return ret;
+
+out:
+	smu->uploading_custom_pp_table = false;
 
 	return ret;
 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
index 8120e7587585..215841f5fb93 100644
@@ -391,6 +391,7 @@ struct smu_context
 
 	uint32_t smc_if_version;
 
+	bool uploading_custom_pp_table;
 };
 
 struct i2c_adapter;
Signature · 6 lines
2.24.0

_______________________________________________
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
Quoted 46 lines · Evan Quan

Otherwise, without RLC reinitialization, the DPM reenablement will fail. That affects the custom pptable uploading.

Change-Id I6fe2ed5ce23f2a5b66f371c0b6d1f924837e5af6
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 32 +++++++++++++++----
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +19 -4
index 76a4154b3be2..a4d67b30fd72 100644
@@ -1293,10 +1293,25 @@ static int smu_hw_fini(void *handle)
                return ret;
        }
 
-       ret = smu_stop_dpms(smu);
-       if (ret) {
-               pr_warn("Fail to stop Dpms!\n");
-               return ret;
+       /*
+        * For custom pptable uploading, skip the DPM features
+        * disable process on Navi1x ASICs.
+        *   - As the gfx related features are under control of
+        *     RLC on those ASICs. RLC reinitialization will be
+        *     needed to reenable them. That will cost much more
+        *     efforts.
+        *
+        *   - SMU firmware can handle the DPM reenablement
+        *     properly.
+        */
+       if (!smu->uploading_custom_pp_table ||
+           !((adev->asic_type >= CHIP_NAVI10) &&
+             (adev->asic_type <= CHIP_NAVI12))) {
+               ret = smu_stop_dpms(smu);
+               if (ret) {
+                       pr_warn("Fail to stop Dpms!\n");
+                       return ret;
+               }
        }
 
        kfree(table_context->driver_pptable);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_reset(struct smu_context *smu) · line 1343

Quoted 5 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -1324,13 +1339,16 @@ int smu_reset(struct smu_context *smu)
        struct amdgpu_device *adev = smu->adev;
        int ret = 0;
 
+       smu->uploading_custom_pp_table = true;
+

Do we need to differentiate between reloading for a pptable update and reloading for a gpu reset or suspend/resume or is that already handled?
Shouldn't we be setting/clearing uploading_custom_pp_table in smu_sys_set_pp_table() around the call to smu_reset()?

Alex

Quoted 29 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -3
        ret = smu_hw_fini(adev);
        if (ret)
-               return ret;
+               goto out;
 
        ret = smu_hw_init(adev);
-       if (ret)
-               return ret;
+
+out:
+       smu->uploading_custom_pp_table = false;
 
        return ret;
 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -1
index 8120e7587585..215841f5fb93 100644
@@ -391,6 +391,7 @@ struct smu_context
 
        uint32_t smc_if_version;
 
+       bool uploading_custom_pp_table;
 };
 
 struct i2c_adapter;
--

2.24.0

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): CADnq5_OhXnzYx6EgMM87dh1jgUi6Br86Axwi_KfvLjXuO2+gxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#4 lore raw
Quoted 62 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, November 12, 2019 1:34 AM
To: Quan, Evan <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amd/powerplay: avoid DPM reenable process on Navi1x ASICs

Quoted 8 lines · Evan Quan

Otherwise, without RLC reinitialization, the DPM reenablement will fail. That affects the custom pptable uploading.

Change-Id I6fe2ed5ce23f2a5b66f371c0b6d1f924837e5af6
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 32 +++++++++++++++--

--

Quoted 42 lines
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +19 -4
index 76a4154b3be2..a4d67b30fd72 100644
@@ -1293,10 +1293,25 @@ static int smu_hw_fini(void *handle)
                return ret;
        }
 
-       ret = smu_stop_dpms(smu);
-       if (ret) {
-               pr_warn("Fail to stop Dpms!\n");
-               return ret;
+       /*
+        * For custom pptable uploading, skip the DPM features
+        * disable process on Navi1x ASICs.
+        *   - As the gfx related features are under control of
+        *     RLC on those ASICs. RLC reinitialization will be
+        *     needed to reenable them. That will cost much more
+        *     efforts.
+        *
+        *   - SMU firmware can handle the DPM reenablement
+        *     properly.
+        */
+       if (!smu->uploading_custom_pp_table ||
+           !((adev->asic_type >= CHIP_NAVI10) &&
+             (adev->asic_type <= CHIP_NAVI12))) {
+               ret = smu_stop_dpms(smu);
+               if (ret) {
+                       pr_warn("Fail to stop Dpms!\n");
+                       return ret;
+               }
        }
 
        kfree(table_context->driver_pptable);
@@ -1324,13 +1339,16 @@ int smu_reset(struct smu_context *smu)
        struct amdgpu_device *adev = smu->adev;
        int ret = 0;
 
Quoted 5 lines

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_reset(struct smu_context *smu) · line 1343

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
+       smu->uploading_custom_pp_table = true;
+

Do we need to differentiate between reloading for a pptable update and reloading for a gpu reset or suspend/resume or is that already handled?

[Quan, Evan] That was considered(and as I verified suspend/resume was fine). For gpu reset or suspend/resume, the rlc/gfx will be reinitialized. So, under those cases, it's OK to perform the dpms disablement.

Quoted 2 lines

Shouldn't we be setting/clearing uploading_custom_pp_table in smu_sys_set_pp_table() around the call to smu_reset()?

[Quan, Evan] That's a good point. Will update this in V2.

Quoted 29 lines

Alex

Quoted 26 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -3
        ret = smu_hw_fini(adev);
        if (ret)
-               return ret;
+               goto out;
 
        ret = smu_hw_init(adev);
-       if (ret)
-               return ret;
+
+out:
+       smu->uploading_custom_pp_table = false;
 
        return ret;
 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
index 8120e7587585..215841f5fb93 100644
@@ -391,6 +391,7 @@ struct smu_context
 
        uint32_t smc_if_version;
 
+       bool uploading_custom_pp_table;
 };
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -1
 struct i2c_adapter;
--

2.24.0

_______________________________________________
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

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

Patch is Tested-by: Matt Coffin <[email protected]>

Quoted 70 lines · Evan Quan

Otherwise, without RLC reinitialization, the DPM reenablement will fail. That affects the custom pptable uploading.

Change-Id I6fe2ed5ce23f2a5b66f371c0b6d1f924837e5af6
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 32 +++++++++++++++----
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +25 -7
index 76a4154b3be2..a4d67b30fd72 100644
@@ -1293,10 +1293,25 @@ static int smu_hw_fini(void *handle)
 		return ret;
 	}
 
-	ret = smu_stop_dpms(smu);
-	if (ret) {
-		pr_warn("Fail to stop Dpms!\n");
-		return ret;
+	/*
+	 * For custom pptable uploading, skip the DPM features
+	 * disable process on Navi1x ASICs.
+	 *   - As the gfx related features are under control of
+	 *     RLC on those ASICs. RLC reinitialization will be
+	 *     needed to reenable them. That will cost much more
+	 *     efforts.
+	 *
+	 *   - SMU firmware can handle the DPM reenablement
+	 *     properly.
+	 */
+	if (!smu->uploading_custom_pp_table ||
+	    !((adev->asic_type >= CHIP_NAVI10) &&
+	      (adev->asic_type <= CHIP_NAVI12))) {
+		ret = smu_stop_dpms(smu);
+		if (ret) {
+			pr_warn("Fail to stop Dpms!\n");
+			return ret;
+		}
 	}
 
 	kfree(table_context->driver_pptable);
@@ -1324,13 +1339,16 @@ int smu_reset(struct smu_context *smu)
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
 
+	smu->uploading_custom_pp_table = true;
+
 	ret = smu_hw_fini(adev);
 	if (ret)
-		return ret;
+		goto out;
 
 	ret = smu_hw_init(adev);
-	if (ret)
-		return ret;
+
+out:
+	smu->uploading_custom_pp_table = false;
 
 	return ret;
 }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
index 8120e7587585..215841f5fb93 100644

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h struct smu_context · line 397

Quoted 7 lines
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -391,6 +391,7 @@ struct smu_context
 
 	uint32_t smc_if_version;
 
+	bool uploading_custom_pp_table;
 };
 
 struct i2c_adapter;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx