Skip to content

Commit

Permalink
p8-i2c: fix wrong request status when a reset is needed
Browse files Browse the repository at this point in the history
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@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
fbarrat authored and stewartsmith committed Jun 19, 2018
1 parent 56026a1 commit c2ce576
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hw/p8-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
return;

/* A non-idle master should always have a pending request */
Expand Down

0 comments on commit c2ce576

Please sign in to comment.