History

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.

Ofir Bitton committed 5 years ago

Commit d00697f1 parent 89473a16 files · +153 −10Browse files

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

Unified · Split

include/uapi/misc/habanalabs.h+16−2
@@ -718,6 +718,8 @@ union hl_wait_cs_args { · 717 unmodified lines
718718 #define HL_MEM_OP_MAP 2
719719 /* Opcode to unmap previously mapped host and device memory */
720720 #define HL_MEM_OP_UNMAP 3
721+/* Opcode to map a hw block */
722+#define HL_MEM_OP_MAP_BLOCK 4
721723
722724 /* Memory flags */
723725 #define HL_MEM_CONTIGUOUS 0x1
@@ -772,6 +774,17 @@ struct hl_mem_in { · 48 unmodified lines
772774 __u64 mem_size;
773775 } map_host;
774776
777+ /* HL_MEM_OP_MAP_BLOCK - map a hw block */
778+ struct {
779+ /*
780+ * HW block address to map, a handle will be returned
781+ * to the user and will be used to mmap the relevant
782+ * block. Only addresses from configuration space are
783+ * allowed.
784+ */
785+ __u64 block_addr;
786+ } map_block;
787+
775788 /* HL_MEM_OP_UNMAP - unmap host memory */
776789 struct {
777790 /* Virtual address returned from HL_MEM_OP_MAP */
@@ -798,8 +811,9 @@ struct hl_mem_out { · 20 unmodified lines
798811 __u64 device_virt_addr;
799812
800813 /*
801− * Used for HL_MEM_OP_ALLOC. This is the assigned
802− * handle for the allocated memory
814+ * Used for HL_MEM_OP_ALLOC and HL_MEM_OP_MAP_BLOCK.
815+ * This is the assigned handle for the allocated memory
816+ * or mapped block
803817 */
804818 __u64 handle;
805819 };