On 27/05/2026 11:35, Christian König wrote:
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?

I wasn't sure what are the use cases but have just saw some low hanging uapi which can be easily handled. Now that you raised it, and I read about on the history of the feature, I agree it is not interesting to checkpoint and restore things under performance profiling. :)

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

Thanks, but if I don't hear otherwise I will drop it from a future re-spin since it really does sound like noise now.

Regards,

Tvrtko


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