Stewart Smith 5b8b580630 rtc-opal: Fix handling of firmware error codes, prevent busy loops
According to the OPAL docs:
  skiboot-5.2.5/doc/opal-api/opal-rtc-read-3.txt
  skiboot-5.2.5/doc/opal-api/opal-rtc-write-4.txt

OPAL_HARDWARE may be returned from OPAL_RTC_READ or OPAL_RTC_WRITE and
this indicates either a transient or permanent error.

Prior to this patch, Linux was not dealing with OPAL_HARDWARE being a
permanent error particularly well, in that you could end up in a busy
loop.

This was not too hard to trigger on an AMI BMC based OpenPOWER machine
doing a continuous "ipmitool mc reset cold" to the BMC, the result of
that being that we'd get stuck in an infinite loop in
opal_get_rtc_time().

We now retry a few times before returning the error higher up the
stack.

Fixes: 16b1d26e77b1 ("rtc/tpo: Driver to support rtc and wakeup on PowerNV platform")
Cc: stable@vger.kernel.org # v3.19+
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2018-01-27 21:15:59 +11:00
..
2017-11-22 20:58:23 -10:00
2017-07-07 13:14:14 +02:00
2017-10-13 00:10:12 +02:00
2017-03-09 01:29:17 +01:00
2016-05-20 12:33:51 +02:00
2017-10-13 00:10:06 +02:00
2017-10-13 00:10:17 +02:00
2016-05-20 12:33:51 +02:00
2017-09-01 01:10:11 +02:00
2016-05-20 12:33:51 +02:00
2017-09-01 01:10:11 +02:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2015-09-05 13:19:06 +02:00
2016-05-20 12:33:51 +02:00
2017-10-13 00:10:10 +02:00
2017-09-01 01:10:11 +02:00
2017-01-11 17:23:04 +01:00
2017-08-22 12:05:21 +02:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2017-09-05 09:55:02 +02:00
2017-07-07 13:14:19 +02:00
2013-04-19 13:51:25 +02:00
2017-07-31 00:17:44 +02:00
2017-08-24 11:03:35 +02:00
2017-04-22 18:01:15 +02:00
2016-05-20 12:33:51 +02:00
2017-08-24 11:03:36 +02:00
2016-05-20 12:33:51 +02:00