habanalabs: change CB's ID to be 64 bits
authorOded Gabbay <oded.gabbay@gmail.com>
Wed, 12 Aug 2020 07:11:20 +0000 (10:11 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Tue, 22 Sep 2020 15:49:49 +0000 (18:49 +0300)
Although the possible values for CB's ID are only 32 bits, there are a few
places in the code where this field is shifted and passed into a function
which expects 64 bits.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/common/command_buffer.c
drivers/misc/habanalabs/common/debugfs.c
drivers/misc/habanalabs/common/habanalabs.h

index a8004911c9771ac522290d3523ed6eab195aa2ac..e4bbe6a8e00f80a419d959df5148a2bf936bc794 100644 (file)
@@ -174,7 +174,7 @@ int hl_cb_create(struct hl_device *hdev, struct hl_cb_mgr *mgr,
                goto release_cb;
        }
 
-       cb->id = rc;
+       cb->id = (u64) rc;
 
        kref_init(&cb->refcount);
        spin_lock_init(&cb->lock);
index aa77771635d33fca449c13e8bc7cde97315a3130..4b416f64f6ecaef95d42913d8eeeab1e86c592ed 100644 (file)
@@ -110,7 +110,7 @@ static int command_buffers_show(struct seq_file *s, void *data)
                        seq_puts(s, "---------------------------------------------------------------\n");
                }
                seq_printf(s,
-                       "   %03d        %d    0x%08x      %d          %d          %d\n",
+                       "   %03llu        %d    0x%08x      %d          %d          %d\n",
                        cb->id, cb->ctx_id, cb->size,
                        kref_read(&cb->refcount),
                        cb->mmap, cb->cs_cnt);
index caced12f278facf510c28d6e7fcb796ae6f432fc..2fd268e4cf10259de9b349ee39bef2981eb79d87 100644 (file)
@@ -401,11 +401,11 @@ struct hl_cb_mgr {
  * @lock: spinlock to protect mmap/cs flows.
  * @debugfs_list: node in debugfs list of command buffers.
  * @pool_list: node in pool list of command buffers.
+ * @id: the CB's ID.
  * @kernel_address: Holds the CB's kernel virtual address.
  * @bus_address: Holds the CB's DMA address.
  * @mmap_size: Holds the CB's size that was mmaped.
  * @size: holds the CB's size.
- * @id: the CB's ID.
  * @cs_cnt: holds number of CS that this CB participates in.
  * @ctx_id: holds the ID of the owner's context.
  * @mmap: true if the CB is currently mmaped to user.
@@ -418,11 +418,11 @@ struct hl_cb {
        spinlock_t              lock;
        struct list_head        debugfs_list;
        struct list_head        pool_list;
+       u64                     id;
        u64                     kernel_address;
        dma_addr_t              bus_address;
        u32                     mmap_size;
        u32                     size;
-       u32                     id;
        u32                     cs_cnt;
        u32                     ctx_id;
        u8                      mmap;