diff mbox series

[1/5] ASoC: amd: Fix reference to PCM buffer address

Message ID 20210728112353.6675-2-tiwai@suse.de
State Accepted
Commit 8b5d95313b6d30f642e4ed0125891984c446604e
Headers show
Series [1/5] ASoC: amd: Fix reference to PCM buffer address | expand

Commit Message

Takashi Iwai July 28, 2021, 11:23 a.m. UTC
PCM buffers might be allocated dynamically when the buffer
preallocation failed or a larger buffer is requested, and it's not
guaranteed that substream->dma_buffer points to the actually used
buffer.  The driver needs to refer to substream->runtime->dma_addr
instead for the buffer address.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/amd/acp-pcm-dma.c          | 2 +-
 sound/soc/amd/raven/acp3x-pcm-dma.c  | 2 +-
 sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Brown July 30, 2021, 4:20 p.m. UTC | #1
On Wed, Jul 28, 2021 at 01:23:49PM +0200, Takashi Iwai wrote:
> PCM buffers might be allocated dynamically when the buffer

> preallocation failed or a larger buffer is requested, and it's not

> guaranteed that substream->dma_buffer points to the actually used

> buffer.  The driver needs to refer to substream->runtime->dma_addr

> instead for the buffer address.


This breaks the build for me on an x86-64 allmodconfig:

/mnt/kernel/sound/soc/amd/renoir/acp3x-pdm-dma.c: In function 'acp_pdm_dma_hw_params':
/mnt/kernel/sound/soc/amd/renoir/acp3x-pdm-dma.c:245:18: error: 'runtime' undeclared (first use in this function); did you mean 'vtime'?
  rtd->dma_addr = runtime->dma_addr;
                  ^~~~~~~
                  vtime
Takashi Iwai July 30, 2021, 6:14 p.m. UTC | #2
On Fri, 30 Jul 2021 18:20:25 +0200,
Mark Brown wrote:
> 

> On Wed, Jul 28, 2021 at 01:23:49PM +0200, Takashi Iwai wrote:

> > PCM buffers might be allocated dynamically when the buffer

> > preallocation failed or a larger buffer is requested, and it's not

> > guaranteed that substream->dma_buffer points to the actually used

> > buffer.  The driver needs to refer to substream->runtime->dma_addr

> > instead for the buffer address.

> 

> This breaks the build for me on an x86-64 allmodconfig:

> 

> /mnt/kernel/sound/soc/amd/renoir/acp3x-pdm-dma.c: In function 'acp_pdm_dma_hw_params':

> /mnt/kernel/sound/soc/amd/renoir/acp3x-pdm-dma.c:245:18: error: 'runtime' undeclared (first use in this function); did you mean 'vtime'?

>   rtd->dma_addr = runtime->dma_addr;

>                   ^~~~~~~

>                   vtime


Oops, will resubmit the fixed patch set.


thanks,

Takashi
Mark Brown July 30, 2021, 7:03 p.m. UTC | #3
On Wed, 28 Jul 2021 13:23:49 +0200, Takashi Iwai wrote:
> PCM buffers might be allocated dynamically when the buffer

> preallocation failed or a larger buffer is requested, and it's not

> guaranteed that substream->dma_buffer points to the actually used

> buffer.  The driver needs to refer to substream->runtime->dma_addr

> instead for the buffer address.


Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/5] ASoC: amd: Fix reference to PCM buffer address
      (no commit info)
[2/5] ASoC: intel: atom: Fix reference to PCM buffer address
      commit: 2e6b836312a477d647a7920b56810a5a25f6c856
[3/5] ASoC: xilinx: Fix reference to PCM buffer address
      commit: 42bc62c9f1d3d4880bdc27acb5ab4784209bb0b0
[4/5] ASoC: uniphier: Fix reference to PCM buffer address
      commit: 827f3164aaa579eee6fd50c6654861d54f282a11
[5/5] ASoC: kirkwood: Fix reference to PCM buffer address
      commit: bb6a40fc5a830cae45ddd5cd6cfa151b008522ed

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 143155a840ac..cc1ce6f22caa 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -969,7 +969,7 @@  static int acp_dma_hw_params(struct snd_soc_component *component,
 
 	acp_set_sram_bank_state(rtd->acp_mmio, 0, true);
 	/* Save for runtime private data */
-	rtd->dma_addr = substream->dma_buffer.addr;
+	rtd->dma_addr = runtime->dma_addr;
 	rtd->order = get_order(size);
 
 	/* Fill the page table entries in ACP SRAM */
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 8148b0d22e88..597d7c4b2a6b 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -286,7 +286,7 @@  static int acp3x_dma_hw_params(struct snd_soc_component *component,
 		pr_err("pinfo failed\n");
 	}
 	size = params_buffer_bytes(params);
-	rtd->dma_addr = substream->dma_buffer.addr;
+	rtd->dma_addr = substream->runtime->dma_addr;
 	rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
 	config_acp3x_dma(rtd, substream->stream);
 	return 0;
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index bd20622b0933..11bd22f4fef5 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -242,7 +242,7 @@  static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
 		return -EINVAL;
 	size = params_buffer_bytes(params);
 	period_bytes = params_period_bytes(params);
-	rtd->dma_addr = substream->dma_buffer.addr;
+	rtd->dma_addr = runtime->dma_addr;
 	rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
 	config_acp_dma(rtd, substream->stream);
 	init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes,