Skip to contentSkip to conversation

habanalabs: add comments in uapi/misc/habanalabs.h

PATCH New Oded Gabbay 3 participants 6 messages Feb 28, 2019 – Mar 2, 2019 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 8/15 habanalabs: add comments in uapi/misc/habanalabs.h

Add comment about minimum and maximum size of command buffer. Add some text about the expected input of CS IOCTL.

---
Changes in v2:
- Add changelog in the commit message

 include/uapi/misc/habanalabs.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
include/uapi/misc/habanalabs.h +9 -1
index 23d6ad3459cb..7fd6f633534c 100644
@@ -112,7 +112,9 @@ struct hl_cb_in {
 	__u64 cb_handle;
 	/* HL_CB_OP_* */
 	__u32 op;
-	/* Size of CB. Minimum requested size must be PAGE_SIZE */
+	/* Size of CB. Maximum size is 2MB. The minimum size that will be
+	 * allocated, regardless of this parameter's value, is PAGE_SIZE
+	 */
 	__u32 cb_size;
 	/* Context ID - Currently not in use */
 	__u32 ctx_id;
@@ -364,6 +366,12 @@ union hl_mem_args {
  * internal. The driver will get completion notifications from the device only
  * on JOBS which are enqueued in the external queues.
  *
+ * For jobs on external queues, the user needs to create command buffers
+ * through the CB ioctl and give the CB's handle to the CS ioctl. For jobs on
+ * internal queues, the user needs to prepare a "command buffer" with packets
+ * on either the SRAM or DRAM, and give the device address of that buffer to
+ * the CS ioctl.
+ *
  * This IOCTL is asynchronous in regard to the actual execution of the CS. This
  * means it returns immediately after ALL the JOBS were enqueued on their
  * relevant queues. Therefore, the user mustn't assume the CS has been completed
Signature · 1 line
2.17.1
#1 lore raw

PATCH 11/15 habanalabs: print pointer using %p

Don't cast pointer to u64 to print it. Instead, print the pointer using %p.

---
Changes in v2:
- Add changelog in the commit message

 drivers/misc/habanalabs/goya/goya.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/misc/habanalabs/goya/goya.c +2 -3
index 13923f4127af..39824214ce61 100644
@@ -4276,9 +4276,8 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,
 			return 0;
 
 		dev_err(hdev->dev,
-			"Internal CB address 0x%llx + 0x%x is not in SRAM nor in DRAM\n",
-			(u64) (uintptr_t) parser->user_cb,
-			parser->user_cb_size);
+			"Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n",
+			parser->user_cb, parser->user_cb_size);
 
 		return -EFAULT;
 	}
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 11/15] habanalabs: print pointer using %p

Quoted 7 lines · Oded Gabbay

Don't cast pointer to u64 to print it. Instead, print the pointer using %p.

---
Changes in v2:
- Add changelog in the commit message

This isn't marked "v2" :(

Anyway, I'll try to piece this all together, next time it's easier to just resend the whole series...

greg k-h

#3 lore raw

Re: [PATCH 11/15] habanalabs: print pointer using %p

Quoted 11 lines · Greg KH
Quoted 7 lines · Oded Gabbay

Don't cast pointer to u64 to print it. Instead, print the pointer using %p.

---
Changes in v2:
- Add changelog in the commit message

This isn't marked "v2" :(

Yes, sorry about that, will do better next time.

Quoted 3 lines

Anyway, I'll try to piece this all together, next time it's easier to just resend the whole series...

Got it,
Thanks,
Oded

Quoted 2 lines

greg k-h

#4 lore raw

Re: [PATCH 11/15] habanalabs: print pointer using %p

In reply to Oded Gabbay
Quoted 2 lines · Oded Gabbay

Don't cast pointer to u64 to print it. Instead, print the pointer using %p.

You might want to use %px here if you _really_
want the actual address and not the hashed output
%p normally produces.

drivers/misc/habanalabs/goya/goya.c

Quoted 1 line
drivers/misc/habanalabs/goya/goya.c +0 -0

[]

Quoted 9 lines
drivers/misc/habanalabs/goya/goya.c +2 -3
@@ -4276,9 +4276,8 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,
 			return 0;
 
 		dev_err(hdev->dev,
-			"Internal CB address 0x%llx + 0x%x is not in SRAM nor in DRAM\n",
-			(u64) (uintptr_t) parser->user_cb,
-			parser->user_cb_size);
+			"Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n",
+			parser->user_cb, parser->user_cb_size);
#5 lore raw

Re: [PATCH 11/15] habanalabs: print pointer using %p

Quoted 8 lines · Joe Perches
Quoted 2 lines · Oded Gabbay

Don't cast pointer to u64 to print it. Instead, print the pointer using %p.

You might want to use %px here if you _really_
want the actual address and not the hashed output
%p normally produces.

Yes, you are correct. Thanks for pointing it out, I'll fix that. Oded

Quoted 14 lines

drivers/misc/habanalabs/goya/goya.c

Quoted 2 lines
drivers/misc/habanalabs/goya/goya.c +0 -0

[]

Quoted 9 lines
drivers/misc/habanalabs/goya/goya.c +2 -3
@@ -4276,9 +4276,8 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,
                      return 0;
 
              dev_err(hdev->dev,
-                     "Internal CB address 0x%llx + 0x%x is not in SRAM nor in DRAM\n",
-                     (u64) (uintptr_t) parser->user_cb,
-                     parser->user_cb_size);
+                     "Internal CB address %p + 0x%x is not in SRAM nor in DRAM\n",
+                     parser->user_cb, parser->user_cb_size);