On Thu, Mar 31, 2022 at 11:47 AM Christian König <ckoenig.leichtzumerken@xxxxxxxxx> wrote: > > Allows separate tracking of VM updates. > > Signed-off-by: Christian König <christian.koenig@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 +++++---- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++-- > drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- > 6 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > index 57b521bb1eec..92a6ca415ab8 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > @@ -410,7 +410,7 @@ static int vm_update_pds(struct amdgpu_vm *vm, struct amdgpu_sync *sync) > struct amdgpu_device *adev = amdgpu_ttm_adev(pd->tbo.bdev); > int ret; > > - ret = amdgpu_vm_update_pdes(adev, vm, false); > + ret = amdgpu_vm_update_pdes(adev, vm, false, NULL); > if (ret) > return ret; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > index 50fddd6715db..87daa75b57c9 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > @@ -849,7 +849,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) > if (r) > return r; > > - r = amdgpu_vm_update_pdes(adev, vm, false); > + r = amdgpu_vm_update_pdes(adev, vm, false, NULL); > if (r) > return r; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > index 3f84eedb4d96..9cdfee67efeb 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c > @@ -623,7 +623,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, > goto error; > } > > - r = amdgpu_vm_update_pdes(adev, vm, false); > + r = amdgpu_vm_update_pdes(adev, vm, false, NULL); > > error: > if (r && r != -ERESTARTSYS) > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > index 05024999556b..3391256e2448 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > @@ -725,14 +725,15 @@ uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr) > * @adev: amdgpu_device pointer > * @vm: requested vm > * @immediate: submit immediately to the paging queue > + * @last:update: optional returned last update > * > * Makes sure all directories are up to date. > * > * Returns: > * 0 for success, error for failure. > */ > -int amdgpu_vm_update_pdes(struct amdgpu_device *adev, > - struct amdgpu_vm *vm, bool immediate) > +int amdgpu_vm_update_pdes(struct amdgpu_device *adev, struct amdgpu_vm *vm, > + bool immediate, struct dma_fence **last_update) > { > struct amdgpu_vm_update_params params; > struct amdgpu_vm_bo_base *entry; > @@ -759,7 +760,7 @@ int amdgpu_vm_update_pdes(struct amdgpu_device *adev, > goto error; > } > > - r = vm->update_funcs->commit(¶ms, &vm->last_update); > + r = vm->update_funcs->commit(¶ms, last_update ? : &vm->last_update); This ternary is pretty incomplete. > if (r) > goto error; > > @@ -2529,7 +2530,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid, > if (r) > goto error_unlock; > > - r = amdgpu_vm_update_pdes(adev, vm, true); > + r = amdgpu_vm_update_pdes(adev, vm, true, NULL); > > error_unlock: > amdgpu_bo_unreserve(root); > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > index 3c7df1b8e3c9..692ec7b51ac2 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h > @@ -394,8 +394,8 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, > int (*callback)(void *p, struct amdgpu_bo *bo), > void *param); > int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync); > -int amdgpu_vm_update_pdes(struct amdgpu_device *adev, > - struct amdgpu_vm *vm, bool immediate); > +int amdgpu_vm_update_pdes(struct amdgpu_device *adev, struct amdgpu_vm *vm, > + bool immediate, struct dma_fence **last_update); > int amdgpu_vm_clear_freed(struct amdgpu_device *adev, > struct amdgpu_vm *vm, > struct dma_fence **fence); > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c > index 907b02045824..74824e3806d5 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c > @@ -1294,7 +1294,7 @@ svm_range_map_to_gpu(struct kfd_process_device *pdd, struct svm_range *prange, > last_start = prange->start + i + 1; > } > > - r = amdgpu_vm_update_pdes(adev, vm, false); > + r = amdgpu_vm_update_pdes(adev, vm, false, NULL); > if (r) { > pr_debug("failed %d to update directories 0x%lx\n", r, > prange->start); > -- > 2.25.1 >