From 26fc46d7942d0842ee9767a6d960ae5a9141f534 Mon Sep 17 00:00:00 2001 From: Zhu Lingshan Date: Fri, 14 Feb 2025 14:06:19 +0800 Subject: [PATCH] amdkfd: process svm ioctl only on the primary kfd process svm ioctl should only be processed on the primary kfd process because only the lifecycle of the primary kfd process is tied to the user space applicaiton. Another reason is in virtualization the hypervisor owns the primary kfd process as a privileged one. Signed-off-by: Zhu Lingshan Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 1eb826d9208e..2226281e8146 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1718,6 +1718,12 @@ static int kfd_ioctl_svm(struct file *filep, struct kfd_process *p, void *data) struct kfd_ioctl_svm_args *args = data; int r = 0; + if (p->context_id != KFD_CONTEXT_ID_PRIMARY) { + pr_debug("SVM ioctl not supported on non-primary kfd process\n"); + + return -EOPNOTSUPP; + } + pr_debug("start 0x%llx size 0x%llx op 0x%x nattr 0x%x\n", args->start_addr, args->size, args->op, args->nattr); -- 2.47.3