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 <lingshan.zhu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Zhu Lingshan
2025-02-14 14:06:19 +08:00
committed by Alex Deucher
parent 65cce2a172
commit 26fc46d794

View File

@@ -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);