[Skiboot] [PATCH v2 1/2] xscom: Do not wait indefinitely for xscom operation to complete

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri May 22 01:49:47 AEST 2020


In some corner cases (specially on P8), xscom_wait_done() won't
complete.. resulting in waiting forever.

This patch retries for predefined time and then exits even if xscom
operation did not complete.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
Oliver,
  Should we keep this specific to P8?

-Vasant

 hw/xscom.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/xscom.c b/hw/xscom.c
index 0eda567fc..eb5c00bca 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -72,10 +72,13 @@ static inline void *xscom_addr(uint32_t gcid, uint32_t pcb_addr)
 static uint64_t xscom_wait_done(void)
 {
 	uint64_t hmer;
+	int retry_cnt = 0;
 
-	do
+	do {
 		hmer = mfspr(SPR_HMER);
-	while(!(hmer & SPR_HMER_XSCOM_DONE));
+		if (retry_cnt++ > 10)
+			break;
+	} while(!(hmer & SPR_HMER_XSCOM_DONE));
 
 	/*
 	 * HW822317: We need to read a second time as the actual
-- 
2.21.1



More information about the Skiboot mailing list