diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_svm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_svm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index 345e4935575a..23435ee27892 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -162,27 +162,33 @@ nouveau_svmm_invalidate(struct nouveau_svmm *svmm, u64 start, u64 limit) } } -static void +static int nouveau_svmm_sync_cpu_device_pagetables(struct hmm_mirror *mirror, - enum hmm_update_type update, - unsigned long start, - unsigned long limit) + const struct hmm_update *update) { struct nouveau_svmm *svmm = container_of(mirror, typeof(*svmm), mirror); + unsigned long start = update->start, end = update->end; + + SVMM_DBG(svmm, "invalidate %016lx-%016lx", start, end); - SVMM_DBG(svmm, "invalidate %016lx-%016lx", start, limit); + /* For now always bail out when we can not block. */ + if (!update->blockable) + return -EAGAIN; mutex_lock(&svmm->mutex); - if (limit > svmm->unmanaged.start && start < svmm->unmanaged.limit) { + /* Ignore anything inside the unmanaged area. */ + if (end > svmm->unmanaged.start && start < svmm->unmanaged.limit) { if (start < svmm->unmanaged.start) { nouveau_svmm_invalidate(svmm, start, svmm->unmanaged.limit); } start = svmm->unmanaged.limit; } - - nouveau_svmm_invalidate(svmm, start, limit); + if (start < end) + nouveau_svmm_invalidate(svmm, start, end); mutex_unlock(&svmm->mutex); + + return 0; } static void |