aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/switchtec.h
diff options
context:
space:
mode:
authorWesley Sheng <wesley.sheng@microchip.com>2018-12-10 04:12:24 -0500
committerBjorn Helgaas <bhelgaas@google.com>2018-12-13 10:03:32 -0500
commitf7eb7b8a4f72b0d9dea69b09f58185ffab97fd35 (patch)
tree44c8f6a837faf78d53bd2ad0308db0b3a5a2ea7f /include/linux/switchtec.h
parent52d8db8e0cd7c28316514568fe5df0cfd4fa2075 (diff)
switchtec: Add MRPC DMA mode support
MRPC normal mode requires the host to read the MRPC command status and output data from BAR. This results in high latency responses from the Memory Read TLP and potential Completion Timeout (CTO). Add support for MRPC DMA mode, including related macro definitions and data structures and code to: * Retrieve MRPC DMA mode version from adapter firmware * Allocate DMA buffer, register ISR, and enable DMA during init * Check MRPC execution status and get execution results from DMA buffer * Release DMA buffer and disable DMA function when unloading module MRPC DMA mode is a new feature of firmware, and the driver will fall back to MRPC normal mode if there is no support in the legacy firmware. Add a module parameter, "use_dma_mrpc", to select between MRPC DMA mode and MRPC normal mode. Since the driver automatically detects DMA support in the firmware, this parameter is just for debugging and testing. Include <linux/io-64-nonatomic-lo-hi.h> so that readq/writeq is replaced by two readl/writel on systems that do not support it. Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com> [bhelgaas: changelog, simplify dma_ver check] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Diffstat (limited to 'include/linux/switchtec.h')
-rw-r--r--include/linux/switchtec.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index ab400af6f0ce..eee0412bdf4b 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -29,6 +29,7 @@
29#define SWITCHTEC_EVENT_EN_IRQ BIT(3) 29#define SWITCHTEC_EVENT_EN_IRQ BIT(3)
30#define SWITCHTEC_EVENT_FATAL BIT(4) 30#define SWITCHTEC_EVENT_FATAL BIT(4)
31 31
32#define SWITCHTEC_DMA_MRPC_EN BIT(0)
32enum { 33enum {
33 SWITCHTEC_GAS_MRPC_OFFSET = 0x0000, 34 SWITCHTEC_GAS_MRPC_OFFSET = 0x0000,
34 SWITCHTEC_GAS_TOP_CFG_OFFSET = 0x1000, 35 SWITCHTEC_GAS_TOP_CFG_OFFSET = 0x1000,
@@ -46,6 +47,10 @@ struct mrpc_regs {
46 u32 cmd; 47 u32 cmd;
47 u32 status; 48 u32 status;
48 u32 ret_value; 49 u32 ret_value;
50 u32 dma_en;
51 u64 dma_addr;
52 u32 dma_vector;
53 u32 dma_ver;
49} __packed; 54} __packed;
50 55
51enum mrpc_status { 56enum mrpc_status {
@@ -342,6 +347,14 @@ struct pff_csr_regs {
342 347
343struct switchtec_ntb; 348struct switchtec_ntb;
344 349
350struct dma_mrpc_output {
351 u32 status;
352 u32 cmd_id;
353 u32 rtn_code;
354 u32 output_size;
355 u8 data[SWITCHTEC_MRPC_PAYLOAD_SIZE];
356};
357
345struct switchtec_dev { 358struct switchtec_dev {
346 struct pci_dev *pdev; 359 struct pci_dev *pdev;
347 struct device dev; 360 struct device dev;
@@ -381,6 +394,9 @@ struct switchtec_dev {
381 u8 link_event_count[SWITCHTEC_MAX_PFF_CSR]; 394 u8 link_event_count[SWITCHTEC_MAX_PFF_CSR];
382 395
383 struct switchtec_ntb *sndev; 396 struct switchtec_ntb *sndev;
397
398 struct dma_mrpc_output *dma_mrpc;
399 dma_addr_t dma_mrpc_dma_addr;
384}; 400};
385 401
386static inline struct switchtec_dev *to_stdev(struct device *dev) 402static inline struct switchtec_dev *to_stdev(struct device *dev)