Skip to contentSkip to conversation

Release xcp drm memory after unplug xcp device

PATCH New Meng Li 1 participant 2 messages Jul 9, 2025

Subsystems (2)
lore
Share & tools
lore

Meng Li

author
#0 lore raw

v5 cover Release xcp drm memory after unplug xcp device

Fix xcp drm memory release after executing PCIe remove. Fix xcp drm memory alloc after executing PCIe insert.

Changes from V4->V5:
- amdgpu:
- - Delete "if" check in the loop.

Changes from V3->V4:
- amdgpu:
- - Remove redundant initialization for "i".
- - Simplify checks.

Changes from V2->V3:
- amdgpu:
- - Add Gerry as a Signed-off.
- - Unified commit author.

Changes from V1->V2:
- cover-letter:
- - Revise title version number.
- amdgpu:
- - Remove // comments.
- - Add Gerry as a co-developr.

Meng Li (1):
drm/amd/amdgpu: Release xcp drm memory after unplug

 drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c     |  1 +
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 56 +++++++++++++++++----
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h |  1 +
 3 files changed, 49 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v5 1/1 drm/amd/amdgpu: Release xcp drm memory after unplug

Add a new API amdgpu_xcp_drm_dev_free().
After unplug xcp device, need to release xcp drm memory etc.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c     |  1 +
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 56 +++++++++++++++++----
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h |  1 +
 3 files changed, 49 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +1 -0
index c8fcafeb6864..e5717c657fd3 100644
@@ -394,6 +394,7 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev)
 		p_ddev->primary->dev = adev->xcp_mgr->xcp[i].pdev;
 		p_ddev->driver =  adev->xcp_mgr->xcp[i].driver;
 		p_ddev->vma_offset_manager = adev->xcp_mgr->xcp[i].vma_offset_manager;
+		amdgpu_xcp_drm_dev_free(p_ddev);
 	}
 }
 
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +47 -9

89 lines not on this page · raw message

drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h +1 -0
index c1c4b679bf95..580a1602c8e3 100644
@@ -25,5 +25,6 @@
 #define _AMDGPU_XCP_DRV_H_
 
 int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev);
+void amdgpu_xcp_drm_dev_free(struct drm_device *ddev);
 void amdgpu_xcp_drv_release(void);
 #endif /* _AMDGPU_XCP_DRV_H_ */
Signature · 1 line
2.43.0