[AMD Official Use Only - AMD Internal Distribution Only]

Test-by: Jesse.Zhang <jesse.zh...@amd.com> ,  Series is Reviewed-by: 
Jesse.Zhang <jesse.zh...@amd.com>

-----Original Message-----
From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Friday, April 11, 2025 2:54 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <alexander.deuc...@amd.com>
Subject: [PATCH 13/13] drm/amdgpu/userq: enable support for secure queues

Enable users to create secure GFX/compute queues.

Signed-off-by: Alex Deucher <alexander.deuc...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
index b8b13b6ab4631..cd279f8164158 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
@@ -303,6 +303,14 @@ amdgpu_userqueue_create(struct drm_file *filp, union 
drm_amdgpu_userq *args)
        if (r)
                return r;

+       if ((args->in.flags & AMDGPU_USERQ_CREATE_FLAGS_QUEUE_SECURE) &&
+           (args->in.ip_type != AMDGPU_HW_IP_GFX) &&
+           (args->in.ip_type != AMDGPU_HW_IP_COMPUTE) &&
+           !amdgpu_is_tmz(adev)) {
+               drm_err(adev_to_drm(adev), "Secure only supported on 
GFX/Compute queues\n");
+               return -EINVAL;
+       }
+
        /*
         * There could be a situation that we are creating a new queue while
         * the other queues under this UQ_mgr are suspended. So if there is any 
@@ -401,7 +409,8 @@ int amdgpu_userq_ioctl(struct drm_device *dev, void *data,

        switch (args->in.op) {
        case AMDGPU_USERQ_OP_CREATE:
-               if (args->in.flags & 
~AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_MASK)
+               if (args->in.flags & 
~(AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_MASK |
+                                      AMDGPU_USERQ_CREATE_FLAGS_QUEUE_SECURE))
                        return -EINVAL;
                r = amdgpu_userqueue_create(filp, args);
                if (r)
--
2.49.0

Reply via email to