]> git.baikalelectronics.ru Git - kernel.git/commitdiff
habanalabs: move memory_scrub_val to hdev struct
authorDafna Hirschfeld <dhirschfeld@habana.ai>
Thu, 2 Jun 2022 08:55:00 +0000 (11:55 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:24 +0000 (09:09 +0300)
move the field memory_scrub_val from struct hl_dbg_device_entry
to struct hl_device. This is because we want to use
this field also if debugfs is off.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/debugfs.c
drivers/misc/habanalabs/common/habanalabs.h

index c6744bfc6da425f3a96e3567edb6e80c8eebf5bb..0f07c2de986b6825f6634594cba7222d98a4f90f 100644 (file)
@@ -543,7 +543,7 @@ static ssize_t hl_memory_scrub(struct file *f, const char __user *buf,
 {
        struct hl_dbg_device_entry *entry = file_inode(f)->i_private;
        struct hl_device *hdev = entry->hdev;
-       u64 val = entry->memory_scrub_val;
+       u64 val = hdev->memory_scrub_val;
        int rc;
 
        if (!hl_device_operational(hdev, NULL)) {
@@ -1516,7 +1516,7 @@ void hl_debugfs_add_device(struct hl_device *hdev)
        debugfs_create_x64("memory_scrub_val",
                                0644,
                                dev_entry->root,
-                               &dev_entry->memory_scrub_val);
+                               &hdev->memory_scrub_val);
 
        debugfs_create_file("memory_scrub",
                                0200,
index 94893305b928749850c4742573485e1f8e5c867f..931fa70926465fdb02cb3d9b430a6df5d1ddd737 100644 (file)
@@ -2065,7 +2065,6 @@ struct hl_debugfs_entry {
  * @addr: next address to read/write from/to in read/write32.
  * @mmu_addr: next virtual address to translate to physical address in mmu_show.
  * @userptr_lookup: the target user ptr to look up for on demand.
- * @memory_scrub_val: the value to which the dram will be scrubbed to using cb scrub_device_dram
  * @mmu_asid: ASID to use while translating in mmu_show.
  * @state_dump_head: index of the latest state dump
  * @i2c_bus: generic u8 debugfs file for bus value to use in i2c_data_read.
@@ -2096,7 +2095,6 @@ struct hl_dbg_device_entry {
        u64                             addr;
        u64                             mmu_addr;
        u64                             userptr_lookup;
-       u64                             memory_scrub_val;
        u32                             mmu_asid;
        u32                             state_dump_head;
        u8                              i2c_bus;
@@ -2797,6 +2795,7 @@ struct hl_reset_info {
  * @stream_master_qid_arr: pointer to array with QIDs of master streams.
  * @fw_major_version: major version of current loaded preboot
  * @dram_used_mem: current DRAM memory consumption.
+ * @memory_scrub_val: the value to which the dram will be scrubbed to using cb scrub_device_dram
  * @timeout_jiffies: device CS timeout value.
  * @max_power: the max power of the device, as configured by the sysadmin. This
  *             value is saved so in case of hard-reset, the driver will restore
@@ -2942,6 +2941,7 @@ struct hl_device {
        u32                             *stream_master_qid_arr;
        u32                             fw_major_version;
        atomic64_t                      dram_used_mem;
+       u64                             memory_scrub_val;
        u64                             timeout_jiffies;
        u64                             max_power;
        u64                             boot_error_status_mask;