drm/amd: Clean up kfd node on surprise disconnect
Subsystems (2)
PATCH 1/1 drm/amd: Clean up kfd node on surprise disconnect
When an eGPU is unplugged the KFD topology should also be destroyed for that GPU. This never happens because the fini_sw callbacks never get to run. Run them manually at the end of amdgpu_device_fini_hw() when a device is already disconnected.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -5263,6 +5263,9 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)if (drm_dev_is_unplugged (adev_to_drm (adev)))amdgpu_device_unmap_mmio (adev); +/* surprise hotplug */ +if (pci_dev_is_disconnected (adev->pdev)) +amdgpu_amdkfd_device_fini_sw (adev); }void amdgpu_device_fini_sw (struct amdgpu_device *adev)
Signature · 1 line
2.43.0
[Public]
Seems like a good start for the issue linked there.
Quoted 37 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Mario Limonciello (AMD)
Sent: Monday, January 5, 2026 11:39 PM
To: [email protected]
Cc: Mario Limonciello (AMD) <[email protected]>
Subject: [PATCH] drm/amd: Clean up kfd node on surprise disconnectWhen an eGPU is unplugged the KFD topology should also be destroyed for that GPU. This never happens because the
fini_swcallbacks never get to run. Run them manually at the end ofamdgpu_device_fini_hw()when a device is already disconnected.Signed-off-by Mario Limonciello (AMD) <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -5263,6 +5263,9 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)if (drm_dev_is_unplugged (adev_to_drm (adev)))amdgpu_device_unmap_mmio (adev); +/* surprise hotplug */ +if (pci_dev_is_disconnected (adev->pdev)) +amdgpu_amdkfd_device_fini_sw (adev); }void
amdgpu_device_fini_sw(struct amdgpu_device *adev)
--
2.43.0