Skip to content

Commit 150c213

Browse files
jameszhu-amdalexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent baf6574 commit 150c213

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ static int amdgpu_xcp_dev_alloc(struct amdgpu_device *adev)
234234

235235
ddev = adev_to_drm(adev);
236236

237-
for (i = 0; i < MAX_XCP; i++) {
237+
/* xcp #0 shares drm device setting with adev */
238+
adev->xcp_mgr->xcp->ddev = ddev;
239+
240+
for (i = 1; i < MAX_XCP; i++) {
238241
ret = amdgpu_xcp_drm_dev_alloc(&p_ddev);
239242
if (ret)
240243
return ret;
@@ -324,7 +327,7 @@ int amdgpu_xcp_dev_register(struct amdgpu_device *adev,
324327
if (!adev->xcp_mgr)
325328
return 0;
326329

327-
for (i = 0; i < MAX_XCP; i++) {
330+
for (i = 1; i < MAX_XCP; i++) {
328331
ret = drm_dev_register(adev->xcp_mgr->xcp[i].ddev, ent->driver_data);
329332
if (ret)
330333
return ret;
@@ -341,7 +344,7 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev)
341344
if (!adev->xcp_mgr)
342345
return;
343346

344-
for (i = 0; i < MAX_XCP; i++) {
347+
for (i = 1; i < MAX_XCP; i++) {
345348
p_ddev = adev->xcp_mgr->xcp[i].ddev;
346349
drm_dev_unplug(p_ddev);
347350
p_ddev->render->dev = adev->xcp_mgr->xcp[i].rdev;

0 commit comments

Comments
 (0)