]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
habanalabs: Mark queue as expecting CB handle or address
authorTomer Tayar <ttayar@habana.ai>
Thu, 3 Oct 2019 15:22:35 +0000 (15:22 +0000)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 21 Nov 2019 09:35:45 +0000 (11:35 +0200)
Jobs on some queues must be provided with a handle to a driver command
buffer object, while for other queues, jobs must be provided with an
address to a command buffer.
Currently the distinction is done based on the queue type, which is less
flexible if the same queue type behaves differently on different
types of ASICs.
This patch adds a new queue property for this target, which is
configured per queue type per ASIC type.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/command_submission.c
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/habanalabs.h

index a9ac045dcfde307f69c94a4ff28f0466a409d28c..f44205540520f97cf7c5ae0223ec8ecae924b877 100644 (file)
@@ -414,7 +414,9 @@ static struct hl_cb *validate_queue_index(struct hl_device *hdev,
                        "Queue index %d is restricted for the kernel driver\n",
                        chunk->queue_index);
                return NULL;
-       } else if (hw_queue_prop->type == QUEUE_TYPE_INT) {
+       }
+
+       if (!hw_queue_prop->requires_kernel_cb) {
                *ext_queue = false;
                return (struct hl_cb *) (uintptr_t) chunk->cb_handle;
        }
index 09caef7642fd8cf299ecd66efe741c132ab6c3d3..71693fcffb1634badebcd95cc306c21d18171627 100644 (file)
@@ -337,17 +337,20 @@ void goya_get_fixed_properties(struct hl_device *hdev)
        for (i = 0 ; i < NUMBER_OF_EXT_HW_QUEUES ; i++) {
                prop->hw_queues_props[i].type = QUEUE_TYPE_EXT;
                prop->hw_queues_props[i].driver_only = 0;
+               prop->hw_queues_props[i].requires_kernel_cb = 1;
        }
 
        for (; i < NUMBER_OF_EXT_HW_QUEUES + NUMBER_OF_CPU_HW_QUEUES ; i++) {
                prop->hw_queues_props[i].type = QUEUE_TYPE_CPU;
                prop->hw_queues_props[i].driver_only = 1;
+               prop->hw_queues_props[i].requires_kernel_cb = 0;
        }
 
        for (; i < NUMBER_OF_EXT_HW_QUEUES + NUMBER_OF_CPU_HW_QUEUES +
                        NUMBER_OF_INT_HW_QUEUES; i++) {
                prop->hw_queues_props[i].type = QUEUE_TYPE_INT;
                prop->hw_queues_props[i].driver_only = 0;
+               prop->hw_queues_props[i].requires_kernel_cb = 0;
        }
 
        for (; i < HL_MAX_QUEUES; i++)
index c3d24ffad9fa0d43b855717e690e7773300a1221..f47f4b22cb6b54c268abdf4f68be4a878e7765f5 100644 (file)
@@ -98,10 +98,13 @@ enum hl_queue_type {
  * @type: queue type.
  * @driver_only: true if only the driver is allowed to send a job to this queue,
  *               false otherwise.
+ * @requires_kernel_cb: true if a CB handle must be provided for jobs on this
+ *                      queue, false otherwise (a CB address must be provided).
  */
 struct hw_queue_properties {
        enum hl_queue_type      type;
        u8                      driver_only;
+       u8                      requires_kernel_cb;
 };
 
 /**