Skip to content

Commit 3b80703

Browse files
npigginmpe
authored andcommitted
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: 628daa8 ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks") Depends-on: 34dd25d ("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>
1 parent 34dd25d commit 3b80703

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/powerpc/platforms/powernv/opal-nvram.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#define DEBUG
1313

14+
#include <linux/delay.h>
1415
#include <linux/kernel.h>
1516
#include <linux/init.h>
1617
#include <linux/of.h>
@@ -56,8 +57,12 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
5657

5758
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
5859
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);
6062
opal_poll_events(NULL);
63+
} else if (rc == OPAL_BUSY) {
64+
msleep(OPAL_BUSY_DELAY_MS);
65+
}
6166
}
6267

6368
if (rc)

0 commit comments

Comments
 (0)