habanalabs/gaudi: use memory_scrub_val from debugfs
authorDafna Hirschfeld <dhirschfeld@habana.ai>
Thu, 23 Jun 2022 04:47:48 +0000 (07:47 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:25 +0000 (09:09 +0300)
In the callback scrub_device_mem, use 'memory_scrub_val'
from debugfs for the scrubbing value.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Documentation/ABI/testing/debugfs-driver-habanalabs
drivers/misc/habanalabs/gaudi/gaudi.c

index 0f8d20fe343f32edf60549c89d2424e727f1282f..deb66944cd0c7d6d7d159711630e3c4e496dd372 100644 (file)
@@ -182,7 +182,8 @@ Date:           May 2022
 KernelVersion:  5.19
 Contact:        dhirschfeld@habana.ai
 Description:    The value to which the dram will be set to when the user
-                scrubs the dram using 'memory_scrub' debugfs file
+                scrubs the dram using 'memory_scrub' debugfs file and
+                the scrubbing value when using module param 'memory_scrub'
 
 What:           /sys/kernel/debug/habanalabs/hl<n>/mmu
 Date:           Jan 2019
index bc5e74505d0398ef3555db5cae18f0b2e2966793..8cf3382fa0395ca51a71eaa7c6c10405e6182b01 100644 (file)
@@ -4851,7 +4851,7 @@ static int gaudi_scrub_device_mem(struct hl_device *hdev)
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        u64 addr, size, dummy_val;
        int rc = 0;
-       u64 val = 0;
+       u64 val = hdev->memory_scrub_val;
 
        if (!hdev->memory_scrub)
                return 0;
@@ -4871,7 +4871,6 @@ static int gaudi_scrub_device_mem(struct hl_device *hdev)
        /* Scrub SRAM */
        addr = prop->sram_user_base_address;
        size = hdev->pldm ? 0x10000 : prop->sram_size - SRAM_USER_BASE_OFFSET;
-       val = 0x7777777777777777ull;
 
        dev_dbg(hdev->dev, "Scrubing SRAM: 0x%09llx - 0x%09llx val: 0x%llx\n",
                        addr, addr + size, val);
@@ -4882,7 +4881,7 @@ static int gaudi_scrub_device_mem(struct hl_device *hdev)
        }
 
        /* Scrub HBM using all DMA channels in parallel */
-       rc = gaudi_scrub_device_dram(hdev, 0xdeadbeaf);
+       rc = gaudi_scrub_device_dram(hdev, val);
        if (rc) {
                dev_err(hdev->dev, "Failed to clear HBM (%d)\n", rc);
                return rc;