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
718#define HL_MEM_OP_MAP 2718#define HL_MEM_OP_MAP 2
719/* Opcode to unmap previously mapped host and device memory */719/* Opcode to unmap previously mapped host and device memory */
720#define HL_MEM_OP_UNMAP 3720#define HL_MEM_OP_UNMAP 3
721/* Opcode to map a hw block */
722#define HL_MEM_OP_MAP_BLOCK 4
721 723
722/* Memory flags */724/* Memory flags */
723#define HL_MEM_CONTIGUOUS 0x1725#define HL_MEM_CONTIGUOUS 0x1
@@ -772,6 +774,17 @@ struct hl_mem_in { · 48 unmodified lines
772 __u64 mem_size;774 __u64 mem_size;
773 } map_host;775 } map_host;
774 776
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
775 /* HL_MEM_OP_UNMAP - unmap host memory */788 /* HL_MEM_OP_UNMAP - unmap host memory */
776 struct {789 struct {
777 /* Virtual address returned from HL_MEM_OP_MAP */790 /* Virtual address returned from HL_MEM_OP_MAP */
@@ -798,8 +811,9 @@ struct hl_mem_out { · 20 unmodified lines
798 __u64 device_virt_addr;811 __u64 device_virt_addr;
799 812
800 /*813 /*
801 * Used for HL_MEM_OP_ALLOC. This is the assigned814 * Used for HL_MEM_OP_ALLOC and HL_MEM_OP_MAP_BLOCK.
802 * handle for the allocated memory815 * This is the assigned handle for the allocated memory
816 * or mapped block
803 */817 */
804 __u64 handle;818 __u64 handle;
805 };819 };