On 9/17/26 21:58, Shahyan Soltani wrote:
> From: Pierre-Eric Pelloux-Prayer <[email protected]>
>
> For now use the same logic as the existing one, but it's not 100%
> correct since:
> 1) most operations don't need the GPUs
> 2) some operations that need it are actually deferred
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
> Signed-off-by: Shahyan Soltani <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 4e4814caf61a..6edd03647c2d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -978,6 +978,14 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void
> *data,
> if (r)
> goto error;
>
> + /* FIXME: only PRT operations use the GPU to update mapping, but
> + * some operations are deferred to fences callbacks so it's not
> + * trivial to fix.
> + */
That comment is not correct, just drop it.
> + r = pm_runtime_resume_and_get(adev->dev);
> + if (r < 0)
> + return r;
> +
> switch (args->operation) {
> case AMDGPU_VA_OP_MAP:
> r = amdgpu_vm_bo_map(adev, bo_va, args->va_address,
> @@ -1031,6 +1039,8 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void
> *data,
>
> }
>
> + pm_runtime_put_autosuspend(adev->dev);
That error handling is not correct, after the switch there are a bunch of
returns and gotos for cleanup.
I strongly suggest to use the guard approach here as well.
Regards,
Christian.
> +
> error:
> dma_fence_chain_free(timeline_chain);
> if (timeline_syncobj)