Use the spm vmid which is dedicated for the SPM only and update the function paths accordingly.
Signed-off-by: Sunil Khatri <[email protected]> Reviewed-by: Christian König <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 30 ++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c index ed1efde29a9a5..0eac7695f5587 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c @@ -551,9 +551,12 @@ int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, r = -ENOENT; goto unlock; } - /* Remove from normal round robin handling */ - id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid, list); - list_del_init(&id->list); + if (!adev->vm_manager.spm_vmid) { + r = -ENOENT; + goto unlock; + } + + id = &id_mgr->ids[adev->vm_manager.spm_vmid]; vm->reserved_vmid[vmhub] = id; id_mgr->reserved_vmid = true; mutex_unlock(&id_mgr->lock); @@ -577,8 +580,6 @@ void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm, mutex_lock(&id_mgr->lock); if (vm->reserved_vmid[vmhub]) { - list_add(&vm->reserved_vmid[vmhub]->list, - &id_mgr->ids_lru); vm->reserved_vmid[vmhub] = NULL; id_mgr->reserved_vmid = false; } @@ -628,6 +629,14 @@ void amdgpu_vmid_reset_all(struct amdgpu_device *adev) for_each_set_bit(j, id_mgr->vmid_mask, AMDGPU_NUM_VMID) amdgpu_vmid_reset(adev, i, j); } + + /* + * The SPM VMID is not part of the normal kernel pool, reset it + * anyway in case it is used with kernel queues. + */ + if (adev->vm_manager.spm_vmid) + for (i = AMDGPU_GFXHUB_START; i < AMDGPU_MMHUB0_START; ++i) + amdgpu_vmid_reset(adev, i, adev->vm_manager.spm_vmid); } /** @@ -712,6 +721,17 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru); } } + + /* + * The SPM VMID is not part of the normal kernel pool, create its + * sync anyway in case it is used with kernel queues. + */ + if (adev->vm_manager.spm_vmid) { + unsigned int spm_vmid = adev->vm_manager.spm_vmid; + + for (i = AMDGPU_GFXHUB_START; i < AMDGPU_MMHUB0_START; ++i) + amdgpu_sync_create(&adev->vm_manager.id_mgr[i].ids[spm_vmid].active); + } } /** -- 2.34.1
