On 07.08.25 15:01, oushixiong wrote: > Should we move audio disabling to hw_fini()?
Yes and when you look at the patch Alex pointed out that is pretty much exactly what it does. So still good catch from your side, but a fix is already in the pipeline. Regards, Christian. > > Regards, > Shixiong Ou. > > > 在 2025/8/7 18:03, Christian König 写道: >> On 07.08.25 11:47, oushixiong1...@163.com wrote: >>> From: Shixiong Ou <oushixi...@kylinos.cn> >>> >>> When Stopping lightdm and removing amdgpu driver are executed, the following >>> error is triggered probably: >>> >>> Unable to handle kernel paging request at virtual address 0000000000005e00 >>> ..... >>> [ 2] [T10084] Call trace: >>> [ 2] [T10084] amdgpu_device_wreg.part.0+0x58/0x110 [amdgpu] >>> [ 2] [T10084] amdgpu_device_wreg+0x20/0x38 [amdgpu] >>> [ 2] [T10084] dce_v6_0_audio_endpt_wreg+0x64/0xd8 [amdgpu] >>> [ 2] [T10084] dce_v6_0_sw_fini+0xa0/0x118 [amdgpu] >>> [ 2] [T10084] amdgpu_device_ip_fini.isra.0+0xdc/0x1e8 [amdgpu] >>> [ 2] [T10084] amdgpu_device_fini_sw+0x2c/0x220 [amdgpu] >>> [ 2] [T10084] amdgpu_driver_release_kms+0x20/0x40 [amdgpu] >>> [ 2] [T10084] devm_drm_dev_init_release+0x8c/0xc0 [drm] >>> [ 2] [T10084] devm_action_release+0x18/0x28 >>> [ 2] [T10084] release_nodes+0x5c/0xc8 >>> [ 2] [T10084] devres_release_all+0xa0/0x130 >>> [ 2] [T10084] device_unbind_cleanup+0x1c/0x70 >>> [ 2] [T10084] device_release_driver_internal+0x1e4/0x228 >>> [ 2] [T10084] driver_detach+0x90/0x100 >>> [ 2] [T10084] bus_remove_driver+0x74/0x100 >>> [ 2] [T10084] driver_unregister+0x34/0x68 >>> [ 2] [T10084] pci_unregister_driver+0x24/0x108 >>> [ 2] [T10084] amdgpu_exit+0x1c/0x3270 [amdgpu] >>> [ 2] [T10084] __do_sys_delete_module.constprop.0+0x1d0/0x330 >>> [ 2] [T10084] __arm64_sys_delete_module+0x18/0x28 >>> [ 2] [T10084] invoke_syscall+0x4c/0x120 >>> [ 2] [T10084] el0_svc_common.constprop.0+0xc4/0xf0 >>> [ 2] [T10084] do_el0_svc+0x24/0x38 >>> [ 2] [T10084] el0_svc+0x24/0x88 >>> [ 2] [T10084] el0t_64_sync_handler+0x134/0x150 >>> [ 2] [T10084] el0t_64_sync+0x14c/0x150 >>> [ 2] [T10084] Code: f9401bf7 f9453e60 8b150000 d50332bf (b9000016) >>> [ 2] [T10084] ---[ end trace 0000000000000000 ]--- >>> >>> The adev->rmmio has been unmmaped in amdgpu_device_fini_hw(). >>> >>> So skip disabling audio when device is unplugged. >>> >>> Signed-off-by: Shixiong Ou <oushixi...@kylinos.cn> >>> --- >>> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> index 276c025c4c03..48b29990da7f 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c >>> @@ -23,6 +23,7 @@ >>> #include <linux/pci.h> >>> +#include <drm/drm_drv.h> >>> #include <drm/drm_edid.h> >>> #include <drm/drm_fourcc.h> >>> #include <drm/drm_modeset_helper.h> >>> @@ -1459,8 +1460,10 @@ static void dce_v6_0_audio_fini(struct amdgpu_device >>> *adev) >>> if (!adev->mode_info.audio.enabled) >>> return; >>> - for (i = 0; i < adev->mode_info.audio.num_pins; i++) >>> - dce_v6_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); >>> + if (!drm_dev_is_unplugged(adev_to_drm(adev))) { >> Good catch, but that looks like a workaround for something done in the wrong >> place. >> >> A *_sw_fini() function should not enable/disable HW. >> >> Regards, >> Christian. >> >>> + for (i = 0; i < adev->mode_info.audio.num_pins; i++) >>> + dce_v6_0_audio_enable(adev, &adev->mode_info.audio.pin[i], >>> false); >>> + } >>> adev->mode_info.audio.enabled = false; >>> } >