]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/switchtec-fix-unintended-mask-of-mrpc-event.patch
Linux 4.19.51
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / switchtec-fix-unintended-mask-of-mrpc-event.patch
1 From a570d8508f0185f83c40a03cdc23b2a12baecd97 Mon Sep 17 00:00:00 2001
2 From: Wesley Sheng <wesley.sheng@microchip.com>
3 Date: Mon, 15 Apr 2019 22:41:42 +0800
4 Subject: switchtec: Fix unintended mask of MRPC event
5
6 [ Upstream commit 083c1b5e50b701899dc32445efa8b153685260d5 ]
7
8 When running application tool switchtec-user's `firmware update` and `event
9 wait` commands concurrently, sometimes the firmware update speed reduced
10 significantly.
11
12 It is because when the MRPC event happened after MRPC event occurrence
13 check but before the event mask loop reaches its header register in event
14 ISR, the MRPC event would be masked unintentionally. Since there's no
15 chance to enable it again except for a module reload, all the following
16 MRPC execution completion checks time out.
17
18 Fix this bug by skipping the mask operation for MRPC event in event ISR,
19 same as what we already do for LINK event.
20
21 Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
22 Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
23 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
24 Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
25 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 ---
27 drivers/pci/switch/switchtec.c | 3 ++-
28 1 file changed, 2 insertions(+), 1 deletion(-)
29
30 diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
31 index 37d0c15c9eeb..72db2e0ebced 100644
32 --- a/drivers/pci/switch/switchtec.c
33 +++ b/drivers/pci/switch/switchtec.c
34 @@ -1116,7 +1116,8 @@ static int mask_event(struct switchtec_dev *stdev, int eid, int idx)
35 if (!(hdr & SWITCHTEC_EVENT_OCCURRED && hdr & SWITCHTEC_EVENT_EN_IRQ))
36 return 0;
37
38 - if (eid == SWITCHTEC_IOCTL_EVENT_LINK_STATE)
39 + if (eid == SWITCHTEC_IOCTL_EVENT_LINK_STATE ||
40 + eid == SWITCHTEC_IOCTL_EVENT_MRPC_COMP)
41 return 0;
42
43 dev_dbg(&stdev->dev, "%s: %d %d %x\n", __func__, eid, idx, hdr);
44 --
45 2.20.1
46