History

Merge branch 'pci/switchtec'

- Support all 255 PFF ports in switchtec driver (Wesley Sheng) - Fix unintentional switchtec MRPC event masking that degraded firmware update speed (Wesley Sheng) * pci/switchtec: switchtec: Fix unintended mask of MRPC event switchtec: Increase PFF limit from 48 to 255

Bjorn Helgaas committed 7 years ago

Commit da33ae02 parents db9d639 083c1b53 files · +42 −15Browse files

Unified · Split

3 files
  1. drivers/pci/switch/switchtec.c +29 −13
  2. include/linux/switchtec.h +1 −1
  3. include/uapi/linux/switchtec_ioctl.h +12 −1
drivers/pci/switch/switchtec.c+29−13
@@ -658,19 +658,25 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev, · 657 unmodified lines
658 658
659static int ioctl_event_summary(struct switchtec_dev *stdev,659static int ioctl_event_summary(struct switchtec_dev *stdev,
660 struct switchtec_user *stuser,660 struct switchtec_user *stuser,
661 struct switchtec_ioctl_event_summary __user *usum)661 struct switchtec_ioctl_event_summary __user *usum,
662 size_t size)
662{663{
663 struct switchtec_ioctl_event_summary s = {0};664 struct switchtec_ioctl_event_summary *s;
664 int i;665 int i;
665 u32 reg;666 u32 reg;
667 int ret = 0;
666 668
667 s.global = ioread32(&stdev->mmio_sw_event->global_summary);669 s = kzalloc(sizeof(*s), GFP_KERNEL);
668 s.part_bitmap = ioread32(&stdev->mmio_sw_event->part_event_bitmap);670 if (!s)
669 s.local_part = ioread32(&stdev->mmio_part_cfg->part_event_summary);671 return -ENOMEM;
672
673 s->global = ioread32(&stdev->mmio_sw_event->global_summary);
674 s->part_bitmap = ioread32(&stdev->mmio_sw_event->part_event_bitmap);
675 s->local_part = ioread32(&stdev->mmio_part_cfg->part_event_summary);
670 676
671 for (i = 0; i < stdev->partition_count; i++) {677 for (i = 0; i < stdev->partition_count; i++) {
672 reg = ioread32(&stdev->mmio_part_cfg_all[i].part_event_summary);678 reg = ioread32(&stdev->mmio_part_cfg_all[i].part_event_summary);
673 s.part[i] = reg;679 s->part[i] = reg;
674 }680 }
675 681
676 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {682 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
@@ -679,15 +685,19 @@ static int ioctl_event_summary(struct switchtec_dev *stdev, · 2 unmodified lines
679 break;685 break;
680 686
681 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary);687 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary);
682 s.pff[i] = reg;688 s->pff[i] = reg;
683 }689 }
684 690
685 if (copy_to_user(usum, &s, sizeof(s)))691 if (copy_to_user(usum, s, size)) {
686 return -EFAULT;692 ret = -EFAULT;
693 goto error_case;
694 }
687 695
688 stuser->event_cnt = atomic_read(&stdev->event_cnt);696 stuser->event_cnt = atomic_read(&stdev->event_cnt);
689 697
690 return 0;698error_case:
699 kfree(s);
700 return ret;
691}701}
692 702
693static u32 __iomem *global_ev_reg(struct switchtec_dev *stdev,703static u32 __iomem *global_ev_reg(struct switchtec_dev *stdev,
@@ -977,8 +987,9 @@ static long switchtec_dev_ioctl(struct file *filp, unsigned int cmd, · 283 unmodified lines
977 case SWITCHTEC_IOCTL_FLASH_PART_INFO:987 case SWITCHTEC_IOCTL_FLASH_PART_INFO:
978 rc = ioctl_flash_part_info(stdev, argp);988 rc = ioctl_flash_part_info(stdev, argp);
979 break;989 break;
980 case SWITCHTEC_IOCTL_EVENT_SUMMARY:990 case SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY:
981 rc = ioctl_event_summary(stdev, stuser, argp);991 rc = ioctl_event_summary(stdev, stuser, argp,
992 sizeof(struct switchtec_ioctl_event_summary_legacy));
982 break;993 break;
983 case SWITCHTEC_IOCTL_EVENT_CTL:994 case SWITCHTEC_IOCTL_EVENT_CTL:
984 rc = ioctl_event_ctl(stdev, argp);995 rc = ioctl_event_ctl(stdev, argp);
@@ -989,6 +1000,10 @@ static long switchtec_dev_ioctl(struct file *filp, unsigned int cmd, · 4 unmodified lines
989 case SWITCHTEC_IOCTL_PORT_TO_PFF:1000 case SWITCHTEC_IOCTL_PORT_TO_PFF:
990 rc = ioctl_port_to_pff(stdev, argp);1001 rc = ioctl_port_to_pff(stdev, argp);
991 break;1002 break;
1003 case SWITCHTEC_IOCTL_EVENT_SUMMARY:
1004 rc = ioctl_event_summary(stdev, stuser, argp,
1005 sizeof(struct switchtec_ioctl_event_summary));
1006 break;
992 default:1007 default:
993 rc = -ENOTTY;1008 rc = -ENOTTY;
994 break;1009 break;
@@ -1162,7 +1177,8 @@ static int mask_event(struct switchtec_dev *stdev, int eid, int idx) · 167 unmodified lines
1162 if (!(hdr & SWITCHTEC_EVENT_OCCURRED && hdr & SWITCHTEC_EVENT_EN_IRQ))1177 if (!(hdr & SWITCHTEC_EVENT_OCCURRED && hdr & SWITCHTEC_EVENT_EN_IRQ))
1163 return 0;1178 return 0;
1164 1179
1165 if (eid == SWITCHTEC_IOCTL_EVENT_LINK_STATE)1180 if (eid == SWITCHTEC_IOCTL_EVENT_LINK_STATE ||
1181 eid == SWITCHTEC_IOCTL_EVENT_MRPC_COMP)
1166 return 0;1182 return 0;
1167 1183
1168 dev_dbg(&stdev->dev, "%s: %d %d %x\n", __func__, eid, idx, hdr);1184 dev_dbg(&stdev->dev, "%s: %d %d %x\n", __func__, eid, idx, hdr);
include/linux/switchtec.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20#include <linux/cdev.h>20#include <linux/cdev.h>
21 21
22#define SWITCHTEC_MRPC_PAYLOAD_SIZE 102422#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024
23#define SWITCHTEC_MAX_PFF_CSR 4823#define SWITCHTEC_MAX_PFF_CSR 255
24 24
25#define SWITCHTEC_EVENT_OCCURRED BIT(0)25#define SWITCHTEC_EVENT_OCCURRED BIT(0)
26#define SWITCHTEC_EVENT_CLEAR BIT(0)26#define SWITCHTEC_EVENT_CLEAR BIT(0)
include/uapi/linux/switchtec_ioctl.h+12−1
@@ -50,7 +50,7 @@ struct switchtec_ioctl_flash_part_info { · 49 unmodified lines
50 __u32 active;50 __u32 active;
51};51};
52 52
53struct switchtec_ioctl_event_summary {53struct switchtec_ioctl_event_summary_legacy {
54 __u64 global;54 __u64 global;
55 __u64 part_bitmap;55 __u64 part_bitmap;
56 __u32 local_part;56 __u32 local_part;
@@ -59,6 +59,15 @@ struct switchtec_ioctl_event_summary { · 2 unmodified lines
59 __u32 pff[48];59 __u32 pff[48];
60};60};
61 61
62struct switchtec_ioctl_event_summary {
63 __u64 global;
64 __u64 part_bitmap;
65 __u32 local_part;
66 __u32 padding;
67 __u32 part[48];
68 __u32 pff[255];
69};
70
62#define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 071#define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0
63#define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 172#define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1
64#define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 273#define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2
@@ -127,6 +136,8 @@ struct switchtec_ioctl_pff_port { · 62 unmodified lines
127 _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info)136 _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info)
128#define SWITCHTEC_IOCTL_EVENT_SUMMARY \137#define SWITCHTEC_IOCTL_EVENT_SUMMARY \
129 _IOR('W', 0x42, struct switchtec_ioctl_event_summary)138 _IOR('W', 0x42, struct switchtec_ioctl_event_summary)
139#define SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY \
140 _IOR('W', 0x42, struct switchtec_ioctl_event_summary_legacy)
130#define SWITCHTEC_IOCTL_EVENT_CTL \141#define SWITCHTEC_IOCTL_EVENT_CTL \
131 _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl)142 _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl)
132#define SWITCHTEC_IOCTL_PFF_TO_PORT \143#define SWITCHTEC_IOCTL_PFF_TO_PORT \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t