public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay@gmail.com>
To: linux-kernel@vger.kernel.org, SW_Drivers@habana.ai
Subject: [PATCH 1/9] habanalabs: change CB's ID to be 64 bits
Date: Sat, 15 Aug 2020 20:59:30 +0300	[thread overview]
Message-ID: <20200815175938.16619-1-oded.gabbay@gmail.com> (raw)

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>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
 drivers/misc/habanalabs/common/command_buffer.c | 2 +-
 drivers/misc/habanalabs/common/debugfs.c        | 2 +-
 drivers/misc/habanalabs/common/habanalabs.h     | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/habanalabs/common/command_buffer.c b/drivers/misc/habanalabs/common/command_buffer.c
index 7c38c4f7f9c0..33aee64f37aa 100644
--- a/drivers/misc/habanalabs/common/command_buffer.c
+++ b/drivers/misc/habanalabs/common/command_buffer.c
@@ -173,7 +173,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);
diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c
index c50c6fc9e905..25775b12139b 100644
--- a/drivers/misc/habanalabs/common/debugfs.c
+++ b/drivers/misc/habanalabs/common/debugfs.c
@@ -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);
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index 52a07c8d7d7c..2decf7be3e08 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -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;
-- 
2.17.1


             reply	other threads:[~2020-08-15 22:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 17:59 Oded Gabbay [this message]
2020-08-15 17:59 ` [PATCH 2/9] habanalabs: cast int to u32 before printing it with %u Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 3/9] habanalabs: eliminate redundant else condition Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 4/9] habanalabs: use standard BIT() and GENMASK() Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 5/9] habanalabs: use FIELD_PREP() instead of << Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 6/9] habanalabs: remove redundant assignment to variable Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 7/9] habanalabs: check TPC vector pipe is empty Oded Gabbay
2020-08-16 15:24   ` Tomer Tayar
2020-08-15 17:59 ` [PATCH 9/9] habanalabs: extend busy engines mask to 64 bits Oded Gabbay
2020-08-16 15:24 ` [PATCH 1/9] habanalabs: change CB's ID to be " Tomer Tayar
     [not found] ` <20200815175938.16619-8-oded.gabbay@gmail.com>
2020-08-16 15:24   ` [PATCH 8/9] habanalabs: use 1U when shifting bits Tomer Tayar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200815175938.16619-1-oded.gabbay@gmail.com \
    --to=oded.gabbay@gmail.com \
    --cc=SW_Drivers@habana.ai \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox