Skip to contentSkip to conversation

drm/amdgpu: Need to free discovery memory

PATCH Superseded Emily Deng 3 participants 3 messages Nov 1, 2019 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Need to free discovery memory

When unloading driver, need to free discovery memory.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -1
index 9f2a893..50d6ed2 100644
@@ -1091,8 +1091,11 @@ static int gmc_v9_0_sw_fini(void *handle)
 	amdgpu_gem_force_release(adev);
 	amdgpu_vm_manager_fini(adev);
 
-	if (gmc_v9_0_keep_stolen_memory(adev))
+	if (gmc_v9_0_keep_stolen_memory(adev)) {
 		amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
+		/* return the IP Discovery TMR memory back to VRAM */
+		amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
+	}
 
 	amdgpu_gart_table_vram_free(adev);
 	amdgpu_bo_fini(adev);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1572599256-24993-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Hi Emily,

Thanks for catching this.

I think freeing Discovery TMR bo should be put at amdgpu_ttm_fini() instead of amdgpu_ttm_late_init() because unlike VGA stolen bo, touching PSP-protected Discovery TMR bo will cause GPU hang. Therefore, it should be reserved across the life-cycle of amdgpu driver.

Please kindly send v2 patch with this change.

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of Emily Deng <[email protected]>
Sent: Friday, November 1, 2019 5:07 PM
To: [email protected]
Cc: Deng, Emily
Subject: [PATCH] drm/amdgpu: Need to free discovery memory

When unloading driver, need to free discovery memory.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -1
index 9f2a893..50d6ed2 100644
@@ -1091,8 +1091,11 @@ static int gmc_v9_0_sw_fini(void *handle)
        amdgpu_gem_force_release(adev);
        amdgpu_vm_manager_fini(adev);
 
-       if (gmc_v9_0_keep_stolen_memory(adev))
+       if (gmc_v9_0_keep_stolen_memory(adev)) {
                amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
+               /* return the IP Discovery TMR memory back to VRAM */
+               amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
+       }
 
        amdgpu_gart_table_vram_free(adev);
        amdgpu_bo_fini(adev);

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN8PR12MB36021054CEA4EF2DD94CFEE989620-h6+T2+wrnx1lGJ5xs4l7kQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw

Besides, the bo for ip_discovery only need to be created and reserved for Navi10 and onwards, although it shouldn't be a big issue to reserve 64K memory in top vram.

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yuan, Xiaojie
Sent: 2019年11月1日 23:14
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Need to free discovery memory

Hi Emily,

Thanks for catching this.

I think freeing Discovery TMR bo should be put at amdgpu_ttm_fini() instead of amdgpu_ttm_late_init() because unlike VGA stolen bo, touching PSP-protected Discovery TMR bo will cause GPU hang. Therefore, it should be reserved across the life-cycle of amdgpu driver.

Please kindly send v2 patch with this change.

BR,
Xiaojie

________________________________________
From: amd-gfx <[email protected]> on behalf of Emily Deng <[email protected]>
Sent: Friday, November 1, 2019 5:07 PM
To: [email protected]
Cc: Deng, Emily
Subject: [PATCH] drm/amdgpu: Need to free discovery memory

When unloading driver, need to free discovery memory.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -1
index 9f2a893..50d6ed2 100644
@@ -1091,8 +1091,11 @@ static int gmc_v9_0_sw_fini(void *handle)
        amdgpu_gem_force_release(adev);
        amdgpu_vm_manager_fini(adev);
 
-       if (gmc_v9_0_keep_stolen_memory(adev))
+       if (gmc_v9_0_keep_stolen_memory(adev)) {
                amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
+               /* return the IP Discovery TMR memory back to VRAM */
+               amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
+       }
 
        amdgpu_gart_table_vram_free(adev);
        amdgpu_bo_fini(adev);

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx