drm/amd/powerplay: fix bug fail to remove sysfs when rmmod amdgpu.

Submitted by Rex Zhu on July 4, 2017, 8:42 a.m.

Details

Message ID 1499157736-5720-1-git-send-email-Rex.Zhu@amd.com
State New
Headers show
Series "drm/amd/powerplay: fix bug fail to remove sysfs when rmmod amdgpu." ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Rex Zhu July 4, 2017, 8:42 a.m.
when hw_fini, pp will disable dpm.so remove sysfs before
disable dpm.

Change-Id: I17114f5c964b870802abbde32544b28eeb6173ab
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
index f5ae871..6eaeae0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
@@ -187,6 +187,9 @@  static int amdgpu_pp_hw_fini(void *handle)
 	int ret = 0;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	if (adev->pp_enabled && adev->pm.dpm_enabled)
+		amdgpu_pm_sysfs_fini(adev);
+
 	if (adev->powerplay.ip_funcs->hw_fini)
 		ret = adev->powerplay.ip_funcs->hw_fini(
 					adev->powerplay.pp_handle);
@@ -205,9 +208,6 @@  static void amdgpu_pp_late_fini(void *handle)
 		adev->powerplay.ip_funcs->late_fini(
 			  adev->powerplay.pp_handle);
 
-	if (adev->pp_enabled && adev->pm.dpm_enabled)
-		amdgpu_pm_sysfs_fini(adev);
-
 	amd_powerplay_destroy(adev->powerplay.pp_handle);
 }
 

Comments

On Tue, Jul 4, 2017 at 4:42 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:
> when hw_fini, pp will disable dpm.so remove sysfs before
> disable dpm.
>
> Change-Id: I17114f5c964b870802abbde32544b28eeb6173ab
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>

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

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> index f5ae871..6eaeae0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> @@ -187,6 +187,9 @@ static int amdgpu_pp_hw_fini(void *handle)
>         int ret = 0;
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>
> +       if (adev->pp_enabled && adev->pm.dpm_enabled)
> +               amdgpu_pm_sysfs_fini(adev);
> +
>         if (adev->powerplay.ip_funcs->hw_fini)
>                 ret = adev->powerplay.ip_funcs->hw_fini(
>                                         adev->powerplay.pp_handle);
> @@ -205,9 +208,6 @@ static void amdgpu_pp_late_fini(void *handle)
>                 adev->powerplay.ip_funcs->late_fini(
>                           adev->powerplay.pp_handle);
>
> -       if (adev->pp_enabled && adev->pm.dpm_enabled)
> -               amdgpu_pm_sysfs_fini(adev);
> -
>         amd_powerplay_destroy(adev->powerplay.pp_handle);
>  }
>
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
On 04/07/17 05:42 PM, Rex Zhu wrote:
> when hw_fini, pp will disable dpm.so remove sysfs before
> disable dpm.
> 
> Change-Id: I17114f5c964b870802abbde32544b28eeb6173ab
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> index f5ae871..6eaeae0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
> @@ -187,6 +187,9 @@ static int amdgpu_pp_hw_fini(void *handle)
>  	int ret = 0;
>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>  
> +	if (adev->pp_enabled && adev->pm.dpm_enabled)
> +		amdgpu_pm_sysfs_fini(adev);
> +
>  	if (adev->powerplay.ip_funcs->hw_fini)
>  		ret = adev->powerplay.ip_funcs->hw_fini(
>  					adev->powerplay.pp_handle);
> @@ -205,9 +208,6 @@ static void amdgpu_pp_late_fini(void *handle)
>  		adev->powerplay.ip_funcs->late_fini(
>  			  adev->powerplay.pp_handle);
>  
> -	if (adev->pp_enabled && adev->pm.dpm_enabled)
> -		amdgpu_pm_sysfs_fini(adev);
> -
>  	amd_powerplay_destroy(adev->powerplay.pp_handle);
>  }
>  
> 

Thanks Rex, now I can finally cleanly unload amdgpu and load it again. :)

Tested-by: Michel Dänzer <michel.daenzer@amd.com>