All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup
@ 2021-08-19 15:29 Takashi Iwai
  2021-08-19 15:35 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2021-08-19 15:29 UTC (permalink / raw)
  To: alsa-devel; +Cc: Hans de Goede, Mark Brown

The commit 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM
buffer address") changed the reference of PCM buffer address to
substream->runtime->dma_addr as the buffer address may change
dynamically.  However, I forgot that the dma_addr field is still not
set up for the CONTINUOUS buffer type (that this driver uses) yet in
5.14 and earlier kernels, and it resulted in garbage I/O.  The problem
will be fixed in 5.15, but we need to address it quickly for now.

The fix is to deduce the address again from the DMA pointer with
virt_to_phys(), but from the right one, substream->runtime->dma_area.

Fixes: 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address")
Reported-and-tested-by: Hans de Goede <hdegoede@redhat.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/2048c6aa-2187-46bd-6772-36a4fb3c5aeb@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 5db2f4865bbb..905c7965f653 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
 	snd_pcm_uframes_t period_size;
 	ssize_t periodbytes;
 	ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
-	u32 buffer_addr = substream->runtime->dma_addr;
+	u32 buffer_addr = virt_to_phys(substream->runtime->dma_area);
 
 	channels = substream->runtime->channels;
 	period_size = substream->runtime->period_size;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup
  2021-08-19 15:29 [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup Takashi Iwai
@ 2021-08-19 15:35 ` Takashi Iwai
  2021-08-19 15:40   ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2021-08-19 15:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: Hans de Goede, alsa-devel

On Thu, 19 Aug 2021 17:29:45 +0200,
Takashi Iwai wrote:
> 
> The commit 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM
> buffer address") changed the reference of PCM buffer address to
> substream->runtime->dma_addr as the buffer address may change
> dynamically.  However, I forgot that the dma_addr field is still not
> set up for the CONTINUOUS buffer type (that this driver uses) yet in
> 5.14 and earlier kernels, and it resulted in garbage I/O.  The problem
> will be fixed in 5.15, but we need to address it quickly for now.
> 
> The fix is to deduce the address again from the DMA pointer with
> virt_to_phys(), but from the right one, substream->runtime->dma_area.
> 
> Fixes: 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address")
> Reported-and-tested-by: Hans de Goede <hdegoede@redhat.com>
> Cc: <stable@vger.kernel.org>
> Link: https://lore.kernel.org/r/2048c6aa-2187-46bd-6772-36a4fb3c5aeb@redhat.com
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---

Mark, as it's close to the 5.14 final, exceptionally I'd like to merge
this into my tree directly now, so that it can be certainly included
in the next PR to Linus.
(Also because the commit will be reverted on for-next again, too.)

After the merge, feel free to pull my for-linus branch into yours.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup
  2021-08-19 15:35 ` Takashi Iwai
@ 2021-08-19 15:40   ` Mark Brown
  2021-08-19 16:59     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2021-08-19 15:40 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Hans de Goede, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

On Thu, Aug 19, 2021 at 05:35:18PM +0200, Takashi Iwai wrote:

> Mark, as it's close to the 5.14 final, exceptionally I'd like to merge
> this into my tree directly now, so that it can be certainly included
> in the next PR to Linus.
> (Also because the commit will be reverted on for-next again, too.)

> After the merge, feel free to pull my for-linus branch into yours.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup
  2021-08-19 15:40   ` Mark Brown
@ 2021-08-19 16:59     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-08-19 16:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Hans de Goede, alsa-devel

On Thu, 19 Aug 2021 17:40:30 +0200,
Mark Brown wrote:
> 
> On Thu, Aug 19, 2021 at 05:35:18PM +0200, Takashi Iwai wrote:
> 
> > Mark, as it's close to the 5.14 final, exceptionally I'd like to merge
> > this into my tree directly now, so that it can be certainly included
> > in the next PR to Linus.
> > (Also because the commit will be reverted on for-next again, too.)
> 
> > After the merge, feel free to pull my for-linus branch into yours.
> 
> Acked-by: Mark Brown <broonie@kernel.org>

Thanks, now merged and pushed out for-linus branch, commit
65ca89c2b12cca0d473f3dd54267568ad3af55cc.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-19 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 15:29 [PATCH] ASoC: intel: atom: Fix breakage for PCM buffer address setup Takashi Iwai
2021-08-19 15:35 ` Takashi Iwai
2021-08-19 15:40   ` Mark Brown
2021-08-19 16:59     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.