Skip to content

Commit

Permalink
soundwire: intel_bus_common: prevent peripheral interrupts during bus…
Browse files Browse the repository at this point in the history
… config

There is an potential deadlock on Intel platforms with the following
scenario:

a) the bank switch starts and the msg->lock is taken

b) an interrupt happens and the workqueue schedules a read from
IntStat0 register, which is blocked by the msg->lock

c) the manager writes the bank switch command, which is blocked by the
read that won't go out.

b) is blocked by a) and c) is blocked by b).

This patch suggests disabling the peripheral interrupts temporarily
during sync_arm/sync_go sequences used by the bank switch.

FIXME: What happens if there's already a work scheduled?

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
  • Loading branch information
plbossart committed Jun 11, 2024
1 parent e5e7bff commit 055ed87
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/soundwire/intel_bus_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ int intel_pre_bank_switch(struct sdw_intel *sdw)
if (!bus->multi_link)
return 0;

sdw_cdns_enable_slave_alerts(cdns, false);

sdw_intel_sync_arm(sdw);

return 0;
Expand Down Expand Up @@ -276,5 +278,7 @@ int intel_post_bank_switch(struct sdw_intel *sdw)
if (ret < 0)
dev_err(sdw->cdns.dev, "Post bank switch failed: %d\n", ret);

sdw_cdns_enable_slave_alerts(cdns, true);

return ret;
}

0 comments on commit 055ed87

Please sign in to comment.