accel/habanalabs/gaudi2: fail memory memset when failing to copy QM packet to device
authorTomer Tayar <ttayar@habana.ai>
Tue, 2 Jan 2024 14:51:09 +0000 (16:51 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 26 Feb 2024 07:30:40 +0000 (09:30 +0200)
gaudi2_memset_memory_chunk_using_edma_qm() calls the access_dev_mem()
ASIC function, but ignores its return value.
Add this missing check.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/gaudi2/gaudi2.c

index 05e2170c815e6b6a6d9cc5d5fc30eb200f3aa3ba..1f061209ae2157d67b3d3c96f8ae1c531033d760 100644 (file)
@@ -10345,14 +10345,20 @@ static int gaudi2_memset_memory_chunk_using_edma_qm(struct hl_device *hdev,
 
        pkt_size = sizeof(struct packet_lin_dma);
 
-       for (i = 0; i < 3; i++)
+       for (i = 0; i < 3; i++) {
                rc = hdev->asic_funcs->access_dev_mem(hdev, PCI_REGION_DRAM,
                                phys_addr + (i * sizeof(u64)),
                                ((u64 *)(lin_dma_pkt)) + i, DEBUGFS_WRITE64);
+               if (rc) {
+                       dev_err(hdev->dev, "Failed to copy lin_dma packet to HBM (%#llx)\n",
+                               phys_addr);
+                       return rc;
+               }
+       }
 
        rc = hl_hw_queue_send_cb_no_cmpl(hdev, hw_queue_id, pkt_size, phys_addr);
        if (rc)
-               dev_err(hdev->dev, "Failed to send lin dma packet to H/W queue %d\n",
+               dev_err(hdev->dev, "Failed to send lin_dma packet to H/W queue %d\n",
                                hw_queue_id);
 
        return rc;