diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2018-04-10 07:49:33 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-04-10 21:58:43 -0400 |
commit | 3b8070335f751aac9f1526ae2e012e6f5b8b0f21 (patch) | |
tree | 3fea8750d6881de6cc071e9b4dc43d92cfad7e35 | |
parent | 34dd25de9fe3f60bfdb31b473bf04b28262d0896 (diff) |
powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops
The OPAL NVRAM driver does not sleep in case it gets OPAL_BUSY or
OPAL_BUSY_EVENT from firmware, which causes large scheduling
latencies, and various lockup errors to trigger (again, BMC reboot
can cause it).
Fix this by converting it to the standard form OPAL_BUSY loop that
sleeps.
Fixes: 628daa8d5abf ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks")
Depends-on: 34dd25de9fe3 ("powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops")
Cc: stable@vger.kernel.org # v3.2+
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-nvram.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c index ba2ff06a2c98..1bceb95f422d 100644 --- a/arch/powerpc/platforms/powernv/opal-nvram.c +++ b/arch/powerpc/platforms/powernv/opal-nvram.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #define DEBUG | 12 | #define DEBUG |
13 | 13 | ||
14 | #include <linux/delay.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/of.h> | 17 | #include <linux/of.h> |
@@ -56,8 +57,12 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) | |||
56 | 57 | ||
57 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { | 58 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { |
58 | rc = opal_write_nvram(__pa(buf), count, off); | 59 | rc = opal_write_nvram(__pa(buf), count, off); |
59 | if (rc == OPAL_BUSY_EVENT) | 60 | if (rc == OPAL_BUSY_EVENT) { |
61 | msleep(OPAL_BUSY_DELAY_MS); | ||
60 | opal_poll_events(NULL); | 62 | opal_poll_events(NULL); |
63 | } else if (rc == OPAL_BUSY) { | ||
64 | msleep(OPAL_BUSY_DELAY_MS); | ||
65 | } | ||
61 | } | 66 | } |
62 | 67 | ||
63 | if (rc) | 68 | if (rc) |