drm/amdgpu: share drm device for pci amdgpu device with 1st partition device

To save render node resoure, share drm device setting for pci amdgpu
device with 1st XCP partition device.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
James Zhu 2023-06-22 09:58:09 -04:00 committed by Alex Deucher
parent baf65745aa
commit 150c213139

View File

@ -234,7 +234,10 @@ static int amdgpu_xcp_dev_alloc(struct amdgpu_device *adev)
ddev = adev_to_drm(adev);
for (i = 0; i < MAX_XCP; i++) {
/* xcp #0 shares drm device setting with adev */
adev->xcp_mgr->xcp->ddev = ddev;
for (i = 1; i < MAX_XCP; i++) {
ret = amdgpu_xcp_drm_dev_alloc(&p_ddev);
if (ret)
return ret;
@ -324,7 +327,7 @@ int amdgpu_xcp_dev_register(struct amdgpu_device *adev,
if (!adev->xcp_mgr)
return 0;
for (i = 0; i < MAX_XCP; i++) {
for (i = 1; i < MAX_XCP; i++) {
ret = drm_dev_register(adev->xcp_mgr->xcp[i].ddev, ent->driver_data);
if (ret)
return ret;
@ -341,7 +344,7 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev)
if (!adev->xcp_mgr)
return;
for (i = 0; i < MAX_XCP; i++) {
for (i = 1; i < MAX_XCP; i++) {
p_ddev = adev->xcp_mgr->xcp[i].ddev;
drm_dev_unplug(p_ddev);
p_ddev->render->dev = adev->xcp_mgr->xcp[i].rdev;