fix module unloading with powerplay enabled
Subsystems (2)
cover fix module unloading with powerplay enabled
This fixes a crash in module unloading with powerplay enabled due to cross IP module dependencies.
Monk Liu (3):
drm/amdgpu: add late_fini for ip_funcs
drm/amdgpu: impl late_fini for amdgpu_pp_ip
drm/amdgpu: fix pplib finish bug
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 24 ++++++++++++++++------- drivers/gpu/drm/amd/include/amd_shared.h | 1 + drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c | 3 --- 4 files changed, 23 insertions(+), 10 deletions(-)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 drm/amdgpu: add late_fini for ip_funcs
From: Monk Liu <[email protected]>
This adds a late_fini function for handling special ordering issues between ip modules at tear down time.
--- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -159,6 +159,7 @@ struct amd_ip_funcs {int (*hw_init)(void *handle);/* tears down the hw state */ int (*hw_fini)(void *handle); +void (*late_fini)(void *handle);/* handles IP specific hw/sw changes for suspend */ int (*suspend)(void *handle);/* handles IP specific hw/sw changes for resume */
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/amdgpu: impl late_fini for amdgpu_pp_ip
In reply to Alex DeucherFrom: Monk Liu <[email protected]>
This adds a late_fini callback for the powerplay ip module.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +17 -0
@@ -224,6 +224,22 @@ static int amdgpu_pp_hw_fini(void *handle)return ret; } +static void amdgpu_pp_late_fini (void *handle) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +#ifdef CONFIG_DRM_AMD_POWERPLAY +if (adev->pp_enabled) { +amdgpu_pm_sysfs_fini (adev); +amd_powerplay_fini (adev->powerplay.pp_handle); + } + +if (adev->powerplay.ip_funcs->late_fini) + adev->powerplay.ip_funcs->late_fini ( + adev->powerplay.pp_handle); +#endif +} +static int amdgpu_pp_suspend (void *handle) {int ret =0 ;
@@ -312,6 +328,7 @@ const struct amd_ip_funcs amdgpu_pp_ip_funcs = { .sw_fini = amdgpu_pp_sw_fini, .hw_init = amdgpu_pp_hw_init, .hw_fini = amdgpu_pp_hw_fini, + .late_fini = amdgpu_pp_late_fini, .suspend = amdgpu_pp_suspend, .resume = amdgpu_pp_resume, .is_idle = amdgpu_pp_is_idle,
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/amdgpu: fix pplib finish bug
In reply to Alex DeucherFrom: Monk Liu <[email protected]>
1,should use late_fini to kfree all resource otherwise the released pointer maybe accessed in IRQ ip fini routine.
2,hwmgr should not be kfree by pem_fini which is invoked by hw fini path.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 7 ------- drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c | 3 --- 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1325,6 +1325,11 @@ static int amdgpu_fini(struct amdgpu_device *adev) adev->ip_block_status[i].valid = false; } +for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) { +if (adev->ip_blocks[i].funcs->late_fini) + adev->ip_blocks[i].funcs->late_fini ((void *)adev); + } +return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +0 -7
@@ -184,13 +184,6 @@ static int amdgpu_pp_sw_fini(void *handle)if (ret)return ret; -#ifdef CONFIG_DRM_AMD_POWERPLAY -if (adev->pp_enabled) { -amdgpu_pm_sysfs_fini (adev); -amd_powerplay_fini (adev->powerplay.pp_handle); - } -#endif -return ret; }
drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c +0 -3
@@ -58,9 +58,6 @@ static void pem_fini(struct pp_eventmgr *eventmgr)pem_unregister_interrupts (eventmgr);pem_handle_event (eventmgr,AMD_PP_EVENT_UNINITIALIZE , &event_data); - -if (eventmgr !=NULL ) -kfree (eventmgr); }int eventmgr_init (struct pp_instance *handle)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel