[PATCH v2 0/6] i2c: xiic: Fix broken locking

Marek Vasut
2021-08-23T21:42:20Z

Booting ZynqMP with XIIC I2C driver shows multitude of race conditions
in the XIIC driver. This is because locking is completely missing from
the driver, and there are odd corner cases where the hardware behaves
strangely.

Most of these races could be triggered easily when booting on SMP
machines, like the ZynqMP which has up to 4 cores. It is sufficient
for the interrupt handler to run on another core than xiic_start_xfer
and the driver fails completely.

This does not add support for long transfers, this only fixes the
driver to be usable at all instead of being completely broken.

The V2 fixes a few remaining details which cropped up in deployment
over the last year or so, so I believe the result should be reasonably
well tested.

Marek Vasut (6):
i2c: xiic: Fix broken locking on tx_msg
i2c: xiic: Drop broken interrupt handler
i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in
xiic_process()
i2c: xiic: Switch from waitqueue to completion
i2c: xiic: Only ever transfer single message
i2c: xiic: Fix RX IRQ busy check

drivers/i2c/busses/i2c-xiic.c | 161 +++++++++++++++-------------------
1 file changed, 69 insertions(+), 92 deletions(-)