Skip to content

Commit 4e40642

Browse files
jhnikulaalexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Fix race between bus cleanup and interrupt
If there is a transfer error during i3c_master_bus_init() and code goes doing the bus cleanup in i3c_hci_bus_cleanup() there is possibility that i3c_hci_irq_handler() is running in parallel with hci->io->cleanup() which can be racy. Prevent this by waiting there is no pending interrupt on other CPU before doing the IO cleanup. This was observed with ring headers where first transfer failed and sometimes transfer error or ring transfer abort interrupt was coming simultaneously with the bus cleanup path. Signed-off-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent e141db8 commit 4e40642

File tree

1 file changed

+2
-0
lines changed
  • drivers/i3c/master/mipi-i3c-hci

1 file changed

+2
-0
lines changed

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,12 @@ static int i3c_hci_bus_init(struct i3c_master_controller *m)
161161
static void i3c_hci_bus_cleanup(struct i3c_master_controller *m)
162162
{
163163
struct i3c_hci *hci = to_i3c_hci(m);
164+
struct platform_device *pdev = to_platform_device(m->dev.parent);
164165

165166
DBG("");
166167

167168
reg_clear(HC_CONTROL, HC_CONTROL_BUS_ENABLE);
169+
synchronize_irq(platform_get_irq(pdev, 0));
168170
hci->io->cleanup(hci);
169171
if (hci->cmd == &mipi_i3c_hci_cmd_v1)
170172
mipi_i3c_hci_dat_v1.cleanup(hci);

0 commit comments

Comments
 (0)