[Skiboot] [PATCH] p8-i2c: fix wrong request status when a reset is needed

Frederic Barrat fbarrat at linux.ibm.com
Thu Jun 7 01:37:54 AEST 2018

If the bus is found in error state when starting a new request, the
engine is reset and we enter recovery. However, once complete, the
reset operation shows a status of complete in the status register. So
any badly-timed called to check_status() will think the current top
request is complete, even though it hasn't run yet.

So don't update any request status while we are in recovery, as
nothing useful for the request is supposed to happen in that state.

Signed-off-by: Frederic Barrat <fbarrat at linux.ibm.com>
 hw/p8-i2c.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 1bcd7cc8..23d54a04 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -826,10 +826,13 @@ static void p8_i2c_check_status(struct p8_i2c_master *master)
 	 * When idle or waiting for the occ to release the bus there's
-	 * nothing to check. Error states are handled when starting
-	 * a new request.
+	 * nothing to check. Also ignore recovery state, as the bus
+	 * can be reset in that state, and a request can think it's
+	 * complete when it just means the reset is complete.
+	 * Error states are handled when starting a new request.
-	if (master->state == state_idle || master->state == state_occache_dis)
+	if (master->state == state_idle || master->state == state_occache_dis ||
+		master->state == state_recovery)
 	/* A non-idle master should always have a pending request */

More information about the Skiboot mailing list