Skip to content

Commit

Permalink
drm/nouveau/svm: check for SVM initialized before migrating
Browse files Browse the repository at this point in the history
When migrating system memory to GPU memory, check that SVM has been
enabled. Even though most errors can be ignored since migration is
a performance optimization, return an error because this is a violation
of the API.

Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ralph Campbell authored and Ben Skeggs committed Apr 7, 2020
1 parent b92103b commit 822cab6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/nouveau/nouveau_svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
mm = get_task_mm(current);
down_read(&mm->mmap_sem);

if (!cli->svm.svmm) {
up_read(&mm->mmap_sem);
return -EINVAL;
}

for (addr = args->va_start, end = args->va_start + size; addr < end;) {
struct vm_area_struct *vma;
unsigned long next;
Expand Down

0 comments on commit 822cab6

Please sign in to comment.