accel/habanalabs: print error code when mapping fails
authorDani Liberman <dliberman@habana.ai>
Sun, 12 Nov 2023 11:38:42 +0000 (13:38 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 19 Dec 2023 09:09:43 +0000 (11:09 +0200)
Failure to map is considered a non-trivial error and we need to notify
the user about it.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/memory.c

index 0b8689fe0b64dbd6b9393d738f3a9ab3b99ae146..3348ad12c23751afef2fa98d860a5a0a1f4c781b 100644 (file)
@@ -955,8 +955,8 @@ static int map_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr,
                                (i + 1) == phys_pg_pack->npages);
                if (rc) {
                        dev_err(hdev->dev,
-                               "map failed for handle %u, npages: %llu, mapped: %llu",
-                               phys_pg_pack->handle, phys_pg_pack->npages,
+                               "map failed (%d) for handle %u, npages: %llu, mapped: %llu\n",
+                               rc, phys_pg_pack->handle, phys_pg_pack->npages,
                                mapped_pg_cnt);
                        goto err;
                }
@@ -1186,7 +1186,8 @@ static int map_device_va(struct hl_ctx *ctx, struct hl_mem_in *args, u64 *device
 
        rc = map_phys_pg_pack(ctx, ret_vaddr, phys_pg_pack);
        if (rc) {
-               dev_err(hdev->dev, "mapping page pack failed for handle %u\n", handle);
+               dev_err(hdev->dev, "mapping page pack failed (%d) for handle %u\n",
+                       rc, handle);
                mutex_unlock(&hdev->mmu_lock);
                goto map_err;
        }