aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorZhu Lingshan <lingshan.zhu@amd.com>2025-06-30 11:00:29 +0800
committerAlex Deucher <alexander.deucher@amd.com>2025-12-08 13:56:42 -0500
commit1707d5760c71b813fb5a4b6ccedcf21bc0ecb481 (patch)
treeee24e6b0e8556ad0e31f48e709693af5d4fde077 /drivers/gpu/drm
parent26fc46d7942d0842ee9767a6d960ae5a9141f534 (diff)
amdkfd: process USERPTR allocation only on the primary kfd process
The lifecycle of the primary kfd process is tied to the user space program, all secondary kfd process would be destroyed when fd close. Thus only the primary kfd process should process USERPTR memory allocation. Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_chardev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 2226281e8146..ff1a6a903463 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1062,6 +1062,12 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
if (args->size == 0)
return -EINVAL;
+ if (p->context_id != KFD_CONTEXT_ID_PRIMARY && (flags & KFD_IOC_ALLOC_MEM_FLAGS_USERPTR)) {
+ pr_debug("USERPTR is not supported on non-primary kfd_process\n");
+
+ return -EOPNOTSUPP;
+ }
+
#if IS_ENABLED(CONFIG_HSA_AMD_SVM)
/* Flush pending deferred work to avoid racing with deferred actions
* from previous memory map changes (e.g. munmap).