Message ID | 20170516072037.12846-1-oohall@gmail.com |
---|---|
State | Accepted |
Headers | show |
Oliver O'Halloran <oohall@gmail.com> writes: > When interacting with an I2C master the p8-i2c driver (common to p9) > aquires a per-master lock which it holds for the duration of it's > interaction with the master. Unfortunately, when > p8_i2c_check_initial_status() detects that the master is busy with > another transaction it drops the lock and returns OPAL_BUSY. This is > contrary to the driver's locking strategy which requires that the > caller aquire and drop the lock. This leads to a crash due to the > double unlock(), which skiboot treats as fatal. > > Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Thanks. I'm guessing this is common to p8 and 5.4.x too and we should probably fix it there (even though I don't think anybody has reported observing it there)? Merged to master as of bb192fd55ffb20d619101c5e3e1f4fd24f844d11
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c index 3bce0b162832..fefc1d4b250b 100644 --- a/hw/p8-i2c.c +++ b/hw/p8-i2c.c @@ -990,7 +990,6 @@ static int p8_i2c_check_initial_status(struct p8_i2c_master_port *port) /* Delay 5ms for bus to settle */ schedule_timer(&master->recovery, msecs_to_tb(5)); - unlock(&master->lock); return OPAL_BUSY; } @@ -1010,7 +1009,6 @@ static int p8_i2c_check_initial_status(struct p8_i2c_master_port *port) /* Delay 5ms for bus to settle */ schedule_timer(&master->recovery, msecs_to_tb(5)); - unlock(&master->lock); return OPAL_BUSY; }
When interacting with an I2C master the p8-i2c driver (common to p9) aquires a per-master lock which it holds for the duration of it's interaction with the master. Unfortunately, when p8_i2c_check_initial_status() detects that the master is busy with another transaction it drops the lock and returns OPAL_BUSY. This is contrary to the driver's locking strategy which requires that the caller aquire and drop the lock. This leads to a crash due to the double unlock(), which skiboot treats as fatal. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> --- hw/p8-i2c.c | 2 -- 1 file changed, 2 deletions(-)