[Skiboot] [PATCH] fsp/fsp-rtc: Correctly report back errors to host

Stewart Smith stewart at linux.vnet.ibm.com
Tue Nov 17 19:04:08 AEDT 2015


When we got FSP_STATUS_TOD_RESET or similar, we would return OPAL_BUSY
which would cause the Linux OPAL RTC driver to retry in a loop until
we didn't say we're busy.

The problem with this is that some errors, such as FSP_STATUS_TOD_RESET
are, in fact, permanent until we (say) set the time explicitly, so no
matter how hard that little linux driver tries, it's never going to
break out of that loop.

This fix is to fix our use of the state machine introduced way back in
6cf8b663e7d7cb1e827b6d9c90e694ea583f6f87 so that we return an error code
to linux.

Reported-by: Cédric Le Goater <clg at fr.ibm.com>
Fixes: 6cf8b663e7d7cb1e827b6d9c90e694ea583f6f87
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hw/fsp/fsp-rtc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/hw/fsp/fsp-rtc.c b/hw/fsp/fsp-rtc.c
index 6b982179d542..df0f67940372 100644
--- a/hw/fsp/fsp-rtc.c
+++ b/hw/fsp/fsp-rtc.c
@@ -173,19 +173,16 @@ static void fsp_rtc_process_read(struct fsp_msg *read_resp)
 		log_simple_error(&e_info(OPAL_RC_RTC_TOD),
 				"RTC TOD in invalid state\n");
 		rtc_tod_state = RTC_TOD_INVALID;
-		rtc_read_request_state = RTC_READ_NO_REQUEST;
 		break;
 
 	case FSP_STATUS_TOD_PERMANENT_ERROR:
 		log_simple_error(&e_info(OPAL_RC_RTC_TOD),
 			"RTC TOD in permanent error state\n");
 		rtc_tod_state = RTC_TOD_PERMANENT_ERROR;
-		rtc_read_request_state = RTC_READ_NO_REQUEST;
 		break;
 
 	case FSP_STATUS_SUCCESS:
 		/* Save the read RTC value in our cache */
-		rtc_read_request_state = RTC_READ_REQUEST_AVAILABLE;
 		rtc_tod_state = RTC_TOD_VALID;
 		datetime_to_tm(read_resp->data.words[0],
 			       (u64) read_resp->data.words[1] << 32, &tm);
@@ -199,8 +196,8 @@ static void fsp_rtc_process_read(struct fsp_msg *read_resp)
 		log_simple_error(&e_info(OPAL_RC_RTC_TOD),
 				"RTC TOD read failed: %d\n", val);
 		rtc_tod_state = RTC_TOD_INVALID;
-		rtc_read_request_state = RTC_READ_NO_REQUEST;
 	}
+	rtc_read_request_state = RTC_READ_REQUEST_AVAILABLE;
 }
 
 static void opal_rtc_eval_events(bool read_write)
-- 
2.1.4



More information about the Skiboot mailing list