Skip to contentSkip to conversation

drm/amd/amdgpu: Do irq_fini_hw after ip_fini_early

PATCH In review YuBiao Wang 3 participants 3 messages Sep 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: Do irq_fini_hw after ip_fini_early

Some IP such as SMU need irq_put to perform hw_fini. So move irq_fini_hw after ip_fini.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index 4c8f2f4647c0..18e26a78ef82 100644
@@ -3864,10 +3864,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
 		amdgpu_ucode_sysfs_fini(adev);
 	sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 
-	amdgpu_irq_fini_hw(adev);
-
 	amdgpu_device_ip_fini_early(adev);
 
+	amdgpu_irq_fini_hw(adev);
+
 	ttm_device_clear_dma_mappings(&adev->mman.bdev);
 
 	amdgpu_gart_dummy_page_fini(adev);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · YuBiao Wang

Some IP such as SMU need irq_put to perform hw_fini. So move irq_fini_hw after ip_fini.

This looks correct in general, but will this code:

        if (!amdgpu_device_has_dc_support(adev))
                        flush_work(&adev->hotplug_work);

in amdgpu_irq_fini_hw() cause any problems if it gets executed after the DCE hw has been stopped? I guess it should be ok.

Alex

Quoted 24 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -3
index 4c8f2f4647c0..18e26a78ef82 100644
@@ -3864,10 +3864,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
                amdgpu_ucode_sysfs_fini(adev);
        sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 
-       amdgpu_irq_fini_hw(adev);
-
        amdgpu_device_ip_fini_early(adev);
 
+       amdgpu_irq_fini_hw(adev);
+
        ttm_device_clear_dma_mappings(&adev->mman.bdev);
 
        amdgpu_gart_dummy_page_fini(adev);
--

2.25.1

#2 lore raw
In reply to YuBiao Wang

Can you test  this change with hotunplug tests in libdrm ?
Since the tests are still in disabled mode until latest fixes propagate
to drm-next upstream you will need to comment out https://gitlab.freedesktop.org/mesa/drm/-/blob/main/tests/amdgpu/hotunplug_tests.c#L65
I recently fixed a few regressions in amdgpu so hopefully there isn't more regressions
which will interfere with your testing.

Andrey

Quoted 25 lines · YuBiao Wang

Some IP such as SMU need irq_put to perform hw_fini. So move irq_fini_hw after ip_fini.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index 4c8f2f4647c0..18e26a78ef82 100644
@@ -3864,10 +3864,10 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
  		amdgpu_ucode_sysfs_fini(adev);
  	sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 
-	amdgpu_irq_fini_hw(adev);
-
  	amdgpu_device_ip_fini_early(adev);
 
+	amdgpu_irq_fini_hw(adev);
+
  	ttm_device_clear_dma_mappings(&adev->mman.bdev);
 
  	amdgpu_gart_dummy_page_fini(adev);