amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
@ 2025-08-07  9:47 oushixiong1025
  2025-08-07 10:03 ` Christian König
  2025-08-07 13:01 ` Alex Deucher
  0 siblings, 2 replies; 6+ messages in thread
From: oushixiong1025 @ 2025-08-07  9:47 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Christian König, David Airlie, Simona Vetter, Sunil Khatri,
	Alexandre Demers, Boyuan Zhang, amd-gfx, dri-devel, linux-kernel,
	Shixiong Ou

From: Shixiong Ou <oushixiong@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 <oushixiong@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))) {
+		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;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
  2025-08-07  9:47 [PATCH] drm/amdgpu: skip disabling audio when device is unplugged oushixiong1025
@ 2025-08-07 10:03 ` Christian König
  2025-08-07 13:01   ` oushixiong
  2025-08-07 13:01 ` Alex Deucher
  1 sibling, 1 reply; 6+ messages in thread
From: Christian König @ 2025-08-07 10:03 UTC (permalink / raw)
  To: oushixiong1025, Alex Deucher
  Cc: David Airlie, Simona Vetter, Sunil Khatri, Alexandre Demers,
	Boyuan Zhang, amd-gfx, dri-devel, linux-kernel, Shixiong Ou

On 07.08.25 11:47, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@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 <oushixiong@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;
>  }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
  2025-08-07 10:03 ` Christian König
@ 2025-08-07 13:01   ` oushixiong
  2025-08-07 13:24     ` Christian König
  0 siblings, 1 reply; 6+ messages in thread
From: oushixiong @ 2025-08-07 13:01 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: David Airlie, Simona Vetter, Sunil Khatri, Alexandre Demers,
	Boyuan Zhang, amd-gfx, dri-devel, linux-kernel, Shixiong Ou

Should we move audio disabling to hw_fini()?

Regards,
Shixiong Ou.


在 2025/8/7 18:03, Christian König 写道:
> On 07.08.25 11:47, oushixiong1025@163.com wrote:
>> From: Shixiong Ou <oushixiong@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 <oushixiong@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;
>>   }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
  2025-08-07  9:47 [PATCH] drm/amdgpu: skip disabling audio when device is unplugged oushixiong1025
  2025-08-07 10:03 ` Christian König
@ 2025-08-07 13:01 ` Alex Deucher
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2025-08-07 13:01 UTC (permalink / raw)
  To: oushixiong1025
  Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Sunil Khatri, Alexandre Demers, Boyuan Zhang, amd-gfx, dri-devel,
	linux-kernel, Shixiong Ou

On Thu, Aug 7, 2025 at 5:53 AM <oushixiong1025@163.com> wrote:
>
> From: Shixiong Ou <oushixiong@kylinos.cn>
>
> When Stopping lightdm and removing amdgpu driver are executed, the following
> error is triggered probably:

There's already a patch to fix this here:
https://gitlab.freedesktop.org/drm/amd/-/issues/4481

Alex

>
> 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 <oushixiong@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))) {
> +               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;
>  }
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
  2025-08-07 13:01   ` oushixiong
@ 2025-08-07 13:24     ` Christian König
  2025-08-07 13:59       ` oushixiong
  0 siblings, 1 reply; 6+ messages in thread
From: Christian König @ 2025-08-07 13:24 UTC (permalink / raw)
  To: oushixiong, Alex Deucher
  Cc: David Airlie, Simona Vetter, Sunil Khatri, Alexandre Demers,
	Boyuan Zhang, amd-gfx, dri-devel, linux-kernel, Shixiong Ou

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, oushixiong1025@163.com wrote:
>>> From: Shixiong Ou <oushixiong@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 <oushixiong@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;
>>>   }
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/amdgpu: skip disabling audio when device is unplugged
  2025-08-07 13:24     ` Christian König
@ 2025-08-07 13:59       ` oushixiong
  0 siblings, 0 replies; 6+ messages in thread
From: oushixiong @ 2025-08-07 13:59 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: David Airlie, Simona Vetter, Sunil Khatri, Alexandre Demers,
	Boyuan Zhang, amd-gfx, dri-devel, linux-kernel, Shixiong Ou

Thanks, I get it.

Regards,
Shixiong Ou

在 2025/8/7 21:24, Christian König 写道:
> 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, oushixiong1025@163.com wrote:
>>>> From: Shixiong Ou <oushixiong@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 <oushixiong@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;
>>>>    }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-08  7:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  9:47 [PATCH] drm/amdgpu: skip disabling audio when device is unplugged oushixiong1025
2025-08-07 10:03 ` Christian König
2025-08-07 13:01   ` oushixiong
2025-08-07 13:24     ` Christian König
2025-08-07 13:59       ` oushixiong
2025-08-07 13:01 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).