]> git.baikalelectronics.ru Git - kernel.git/commit
rtc-opal: Fix handling of firmware error codes, prevent busy loops
authorStewart Smith <stewart@linux.vnet.ibm.com>
Tue, 2 Aug 2016 01:50:16 +0000 (11:50 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 27 Jan 2018 10:15:59 +0000 (21:15 +1100)
commit3e773f52d52c4447e7ad5bbd6313a91bba9861eb
tree1e253d31ee131d57812aa4c6df385b5248fea2ad
parent4eb8f7cb3fde87fbe80e840ba4360396a9f46098
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: 8f78569a49b0 ("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>
drivers/rtc/rtc-opal.c