FAILED: patch "[PATCH] ASoC: SOF: ipc4-topology: Refresh copier IPC payload before" failed to apply to 7.1-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 7.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.1.y
git checkout FETCH_HEAD
git cherry-pick -x 0c0e418dbcf0582bf80d8dbfd9b306607c065992
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026082016-frisk-riches-3e59@gregkh' --subject-prefix 'PATCH 7.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0c0e418dbcf0582bf80d8dbfd9b306607c065992 Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <[email protected]>
Date: Thu, 30 Jul 2026 08:48:22 +0300
Subject: [PATCH] ASoC: SOF: ipc4-topology: Refresh copier IPC payload before
widget setup
The ipc_config_data buffer for copier widgets is built once during ipc_prepare (called from sof_pcm_setup_connected_widgets) and cached for reuse. For host copiers this buffer contains the copier_data with gtw_cfg.node_id (host DMA ID). For DAI copiers it additionally includes a dma_config_tlv trailer with stream_id and dma_channel_id for HDA link DMA.
On suspend/resume, both host and link DMA streams are released and re-allocated with potentially different stream tags. The underlying copier_data and dma_config_tlv structures are correctly updated by host_config and sdw_hda_dai_hw_params respectively. However, since the widget list (spcm->stream[].list) persists across suspend, sof_pcm_hw_params skips sof_pcm_setup_connected_widgets and ipc_prepare never runs again to rebuild ipc_config_data. The stale cached payload is then sent to firmware with boot-time DMA channel assignments, causing DMA channel conflicts that lead to firmware errors and crashes.
Fix this by refreshing copier_data and dma_config_tlv portions of ipc_config_data in sof_ipc4_widget_setup right before the IPC message is sent. This ensures the payload always reflects the current DMA state regardless of whether ipc_prepare ran.
For DAI copiers, the gtw_cfg.config_length in copier_data is temporarily inflated to include the TLV size (matching the ipc_config_data layout) before copying, then restored, mirroring what sof_ipc4_prepare_copier_module does when first building the buffer.
sound/soc/sof/ipc4-topology.c +33 -0
@@ -3204,6 +3204,15 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data in ipc_config_data for host copiers. +* The node_id may have been updated by host_config after +* ipc_prepare, e.g. when host stream tags change after a +* suspend/resume cycle. +*/ +if (swidget->id != snd_soc_dapm_buffer) +memcpy (ipc_data, &ipc4_copier->data,sizeof (ipc4_copier->data)); + msg = &ipc4_copier->msg;break ; }
@@ -3212,6 +3221,9 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget {struct snd_sof_dai *dai = swidget->private;struct sof_ipc4_copier *ipc4_copier = dai->private; +struct sof_ipc4_copier_data *copier_data; +u32 gtw_cfg_config_length; +u32 tlv_size; pipeline = pipe_widget->private;if (pipeline->use_chain_dma)
@@ -3220,6 +3232,27 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data and dma_config_tlv in ipc_config_data. +* These may have been updated after ipc_prepare, e.g. when +* link DMA stream tags change after a suspend/resume cycle. +* +* copier_data->gtw_cfg.config_length does not include the +* TLV size (it was restored after sof_ipc4_prepare_copier_module), +* so temporarily inflate it to match the ipc_config_data layout. +*/ + copier_data = &ipc4_copier->data; + gtw_cfg_config_length = copier_data->gtw_cfg.config_length *4 ; + tlv_size = ipc_size -sizeof (*copier_data) - gtw_cfg_config_length; + + copier_data->gtw_cfg.config_length += tlv_size /4 ; +memcpy (ipc_data, copier_data,sizeof (*copier_data)); + copier_data->gtw_cfg.config_length = gtw_cfg_config_length /4 ; + +if (tlv_size) +memcpy (ipc_data +sizeof (*copier_data) + gtw_cfg_config_length, + &ipc4_copier->dma_config_tlv, tlv_size); + msg = &ipc4_copier->msg;break ; }
Péter Ujfalusi
maintainerQuoted 6 lines · On 20/08/2026 14:06, [email protected] wrote:
The patch below does not apply to the 7.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Quoted 6 lines
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.1.y git checkout
FETCH_HEAD
git cherry-pick -x0c0e418dbcf0582bf80d8dbfd9b306607c065992
# <resolve conflicts, build, test, etc.>
I'm not sure what might be the issue, but it is clean here:
HEAD ffc82ed66531 tag: v7.1.9, Linux 7.1.9
git cherry-pick -x 0c0e418dbcf0582bf80d8dbfd9b306607c065992
Auto-merging sound/soc/sof/ipc4-topology.c
[peter/upstream/host-copier-refresh-7.1 ffe9d6156740] ASoC: SOF: ipc4-topology: Refresh copier IPC payload before widget setup
Date: Thu Jul 30 08:48:22 2026 +0300
1 file changed, 33 insertions(+)
Quoted 2 lines
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026082016-frisk-riches-3e59@gregkh' --subject-prefix 'PATCH 7.1.y' 'HEAD^..'
Since there are no conflicts to resolve, should I still send the patch?
Signature · 1 line
Péter
Quoted 113 lines
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
0c0e418dbcf0582bf80d8dbfd9b306607c065992Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <[email protected]>
Date: Thu, 30 Jul 2026 08:48:22 +0300
Subject: [PATCH] ASoC: SOF: ipc4-topology: Refresh copier IPC payload before
widget setupThe
ipc_config_databuffer for copier widgets is built once duringipc_prepare(called fromsof_pcm_setup_connected_widgets) and cached for reuse. For host copiers this buffer contains thecopier_datawith gtw_cfg.node_id (host DMA ID). For DAI copiers it additionally includes adma_config_tlvtrailer withstream_idanddma_channel_idfor HDA link DMA.On suspend/resume, both host and link DMA streams are released and re-allocated with potentially different stream tags. The underlying
copier_dataanddma_config_tlvstructures are correctly updated byhost_configandsdw_hda_dai_hw_paramsrespectively. However, since the widget list (spcm->stream[].list) persists across suspend,sof_pcm_hw_paramsskipssof_pcm_setup_connected_widgetsandipc_preparenever runs again to rebuildipc_config_data. The stale cached payload is then sent to firmware with boot-time DMA channel assignments, causing DMA channel conflicts that lead to firmware errors and crashes.Fix this by refreshing
copier_dataanddma_config_tlvportions ofipc_config_datainsof_ipc4_widget_setupright before the IPC message is sent. This ensures the payload always reflects the current DMA state regardless of whetheripc_prepareran.For DAI copiers, the gtw_cfg.config_length in
copier_datais temporarily inflated to include the TLV size (matching theipc_config_datalayout) before copying, then restored, mirroring whatsof_ipc4_prepare_copier_moduledoes when first building the buffer.Fixes e9c6b118de1a ("ASoC: SOF: make dma_config_tlv be an array")Signed-off-by Peter Ujfalusi <[email protected]>Reviewed-by Kai Vehmanen <[email protected]>Reviewed-by Liam Girdwood <[email protected]>Signed-off-by Mark Brown <[email protected]>sound/soc/sof/ipc4-topology.c +33
-0@@ -3204,6 +3204,15 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data in ipc_config_data for host copiers. +* The node_id may have been updated by host_config after +* ipc_prepare, e.g. when host stream tags change after a +* suspend/resume cycle. +*/ +if (swidget->id != snd_soc_dapm_buffer) +memcpy (ipc_data, &ipc4_copier->data,sizeof (ipc4_copier->data)); + msg = &ipc4_copier->msg;break ; }@@ -3212,6 +3221,9 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget {struct snd_sof_dai *dai = swidget->private;struct sof_ipc4_copier *ipc4_copier = dai->private; +struct sof_ipc4_copier_data *copier_data; +u32 gtw_cfg_config_length; +u32 tlv_size; pipeline = pipe_widget->private;if (pipeline->use_chain_dma)@@ -3220,6 +3232,27 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data and dma_config_tlv in ipc_config_data. +* These may have been updated after ipc_prepare, e.g. when +* link DMA stream tags change after a suspend/resume cycle. +* +* copier_data->gtw_cfg.config_length does not include the +* TLV size (it was restored after sof_ipc4_prepare_copier_module), +* so temporarily inflate it to match the ipc_config_data layout. +*/ + copier_data = &ipc4_copier->data; + gtw_cfg_config_length = copier_data->gtw_cfg.config_length *4 ; + tlv_size = ipc_size -sizeof (*copier_data) - gtw_cfg_config_length; + + copier_data->gtw_cfg.config_length += tlv_size /4 ; +memcpy (ipc_data, copier_data,sizeof (*copier_data)); + copier_data->gtw_cfg.config_length = gtw_cfg_config_length /4 ; + +if (tlv_size) +memcpy (ipc_data +sizeof (*copier_data) + gtw_cfg_config_length, + &ipc4_copier->dma_config_tlv, tlv_size); + msg = &ipc4_copier->msg;break ; }
Greg KH
maintainerQuoted 23 lines · Péter Ujfalusi
Quoted 6 lines · On 20/08/2026 14:06, [email protected] wrote:
The patch below does not apply to the 7.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.Quoted 6 lines
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.1.y git checkout
FETCH_HEAD
git cherry-pick -x0c0e418dbcf0582bf80d8dbfd9b306607c065992
# <resolve conflicts, build, test, etc.>I'm not sure what might be the issue, but it is clean here:
HEADffc82ed66531tag: v7.1.9, Linux 7.1.9git cherry-pick -x
0c0e418dbcf0582bf80d8dbfd9b306607c065992
Auto-mergingsound/soc/sof/ipc4-topology.c
[peter/upstream/host-copier-refresh-7.1ffe9d6156740] ASoC: SOF: ipc4-topology: Refresh copier IPC payload before widget setup
Date: Thu Jul 30 08:48:22 2026 +0300
Quoted 6 lines
1 file changed, 33 insertions(+)Quoted 2 lines
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026082016-frisk-riches-3e59@gregkh' --subject-prefix 'PATCH 7.1.y' 'HEAD^..'Since there are no conflicts to resolve, should I still send the patch?
I see major conflicts here:
Applying patch asoc-sof-ipc4-topology-refresh-copier-ipc-payload-before-widget-setup.patch patching file sound/soc/sof/ipc4-topology.c
Hunk #1 succeeded at 3167 (offset -37 lines).
Hunk #2 FAILED at 3221.
Hunk #3 FAILED at 3229.
2 out of 3 hunks FAILED -- rejects in file sound/soc/sof/ipc4-topology.c
Patch asoc-sof-ipc4-topology-refresh-copier-ipc-payload-before-widget-setup.patch does not apply (enforce with -f)
thanks,
greg k-h
Péter Ujfalusi
maintainerQuoted 10 lines · Greg KH
On Thu, Aug 20, 2026 at 02:45:30PM +0300, Péter Ujfalusi wrote:
I see major conflicts here:Applying patch asoc-sof-ipc4-topology-refresh-copier-ipc-payload-before-widget-setup.patch patching file
sound/soc/sof/ipc4-topology.c
Hunk #1 succeeded at 3167 (offset -37 lines).
Hunk #2 FAILED at 3221.
Hunk #3 FAILED at 3229.
2 out of 3 hunks FAILED -- rejects in filesound/soc/sof/ipc4-topology.c
Patch asoc-sof-ipc4-topology-refresh-copier-ipc-payload-before-widget-setup.patch does not apply (enforce with -f)
I see no such conflicts on top of 7.1.9 tag, checking the original and picked patch with -U20 I don't see any difference in the surrounding either.
I have sent my version of cherry-pick as per instructions in original mail.
Signature · 1 line
Péter
Peter Ujfalusi
maintainerPATCH 1/1 ASoC: SOF: ipc4-topology: Refresh copier IPC payload before widget setup
In reply to [email protected]The ipc_config_data buffer for copier widgets is built once during ipc_prepare (called from sof_pcm_setup_connected_widgets) and cached for reuse. For host copiers this buffer contains the copier_data with gtw_cfg.node_id (host DMA ID). For DAI copiers it additionally includes a dma_config_tlv trailer with stream_id and dma_channel_id for HDA link DMA.
On suspend/resume, both host and link DMA streams are released and re-allocated with potentially different stream tags. The underlying copier_data and dma_config_tlv structures are correctly updated by host_config and sdw_hda_dai_hw_params respectively. However, since the widget list (spcm->stream[].list) persists across suspend, sof_pcm_hw_params skips sof_pcm_setup_connected_widgets and ipc_prepare never runs again to rebuild ipc_config_data. The stale cached payload is then sent to firmware with boot-time DMA channel assignments, causing DMA channel conflicts that lead to firmware errors and crashes.
Fix this by refreshing copier_data and dma_config_tlv portions of ipc_config_data in sof_ipc4_widget_setup right before the IPC message is sent. This ensures the payload always reflects the current DMA state regardless of whether ipc_prepare ran.
For DAI copiers, the gtw_cfg.config_length in copier_data is temporarily inflated to include the TLV size (matching the ipc_config_data layout) before copying, then restored, mirroring what sof_ipc4_prepare_copier_module does when first building the buffer.
--- sound/soc/sof/ipc4-topology.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
sound/soc/sof/ipc4-topology.c +33 -0
@@ -3151,6 +3151,15 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data in ipc_config_data for host copiers. +* The node_id may have been updated by host_config after +* ipc_prepare, e.g. when host stream tags change after a +* suspend/resume cycle. +*/ +if (swidget->id != snd_soc_dapm_buffer) +memcpy (ipc_data, &ipc4_copier->data,sizeof (ipc4_copier->data)); + msg = &ipc4_copier->msg;break ; }
@@ -3159,6 +3168,9 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget {struct snd_sof_dai *dai = swidget->private;struct sof_ipc4_copier *ipc4_copier = dai->private; +struct sof_ipc4_copier_data *copier_data; +u32 gtw_cfg_config_length; +u32 tlv_size; pipeline = pipe_widget->private;if (pipeline->use_chain_dma)
@@ -3167,6 +3179,27 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget ipc_size = ipc4_copier->ipc_config_size; ipc_data = ipc4_copier->ipc_config_data; +/* +* Refresh copier_data and dma_config_tlv in ipc_config_data. +* These may have been updated after ipc_prepare, e.g. when +* link DMA stream tags change after a suspend/resume cycle. +* +* copier_data->gtw_cfg.config_length does not include the +* TLV size (it was restored after sof_ipc4_prepare_copier_module), +* so temporarily inflate it to match the ipc_config_data layout. +*/ + copier_data = &ipc4_copier->data; + gtw_cfg_config_length = copier_data->gtw_cfg.config_length *4 ; + tlv_size = ipc_size -sizeof (*copier_data) - gtw_cfg_config_length; + + copier_data->gtw_cfg.config_length += tlv_size /4 ; +memcpy (ipc_data, copier_data,sizeof (*copier_data)); + copier_data->gtw_cfg.config_length = gtw_cfg_config_length /4 ; + +if (tlv_size) +memcpy (ipc_data +sizeof (*copier_data) + gtw_cfg_config_length, + &ipc4_copier->dma_config_tlv, tlv_size); + msg = &ipc4_copier->msg;break ; }
Signature · 1 line
2.55.0