habanalabs: export uapi defines to user-space
authorOded Gabbay <oded.gabbay@gmail.com>
Sun, 10 Nov 2019 14:08:26 +0000 (16:08 +0200)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 21 Nov 2019 09:35:46 +0000 (11:35 +0200)
The two defines that control the maximum size of a command buffer and the
maximum number of JOBS per CS need to be exported to the user as they are
part of the API towards user-space.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Omer Shpigelman <oshpigelman@habana.ai>
drivers/misc/habanalabs/habanalabs.h
include/uapi/misc/habanalabs.h

index 0813041f669ad1e68899eb45ef1862dcb7e364b8..2a5344cc1a609b52d564f626d1939b16d9e33ee0 100644 (file)
@@ -40,8 +40,6 @@
 
 #define HL_MAX_QUEUES                  128
 
-#define HL_MAX_JOBS_PER_CS             512
-
 /* MUST BE POWER OF 2 and larger than 1 */
 #define HL_MAX_PENDING_CS              64
 
@@ -242,8 +240,6 @@ struct hl_dma_fence {
  * Command Buffers
  */
 
-#define HL_MAX_CB_SIZE         0x200000        /* 2MB */
-
 /**
  * struct hl_cb_mgr - describes a Command Buffer Manager.
  * @cb_lock: protects cb_handles.
index e387d9e560b34dbaf376fa54ca4dffe6f8cdba1c..716e70750f23a600f7e32bb7ea626d24b27c4356 100644 (file)
@@ -192,13 +192,15 @@ struct hl_info_args {
 /* Opcode to destroy previously created command buffer */
 #define HL_CB_OP_DESTROY       1
 
+#define HL_MAX_CB_SIZE         0x200000        /* 2MB */
+
 struct hl_cb_in {
        /* Handle of CB or 0 if we want to create one */
        __u64 cb_handle;
        /* HL_CB_OP_* */
        __u32 op;
-       /* Size of CB. Maximum size is 2MB. The minimum size that will be
-        * allocated, regardless of this parameter's value, is PAGE_SIZE
+       /* Size of CB. Maximum size is HL_MAX_CB_SIZE. 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 */
@@ -244,6 +246,8 @@ struct hl_cs_chunk {
 
 #define HL_CS_STATUS_SUCCESS           0
 
+#define HL_MAX_JOBS_PER_CS             512
+
 struct hl_cs_in {
        /* this holds address of array of hl_cs_chunk for restore phase */
        __u64 chunks_restore;
@@ -253,9 +257,13 @@ struct hl_cs_in {
         * Currently not in use
         */
        __u64 chunks_store;
-       /* Number of chunks in restore phase array */
+       /* Number of chunks in restore phase array. Maximum number is
+        * HL_MAX_JOBS_PER_CS
+        */
        __u32 num_chunks_restore;
-       /* Number of chunks in execution array */
+       /* Number of chunks in execution array. Maximum number is
+        * HL_MAX_JOBS_PER_CS
+        */
        __u32 num_chunks_execute;
        /* Number of chunks in restore phase array - Currently not in use */
        __u32 num_chunks_store;