On 5/26/26 18:06, Tvrtko Ursulin wrote:
> Add a new query (AMDGPU_VM_OP_QUERY_RESERVED_VMID) to the
> DRM_IOCTL_AMDGPU_VM ioctl.
> 
> This is required for the checkpoint and restore to be able to correctly
> restore the client VM.

Well that's a complete corner cases for SPM. Why have you implemented that?

On the other hand the patch looks good, so we can probably keep it like it is.

Regards,
Christian.

> 
> Signed-off-by: Tvrtko Ursulin <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++++
>  include/uapi/drm/amdgpu_drm.h          | 5 ++++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 9ba9de16a27a..ce068e2d32d3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2942,6 +2942,10 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void 
> *data, struct drm_file *filp)
>       case AMDGPU_VM_OP_UNRESERVE_VMID:
>               amdgpu_vmid_free_reserved(adev, vm, AMDGPU_GFXHUB(0));
>               break;
> +     case AMDGPU_VM_OP_QUERY_RESERVED_VMID:
> +             if (vm->reserved_vmid[AMDGPU_GFXHUB(0)])
> +                     args->out.flags = AMDGPU_VM_OUT_FLAG_VMID_RESERVED;
> +             break;
>       default:
>               return -EINVAL;
>       }
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 3069560ac26e..8a6f4c558102 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -587,6 +587,7 @@ struct drm_amdgpu_userq_wait {
>  /* vm ioctl */
>  #define AMDGPU_VM_OP_RESERVE_VMID    1
>  #define AMDGPU_VM_OP_UNRESERVE_VMID  2
> +#define AMDGPU_VM_OP_QUERY_RESERVED_VMID     3
>  
>  struct drm_amdgpu_vm_in {
>       /** AMDGPU_VM_OP_* */
> @@ -594,8 +595,10 @@ struct drm_amdgpu_vm_in {
>       __u32   flags;
>  };
>  
> +/* drm_amdgpu_vm_out flags */
> +#define AMDGPU_VM_OUT_FLAG_VMID_RESERVED     (1ul << 63)
> +
>  struct drm_amdgpu_vm_out {
> -     /** For future use, no flags defined so far */
>       __u64   flags;
>  };
>  

Reply via email to