Merge tag 'mm-stable-2023-04-27-15-30' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / drivers / gpu / drm / ttm / ttm_bo_vm.c
index 5df3edadb808f1daf0db4c4a3feae3f4698c853b..4212b8c91dd425d4c94e53ba5e8d2b01410e03d4 100644 (file)
@@ -218,14 +218,21 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
        prot = ttm_io_prot(bo, bo->resource, prot);
        if (!bo->resource->bus.is_iomem) {
                struct ttm_operation_ctx ctx = {
-                       .interruptible = false,
+                       .interruptible = true,
                        .no_wait_gpu = false,
                        .force_alloc = true
                };
 
                ttm = bo->ttm;
-               if (ttm_tt_populate(bdev, bo->ttm, &ctx))
-                       return VM_FAULT_OOM;
+               err = ttm_tt_populate(bdev, bo->ttm, &ctx);
+               if (err) {
+                       if (err == -EINTR || err == -ERESTARTSYS ||
+                           err == -EAGAIN)
+                               return VM_FAULT_NOPAGE;
+
+                       pr_debug("TTM fault hit %pe.\n", ERR_PTR(err));
+                       return VM_FAULT_SIGBUS;
+               }
        } else {
                /* Iomem should not be marked encrypted */
                prot = pgprot_decrypted(prot);