mei: hbm: define dma ring setup protocol
authorTomas Winkler <tomas.winkler@intel.com>
Tue, 31 Jul 2018 06:35:34 +0000 (09:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Aug 2018 08:18:30 +0000 (10:18 +0200)
The protocol defines how to setup an I/O ring on top of host
memory to utilize the device DMA engine for faster transport.

Three memory buffers are allocated.
A Host circular buffer for from the Host to Device communication.
A Device circular buffer for from Device to the Host communication.
And finally a Control block where the pointers for the both
circular buffers are managed.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/hw.h

index 3b325d955fbee6d63ff8a01e6817137c0f7b26a6..76fb502e6f71973ea82a93c2f0c6620b3ae2e433 100644 (file)
 #define MEI_HBM_NOTIFY_RES_CMD              0x90
 #define MEI_HBM_NOTIFICATION_CMD            0x11
 
+#define MEI_HBM_DMA_SETUP_REQ_CMD           0x12
+#define MEI_HBM_DMA_SETUP_RES_CMD           0x92
+
 /*
  * MEI Stop Reason
  * used by hbm_host_stop_request.reason
@@ -449,4 +452,50 @@ struct hbm_notification {
        u8 reserved[1];
 } __packed;
 
+/**
+ * struct hbm_dma_mem_dscr - dma ring
+ *
+ * @addr_hi: the high 32bits of 64 bit address
+ * @addr_lo: the low  32bits of 64 bit address
+ * @size   : size in bytes (must be power of 2)
+ */
+struct hbm_dma_mem_dscr {
+       u32 addr_hi;
+       u32 addr_lo;
+       u32 size;
+} __packed;
+
+enum {
+       DMA_DSCR_HOST = 0,
+       DMA_DSCR_DEVICE = 1,
+       DMA_DSCR_CTRL = 2,
+       DMA_DSCR_NUM,
+};
+
+/**
+ * struct hbm_dma_setup_request - dma setup request
+ *
+ * @hbm_cmd: bus message command header
+ * @reserved: reserved for alignment
+ * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
+ */
+struct hbm_dma_setup_request {
+       u8 hbm_cmd;
+       u8 reserved[3];
+       struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
+} __packed;
+
+/**
+ * struct hbm_dma_setup_response - dma setup response
+ *
+ * @hbm_cmd: bus message command header
+ * @status: 0 on success; otherwise DMA setup failed.
+ * @reserved: reserved for alignment
+ */
+struct hbm_dma_setup_response {
+       u8 hbm_cmd;
+       u8 status;
+       u8 reserved[2];
+} __packed;
+
 #endif