summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0078-Fix-NCSI-driver-issue-caused-by-host-shutdown.patch
blob: c02131b6a57dff94f77e4ccb4019039d6c034aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 3e698a7666ec54582d0e2b4842f3e7f27fabe303 Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Tue, 29 Oct 2019 11:28:29 +0800
Subject: [PATCH] Fix NCSI driver issue caused by host shutdown due to
 overheated.

NCSI device cannot be recovered when host shutdown due to overheated.

Tested:
Heat host till shutdown due to overheated and then
run the ipmi command like power status

Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
 net/ncsi/ncsi-manage.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 755aab66dcab..2c5294582ef6 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -133,18 +133,15 @@ static void ncsi_channel_monitor(struct timer_list *t)
 		netdev_err(ndp->ndev.dev, "NCSI Channel %d timed out!\n",
 			   nc->id);
 		ncsi_report_link(ndp, true);
-		ndp->flags |= NCSI_DEV_RESHUFFLE;
 
 		ncsi_stop_channel_monitor(nc);
 
-		ncm = &nc->modes[NCSI_MODE_LINK];
 		spin_lock_irqsave(&nc->lock, flags);
-		nc->state = NCSI_CHANNEL_INVISIBLE;
-		ncm->data[2] &= ~0x1;
+		nc->state = NCSI_CHANNEL_INACTIVE;
 		spin_unlock_irqrestore(&nc->lock, flags);
 
 		spin_lock_irqsave(&ndp->lock, flags);
-		nc->state = NCSI_CHANNEL_ACTIVE;
+		ndp->flags |= NCSI_DEV_RESHUFFLE | NCSI_DEV_RESET;
 		list_add_tail_rcu(&nc->link, &ndp->channel_queue);
 		spin_unlock_irqrestore(&ndp->lock, flags);
 		ncsi_process_next_channel(ndp);
@@ -425,6 +422,7 @@ static void ncsi_request_timeout(struct timer_list *t)
 {
 	struct ncsi_request *nr = from_timer(nr, t, timer);
 	struct ncsi_dev_priv *ndp = nr->ndp;
+	struct ncsi_dev *nd = &ndp->ndev;
 	struct ncsi_cmd_pkt *cmd;
 	struct ncsi_package *np;
 	struct ncsi_channel *nc;
@@ -439,6 +437,16 @@ static void ncsi_request_timeout(struct timer_list *t)
 		spin_unlock_irqrestore(&ndp->lock, flags);
 		return;
 	}
+	if (nd->state == ncsi_dev_state_suspend ||
+	    nd->state == ncsi_dev_state_suspend_select ||
+	    nd->state == ncsi_dev_state_suspend_gls ||
+	    nd->state == ncsi_dev_state_suspend_dcnt ||
+	    nd->state == ncsi_dev_state_suspend_dc ||
+	    nd->state == ncsi_dev_state_suspend_deselect ||
+	    nd->state == ncsi_dev_state_suspend_done) {
+		ndp->flags |= NCSI_DEV_RESET;
+		nd->state = ncsi_dev_state_suspend_done;
+	}
 	spin_unlock_irqrestore(&ndp->lock, flags);
 
 	if (nr->flags == NCSI_REQ_FLAG_NETLINK_DRIVEN) {
-- 
2.7.4