]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.34/s390-ism-ignore-some-errors-during-deregistration.patch
Linux 4.14.111
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / s390-ism-ignore-some-errors-during-deregistration.patch
1 From af72594cdb9945a3edfa8909d6685e8c97c8a1be Mon Sep 17 00:00:00 2001
2 From: Sebastian Ott <sebott@linux.ibm.com>
3 Date: Thu, 14 Feb 2019 14:46:23 +0100
4 Subject: s390/ism: ignore some errors during deregistration
5
6 [ Upstream commit 0ff06c44efeede4acd068847d3bf8cf894b6c664 ]
7
8 Prior to dma unmap/free operations the ism driver tries to ensure
9 that the memory is no longer accessed by the HW. When errors
10 during deregistration of memory regions from the HW occur the ism
11 driver will not unmap/free this memory.
12
13 When we receive notification from the hypervisor that a PCI function
14 has been detached we can no longer access the device and would never
15 unmap/free these memory regions which led to complaints by the DMA
16 debug API.
17
18 Treat this kind of errors during the deregistration of memory regions
19 from the HW as success since it is already ensured that the memory
20 is no longer accessed by HW.
21
22 Reported-by: Karsten Graul <kgraul@linux.ibm.com>
23 Reported-by: Hans Wippel <hwippel@linux.ibm.com>
24 Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
25 Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
26 Signed-off-by: Sasha Levin <sashal@kernel.org>
27 ---
28 drivers/s390/net/ism_drv.c | 12 +++++++++---
29 1 file changed, 9 insertions(+), 3 deletions(-)
30
31 diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
32 index 8684bcec8ff4..00cc96341411 100644
33 --- a/drivers/s390/net/ism_drv.c
34 +++ b/drivers/s390/net/ism_drv.c
35 @@ -141,10 +141,13 @@ static int register_ieq(struct ism_dev *ism)
36
37 static int unregister_sba(struct ism_dev *ism)
38 {
39 + int ret;
40 +
41 if (!ism->sba)
42 return 0;
43
44 - if (ism_cmd_simple(ism, ISM_UNREG_SBA))
45 + ret = ism_cmd_simple(ism, ISM_UNREG_SBA);
46 + if (ret && ret != ISM_ERROR)
47 return -EIO;
48
49 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE,
50 @@ -158,10 +161,13 @@ static int unregister_sba(struct ism_dev *ism)
51
52 static int unregister_ieq(struct ism_dev *ism)
53 {
54 + int ret;
55 +
56 if (!ism->ieq)
57 return 0;
58
59 - if (ism_cmd_simple(ism, ISM_UNREG_IEQ))
60 + ret = ism_cmd_simple(ism, ISM_UNREG_IEQ);
61 + if (ret && ret != ISM_ERROR)
62 return -EIO;
63
64 dma_free_coherent(&ism->pdev->dev, PAGE_SIZE,
65 @@ -288,7 +294,7 @@ static int ism_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
66 cmd.request.dmb_tok = dmb->dmb_tok;
67
68 ret = ism_cmd(ism, &cmd);
69 - if (ret)
70 + if (ret && ret != ISM_ERROR)
71 goto out;
72
73 ism_free_dmb(ism, dmb);
74 --
75 2.19.1
76