Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: amd: acp-loader: Use GFP_KERNEL for DMA allocations in resume context

Replace GFP_ATOMIC with GFP_KERNEL for dma_alloc_coherent() calls. This
change improves memory allocation reliability during firmware loading,
particularly during system resume when memory pressure is high. Because
of using GFP_KERNEL, reclaim can happen which can reduce the probability
of failure.

Fixes memory allocation failures observed during system resume with
fragmented memory conditions.

snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP firmware after resume -12

Fixes: 145d7e5ae8f4e ("ASoC: SOF: amd: add option to use sram for data bin loading")
Fixes: 7e51a9e38ab20 ("ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://patch.msgid.link/20250725190254.1081184-1-usama.anjum@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Muhammad Usama Anjum and committed by
Mark Brown
eb3bb145 e95122a3

+3 -3
+3 -3
sound/soc/sof/amd/acp-loader.c
··· 65 65 dma_size = page_count * ACP_PAGE_SIZE; 66 66 adata->bin_buf = dma_alloc_coherent(&pci->dev, dma_size, 67 67 &adata->sha_dma_addr, 68 - GFP_ATOMIC); 68 + GFP_KERNEL); 69 69 if (!adata->bin_buf) 70 70 return -ENOMEM; 71 71 } ··· 77 77 adata->data_buf = dma_alloc_coherent(&pci->dev, 78 78 ACP_DEFAULT_DRAM_LENGTH, 79 79 &adata->dma_addr, 80 - GFP_ATOMIC); 80 + GFP_KERNEL); 81 81 if (!adata->data_buf) 82 82 return -ENOMEM; 83 83 } ··· 90 90 adata->sram_data_buf = dma_alloc_coherent(&pci->dev, 91 91 ACP_DEFAULT_SRAM_LENGTH, 92 92 &adata->sram_dma_addr, 93 - GFP_ATOMIC); 93 + GFP_KERNEL); 94 94 if (!adata->sram_data_buf) 95 95 return -ENOMEM; 96 96 }