Skip to content

Commit db1e58e

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: stop reserving VMIDs to enforce isolation
That was quite troublesome for gang submit. Completely drop this approach and enforce the isolation separately. Signed-off-by: Christian König <[email protected]> Acked-by: Srinivasan Shanmugam <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent b7fbcd7 commit db1e58e

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
11111111
struct drm_gpu_scheduler *sched = entity->rq->sched;
11121112
struct amdgpu_ring *ring = to_amdgpu_ring(sched);
11131113

1114-
if (amdgpu_vmid_uses_reserved(adev, vm, ring->vm_hub))
1114+
if (amdgpu_vmid_uses_reserved(vm, ring->vm_hub))
11151115
return -EINVAL;
11161116
}
11171117
}

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,15 +1665,8 @@ static ssize_t amdgpu_gfx_set_enforce_isolation(struct device *dev,
16651665
}
16661666

16671667
mutex_lock(&adev->enforce_isolation_mutex);
1668-
for (i = 0; i < num_partitions; i++) {
1669-
if (adev->enforce_isolation[i] && !partition_values[i])
1670-
/* Going from enabled to disabled */
1671-
amdgpu_vmid_free_reserved(adev, AMDGPU_GFXHUB(i));
1672-
else if (!adev->enforce_isolation[i] && partition_values[i])
1673-
/* Going from disabled to enabled */
1674-
amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i));
1668+
for (i = 0; i < num_partitions; i++)
16751669
adev->enforce_isolation[i] = partition_values[i];
1676-
}
16771670
mutex_unlock(&adev->enforce_isolation_mutex);
16781671

16791672
amdgpu_mes_update_enforce_isolation(adev);

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
411411
if (r || !idle)
412412
goto error;
413413

414-
if (amdgpu_vmid_uses_reserved(adev, vm, vmhub)) {
414+
if (amdgpu_vmid_uses_reserved(vm, vmhub)) {
415415
r = amdgpu_vmid_grab_reserved(vm, ring, job, &id, fence);
416416
if (r || !id)
417417
goto error;
@@ -464,19 +464,14 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
464464

465465
/*
466466
* amdgpu_vmid_uses_reserved - check if a VM will use a reserved VMID
467-
* @adev: amdgpu_device pointer
468467
* @vm: the VM to check
469468
* @vmhub: the VMHUB which will be used
470469
*
471470
* Returns: True if the VM will use a reserved VMID.
472471
*/
473-
bool amdgpu_vmid_uses_reserved(struct amdgpu_device *adev,
474-
struct amdgpu_vm *vm, unsigned int vmhub)
472+
bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub)
475473
{
476-
return vm->reserved_vmid[vmhub] ||
477-
(adev->enforce_isolation[(vm->root.bo->xcp_id != AMDGPU_XCP_NO_PARTITION) ?
478-
vm->root.bo->xcp_id : 0] &&
479-
AMDGPU_IS_GFXHUB(vmhub));
474+
return vm->reserved_vmid[vmhub];
480475
}
481476

482477
int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ void amdgpu_pasid_free_delayed(struct dma_resv *resv,
7878

7979
bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev,
8080
struct amdgpu_vmid *id);
81-
bool amdgpu_vmid_uses_reserved(struct amdgpu_device *adev,
82-
struct amdgpu_vm *vm, unsigned int vmhub);
81+
bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub);
8382
int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev,
8483
unsigned vmhub);
8584
void amdgpu_vmid_free_reserved(struct amdgpu_device *adev,

0 commit comments

Comments
 (0)