summaryrefslogtreecommitdiff
path: root/include/uapi/misc
diff options
context:
space:
mode:
authorOfir Bitton <obitton@habana.ai>2021-01-05 12:55:06 +0200
committerOded Gabbay <ogabbay@kernel.org>2021-01-27 21:03:51 +0200
commitd00697fbe13ccc1dfb7adb82204e1469a7783b07 (patch)
treeefb59972aab43efc4acac6c88d5f482939ee2eaf /include/uapi/misc
parent89473a1fc3607d9ee5a4f859a2684d0abd0c4ded (diff)
habanalabs: add new mem ioctl op for mapping hw blocks
For future ASIC support the driver allows user to map certain regions in the device's configuration space for direct access from userspace. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'include/uapi/misc')
-rw-r--r--include/uapi/misc/habanalabs.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h
index 866355a53188..b1c09eba8ac2 100644
--- a/include/uapi/misc/habanalabs.h
+++ b/include/uapi/misc/habanalabs.h
@@ -718,6 +718,8 @@ union hl_wait_cs_args {
#define HL_MEM_OP_MAP 2
/* Opcode to unmap previously mapped host and device memory */
#define HL_MEM_OP_UNMAP 3
+/* Opcode to map a hw block */
+#define HL_MEM_OP_MAP_BLOCK 4
/* Memory flags */
#define HL_MEM_CONTIGUOUS 0x1
@@ -772,6 +774,17 @@ struct hl_mem_in {
__u64 mem_size;
} map_host;
+ /* HL_MEM_OP_MAP_BLOCK - map a hw block */
+ struct {
+ /*
+ * HW block address to map, a handle will be returned
+ * to the user and will be used to mmap the relevant
+ * block. Only addresses from configuration space are
+ * allowed.
+ */
+ __u64 block_addr;
+ } map_block;
+
/* HL_MEM_OP_UNMAP - unmap host memory */
struct {
/* Virtual address returned from HL_MEM_OP_MAP */
@@ -798,8 +811,9 @@ struct hl_mem_out {
__u64 device_virt_addr;
/*
- * Used for HL_MEM_OP_ALLOC. This is the assigned
- * handle for the allocated memory
+ * Used for HL_MEM_OP_ALLOC and HL_MEM_OP_MAP_BLOCK.
+ * This is the assigned handle for the allocated memory
+ * or mapped block
*/
__u64 handle;
};