History

habanalabs: use enum for CB allocation options

In the future there will be situations where queues can accept either kernel allocated CBs or user allocated CBs, depending on different states. Therefore, instead of using a boolean variable of kernel/user allocated CB, we need to use a bitmask to indicate that, which will allow to combine the two options. Add a flag to the uapi so the user will be able to indicate whether the CB was allocated by kernel or by user. Of course the driver validates that.

Tal Cohen committed 6 years ago

Commit 4bb1f2f1 parent 3c681575 files · +73 −12Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/misc/habanalabs.h+16−0
@@ -490,6 +490,22 @@ union hl_cb_args { · 489 unmodified lines
490490 struct hl_cb_out out;
491491 };
492492
493+/* HL_CS_CHUNK_FLAGS_ values
494+ *
495+ * HL_CS_CHUNK_FLAGS_USER_ALLOC_CB:
496+ * Indicates if the CB was allocated and mapped by userspace.
497+ * User allocated CB is a command buffer allocated by the user, via malloc
498+ * (or similar). After allocating the CB, the user invokes “memory ioctl”
499+ * to map the user memory into a device virtual address. The user provides
500+ * this address via the cb_handle field. The interface provides the
501+ * ability to create a large CBs, Which aren’t limited to
502+ * “HL_MAX_CB_SIZE”. Therefore, it increases the PCI-DMA queues
503+ * throughput. This CB allocation method also reduces the use of Linux
504+ * DMA-able memory pool. Which are limited and used by other Linux
505+ * sub-systems.
506+ */
507+#define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1
508+
493509 /*
494510 * This structure size must always be fixed to 64-bytes for backward
495511 * compatibility