[Skiboot] [PATCH] p8-i2c: Fix random data corruption
Oliver O'Halloran
oohall at gmail.com
Wed Aug 30 22:36:06 AEST 2017
While waiting for the OCC to signal that it has finished using the I2C
master we put the master into the, poorly named, occache_dis state.
While in this state the transaction hasn't been started, but
p8_i2c_check_status() will only skip it's checks when the master is in
the idle state. Any action that checks that cranks the I2C state machine
(interrupt, poll, etc) will call p8_i2c_check_status() and since the
master is not idle, it will check the status register, see the
transaction complete flag set and complete the i2c request without
actually doing anything.
If the transaction was a I2C read, the resulting output will be a
zeroed data buffer.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
hw/p8-i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index a6274171debb..9cc016fe98a5 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -892,7 +892,7 @@ static void p8_i2c_check_status(struct p8_i2c_master *master)
/* If we are idle, just return, we'll catch error conditions
* when we next try to enqueue a request
*/
- if (master->state == state_idle)
+ if (master->state == state_idle || master->state == state_occache_dis)
return;
/* Read status register */
--
2.9.5
More information about the Skiboot
mailing list