Skip to content

Commit 8f025c2

Browse files
committed
Merge branch 'master' to backport_4.4_to_4.7
2 parents b1857ae + aa24b97 commit 8f025c2

File tree

4 files changed

+165
-19
lines changed

4 files changed

+165
-19
lines changed

linux/switchtec.h

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define SWITCHTEC_EVENT_EN_IRQ BIT(3)
3434
#define SWITCHTEC_EVENT_FATAL BIT(4)
3535

36+
#define SWITCHTEC_DMA_MRPC_EN BIT(0)
3637
enum {
3738
SWITCHTEC_GAS_MRPC_OFFSET = 0x0000,
3839
SWITCHTEC_GAS_TOP_CFG_OFFSET = 0x1000,
@@ -50,6 +51,10 @@ struct mrpc_regs {
5051
u32 cmd;
5152
u32 status;
5253
u32 ret_value;
54+
u32 dma_en;
55+
u64 dma_addr;
56+
u32 dma_vector;
57+
u32 dma_ver;
5358
} __packed;
5459

5560
enum mrpc_status {
@@ -59,6 +64,12 @@ enum mrpc_status {
5964
SWITCHTEC_MRPC_STATUS_INTERRUPTED = 0x100,
6065
};
6166

67+
struct event {
68+
uint32_t hdr;
69+
uint32_t data[5];
70+
};
71+
72+
6273
struct sw_event_regs {
6374
u64 event_report_ctrl;
6475
u64 reserved1;
@@ -100,9 +111,12 @@ struct sw_event_regs {
100111
u32 gpio_interrupt_hdr;
101112
u32 gpio_interrupt_data;
102113
u32 reserved16[4];
103-
u32 gfms_event_hdr;
114+
u32 gfms_event_hdr; //Event specific for PAX
104115
u32 gfms_event_data;
105116
u32 reserved17[4];
117+
uint32_t reserved18[60];
118+
struct event customer_events[6];
119+
uint32_t reserved19[320];
106120
} __packed;
107121

108122
enum {
@@ -204,7 +218,11 @@ struct part_cfg_regs {
204218
u32 mrpc_comp_async_data[5];
205219
u32 dyn_binding_hdr;
206220
u32 dyn_binding_data[5];
207-
u32 reserved4[159];
221+
u32 intercomm_notify_hdr;
222+
u32 intercomm_notify_data[5];
223+
uint32_t reserved4[114];
224+
struct event customer_events[6];
225+
uint32_t reserved5[3];
208226
} __packed;
209227

210228
enum {
@@ -247,7 +265,11 @@ struct ntb_ctrl_regs {
247265
u32 win_size;
248266
u64 xlate_addr;
249267
} bar_entry[6];
250-
u32 reserved2[216];
268+
struct {
269+
u32 win_size;
270+
u32 reserved[3];
271+
} bar_ext_entry[6];
272+
u32 reserved2[192];
251273
u32 req_id_table[256];
252274
u32 reserved3[512];
253275
u64 lut_entry[512];
@@ -341,17 +363,28 @@ struct pff_csr_regs {
341363
u32 credit_timeout_data[5];
342364
u32 link_state_hdr;
343365
u32 link_state_data[5];
344-
u32 reserved4[174];
366+
uint32_t reserved4[66];
367+
struct event customer_events[6];
368+
uint32_t reserved5[72];
345369
} __packed;
346370

347371
struct switchtec_ntb;
348372

373+
struct dma_mrpc_output{
374+
u32 status;
375+
u32 cmd_id;
376+
u32 rtn_code;
377+
u32 output_size;
378+
u8 data[SWITCHTEC_MRPC_PAYLOAD_SIZE];
379+
};
380+
349381
struct switchtec_dev {
350382
struct pci_dev *pdev;
351383
struct msix_entry msix[4];
352384
struct device dev;
353385
struct cdev cdev;
354386
unsigned int event_irq;
387+
unsigned int dma_mrpc_irq;
355388

356389
int partition;
357390
int partition_count;
@@ -387,6 +420,9 @@ struct switchtec_dev {
387420
u8 link_event_count[SWITCHTEC_MAX_PFF_CSR];
388421

389422
struct switchtec_ntb *sndev;
423+
424+
struct dma_mrpc_output *dma_mrpc;
425+
dma_addr_t dma_mrpc_dma_addr;
390426
};
391427

392428
static inline struct switchtec_dev *to_stdev(struct device *dev)

linux/switchtec_ioctl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ struct switchtec_ioctl_event_summary {
8989
#define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27
9090
#define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28
9191
#define SWITCHTEC_IOCTL_EVENT_GFMS 29
92-
#define SWITCHTEC_IOCTL_MAX_EVENTS 30
92+
#define SWITCHTEC_IOCTL_EVENT_INTERCOMM_REQ_NOTIFY 30
93+
#define SWITCHTEC_IOCTL_MAX_EVENTS 31
9394

9495
#define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1
9596
#define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2

ntb_hw_switchtec.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ static void switchtec_ntb_mw_clr_direct(struct switchtec_ntb *sndev, int idx)
320320
ctl_val &= ~NTB_CTRL_BAR_DIR_WIN_EN;
321321
iowrite32(ctl_val, &ctl->bar_entry[bar].ctl);
322322
iowrite32(0, &ctl->bar_entry[bar].win_size);
323+
iowrite32(0, &ctl->bar_ext_entry[bar].win_size);
323324
iowrite64(sndev->self_partition, &ctl->bar_entry[bar].xlate_addr);
324325
}
325326

@@ -342,7 +343,9 @@ static void switchtec_ntb_mw_set_direct(struct switchtec_ntb *sndev, int idx,
342343
ctl_val |= NTB_CTRL_BAR_DIR_WIN_EN;
343344

344345
iowrite32(ctl_val, &ctl->bar_entry[bar].ctl);
345-
iowrite32(xlate_pos | size, &ctl->bar_entry[bar].win_size);
346+
iowrite32(xlate_pos | (size & 0xFFFFF000),
347+
&ctl->bar_entry[bar].win_size);
348+
iowrite32(size >> 32, &ctl->bar_ext_entry[bar].win_size);
346349
iowrite64(sndev->self_partition | addr,
347350
&ctl->bar_entry[bar].xlate_addr);
348351
}
@@ -1018,7 +1021,9 @@ static int crosslink_setup_mws(struct switchtec_ntb *sndev, int ntb_lut_idx,
10181021
ctl_val |= NTB_CTRL_BAR_DIR_WIN_EN;
10191022

10201023
iowrite32(ctl_val, &ctl->bar_entry[bar].ctl);
1021-
iowrite32(xlate_pos | size, &ctl->bar_entry[bar].win_size);
1024+
iowrite32(xlate_pos | (size & 0xFFFFF000),
1025+
&ctl->bar_entry[bar].win_size);
1026+
iowrite32(size >> 32, &ctl->bar_ext_entry[bar].win_size);
10221027
iowrite64(sndev->peer_partition | addr,
10231028
&ctl->bar_entry[bar].xlate_addr);
10241029
}
@@ -1085,7 +1090,7 @@ static int crosslink_enum_partition(struct switchtec_ntb *sndev,
10851090

10861091
dev_dbg(&sndev->stdev->dev,
10871092
"Crosslink BAR%d addr: %llx\n",
1088-
i, bar_addr);
1093+
i*2, bar_addr);
10891094

10901095
if (bar_addr != bar_space * i)
10911096
continue;

0 commit comments

Comments
 (0)