From: Alex Deucher Date: Thu, 27 Feb 2025 02:33:01 +0000 (-0500) Subject: drm/amdgpu/userq: enable support for secure queues X-Git-Tag: v6.16-rc1~144^2~10^2~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ec2141d23d3bbede9347a60580a40d9e11089ff;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu/userq: enable support for secure queues Enable users to create secure GFX/compute queues. Reviewed-by: Sunil Khatri Tested-by: Jesse.Zhang Reviewed-by: Jesse.Zhang Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c index 5f87cc8b5bf4f..4e02d6cc66b53 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c @@ -311,6 +311,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; + } + r = pm_runtime_get_sync(adev_to_drm(adev)->dev); if (r < 0) { dev_err(adev->dev, "pm_runtime_get_sync() failed for userqueue create\n"); @@ -424,7 +432,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)