linux-stable/drivers/soundwire
Pierre-Louis Bossart 7cfd350db9 soundwire: intel: don't save hw_params for use in prepare
[ Upstream commit 0a0d1740bd ]

The existing code copies the hw_params pointer and reuses it later in
.prepare, specifically to re-initialize the ALH DMA channel
information that's lost in suspend-resume cycles.

This is not needed, we can directly access the information from the
substream/rtd - as done for the HDAudio DAIs in
sound/soc/sof/intel/hda-dai.c

In addition, using the saved pointer causes the suspend-resume test
cases to fail on specific platforms, depending on which version of GCC
is used. Péter Ujfalusi and I have spent long hours to root-cause this
problem that was reported by the Intel CI first with 6.2-rc1 and again
v6.3-rc1. In the latter case we were lucky that the problem was 100%
reproducible on local test devices, and found out that adding a
dev_dbg() or adding a call to usleep_range() just before accessing the
saved pointer "fixed" the issue. With errors appearing just by
changing the compiler version or minor changes in the code generated,
clearly we have a memory management Heisenbug.

The root-cause seems to be that the hw_params pointer is not
persistent. The soc-pcm code allocates the hw_params structure on the
stack, and passes it to the BE dailink hw_params and DAIs
hw_params. Saving such a pointer and reusing it later during the
.prepare stage cannot possibly work reliably, it's broken-by-design
since v5.10. It's astonishing that the problem was not seen earlier.

This simple fix will have to be back-ported to -stable, due to changes
to avoid the use of the get/set_dmadata routines this patch will only
apply on kernels older than v6.1.

Fixes: a5a0239c27 ("soundwire: intel: reinitialize IP+DSP in .prepare(), but only when resuming")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230321022642.1426611-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:11:31 +09:00
..
Kconfig soundwire: intel: move to auxiliary bus 2021-06-14 10:12:26 +05:30
Makefile soundwire: intel: split auxdevice to different file 2022-11-23 20:11:49 +05:30
bus.c soundwire updates for 6.1-rc1 2022-10-07 16:13:55 -07:00
bus.h soundwire: export sdw_update() and sdw_update_no_pm() 2021-06-21 13:00:42 +01:00
bus_type.c soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe() 2023-03-11 13:50:41 +01:00
cadence_master.c soundwire: cadence: Drain the RX FIFO after an IO timeout 2023-03-11 13:50:46 +01:00
cadence_master.h soundwire: intel: don't save hw_params for use in prepare 2023-05-11 23:11:31 +09:00
debugfs.c soundwire: debugfs: use controller id and link_id for debugfs 2021-10-01 09:53:47 +05:30
dmi-quirks.c soundwire: dmi-quirks: add quirk variant for LAPBC710 NUC15 2022-10-19 18:12:39 +05:30
generic_bandwidth_allocation.c soundwire: bandwidth allocation: improve error messages 2021-05-11 17:34:07 +05:30
intel.c soundwire: intel: don't save hw_params for use in prepare 2023-05-11 23:11:31 +09:00
intel.h soundwire: intel: split auxdevice to different file 2022-11-23 20:11:49 +05:30
intel_auxdevice.c soundwire: intel: split auxdevice to different file 2022-11-23 20:11:49 +05:30
intel_auxdevice.h soundwire: intel: split auxdevice to different file 2022-11-23 20:11:49 +05:30
intel_init.c soundwire updates for 6.2 2022-12-19 08:47:33 -06:00
master.c soundwire: master: use pm_runtime_set_active() on add 2020-12-02 12:49:34 +05:30
mipi_disco.c
qcom.c soundwire: qcom: correct setting ignore bit on v1.5.1 2023-05-11 23:10:51 +09:00
slave.c Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
stream.c soundwire: revisit driver bind/unbind and callbacks 2022-07-06 12:34:21 +05:30
sysfs_local.h soundwire: sysfs: add slave status and device number before probe 2020-09-28 11:17:43 +05:30
sysfs_slave.c soundwire: sysfs: Constify static struct attribute_group 2021-01-19 20:21:20 +05:30
sysfs_slave_dpn.c soundwire: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute 2020-11-24 14:08:51 +05:30