Skip to contentSkip to conversation

Patch "ALSA: pci: rme: Set up buffer type properly" has been added to the 5.14-stable tree

DISCUSSION Greg KH 2 participants 2 messages Nov 7, 2021 1 message not in the archive

lore
Share & tools
lore

Greg KH

author
#1 lore raw
In reply to a message not in the archive
Quoted 91 lines · On Sun, Nov 07, 2021 at 03:49:17PM +0100, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

ALSA: pci: rme: Set up buffer type properly

to the 5.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
alsa-pci-rme-set-up-buffer-type-properly.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 0899a7a23047f106c06888769d6cd6ff43d7395f Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Mon, 9 Aug 2021 09:18:28 +0200
Subject: ALSA: pci: rme: Set up buffer type properly

From: Takashi Iwai <[email protected]>

commit 0899a7a23047f106c06888769d6cd6ff43d7395f upstream.

Although the regression of the mmap was fixed in the recent commit dc0dc8a73e8e ("ALSA: pcm: Fix mmap breakage without explicit buffer setup"), RME9652 and HDSP drivers have still potential issues with their mmap handling. Namely, they use the default mmap handler without the standard buffer preallocation, and PCM core wouldn't use the coherent DMA mapping. It's practically OK on x86, but on some exotic architectures, it wouldn't work.

This patch addresses the potential breakage by replacing the buffer setup with the proper macro. It also simplifies the source code, too.

---
 sound/pci/rme9652/hdsp.c    |    6 ++----
 sound/pci/rme9652/rme9652.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
sound/pci/rme9652/hdsp.c +2 -4
@@ -4518,8 +4518,7 @@ static int snd_hdsp_playback_open(struct
 	snd_pcm_set_sync(substream);
 
         runtime->hw = snd_hdsp_playback_subinfo;
-	runtime->dma_area = hdsp->playback_buffer;
-	runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, hdsp->playback_dma_buf);
 
 	hdsp->playback_pid = current->pid;
 	hdsp->playback_substream = substream;
@@ -4595,8 +4594,7 @@ static int snd_hdsp_capture_open(struct
 	snd_pcm_set_sync(substream);
 
 	runtime->hw = snd_hdsp_capture_subinfo;
-	runtime->dma_area = hdsp->capture_buffer;
-	runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, hdsp->capture_dma_buf);
 
 	hdsp->capture_pid = current->pid;
 	hdsp->capture_substream = substream;
sound/pci/rme9652/rme9652.c +2 -4
@@ -2279,8 +2279,7 @@ static int snd_rme9652_playback_open(str
 	snd_pcm_set_sync(substream);
 
         runtime->hw = snd_rme9652_playback_subinfo;
-	runtime->dma_area = rme9652->playback_buffer;
-	runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, rme9652->playback_dma_buf);
 
 	if (rme9652->capture_substream == NULL) {
 		rme9652_stop(rme9652);
@@ -2339,8 +2338,7 @@ static int snd_rme9652_capture_open(stru
 	snd_pcm_set_sync(substream);
 
 	runtime->hw = snd_rme9652_capture_subinfo;
-	runtime->dma_area = rme9652->capture_buffer;
-	runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, rme9652->capture_dma_buf);
 
 	if (rme9652->playback_substream == NULL) {
 		rme9652_stop(rme9652);
Quoted 5 lines

Patches currently in stable-queue which might be from [email protected] are

queue-5.14/alsa-pci-rme-set-up-buffer-type-properly.patch queue-5.14/alsa-pcm-check-mmap-capability-of-runtime-dma-buffer-at-first.patch queue-5.14/alsa-pci-cs46xx-fix-set-up-buffer-type-properly.patch

This patch breaks the build, so I will drop it.

Can you provide a working backport?

thanks,

greg k-h

#2 lore raw
Quoted 95 lines · Greg KH
Quoted 93 lines · On Sun, Nov 07, 2021 at 03:49:17PM +0100, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

ALSA: pci: rme: Set up buffer type properly

to the 5.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
alsa-pci-rme-set-up-buffer-type-properly.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 0899a7a23047f106c06888769d6cd6ff43d7395f Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Mon, 9 Aug 2021 09:18:28 +0200
Subject: ALSA: pci: rme: Set up buffer type properly

From: Takashi Iwai <[email protected]>

commit 0899a7a23047f106c06888769d6cd6ff43d7395f upstream.

Although the regression of the mmap was fixed in the recent commit dc0dc8a73e8e ("ALSA: pcm: Fix mmap breakage without explicit buffer setup"), RME9652 and HDSP drivers have still potential issues with their mmap handling. Namely, they use the default mmap handler without the standard buffer preallocation, and PCM core wouldn't use the coherent DMA mapping. It's practically OK on x86, but on some exotic architectures, it wouldn't work.

This patch addresses the potential breakage by replacing the buffer setup with the proper macro. It also simplifies the source code, too.

---
 sound/pci/rme9652/hdsp.c    |    6 ++----
 sound/pci/rme9652/rme9652.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
sound/pci/rme9652/hdsp.c +2 -4
@@ -4518,8 +4518,7 @@ static int snd_hdsp_playback_open(struct
 	snd_pcm_set_sync(substream);
 
         runtime->hw = snd_hdsp_playback_subinfo;
-	runtime->dma_area = hdsp->playback_buffer;
-	runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, hdsp->playback_dma_buf);
 
 	hdsp->playback_pid = current->pid;
 	hdsp->playback_substream = substream;
@@ -4595,8 +4594,7 @@ static int snd_hdsp_capture_open(struct
 	snd_pcm_set_sync(substream);
 
 	runtime->hw = snd_hdsp_capture_subinfo;
-	runtime->dma_area = hdsp->capture_buffer;
-	runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, hdsp->capture_dma_buf);
 
 	hdsp->capture_pid = current->pid;
 	hdsp->capture_substream = substream;
sound/pci/rme9652/rme9652.c +2 -4
@@ -2279,8 +2279,7 @@ static int snd_rme9652_playback_open(str
 	snd_pcm_set_sync(substream);
 
         runtime->hw = snd_rme9652_playback_subinfo;
-	runtime->dma_area = rme9652->playback_buffer;
-	runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, rme9652->playback_dma_buf);
 
 	if (rme9652->capture_substream == NULL) {
 		rme9652_stop(rme9652);
@@ -2339,8 +2338,7 @@ static int snd_rme9652_capture_open(stru
 	snd_pcm_set_sync(substream);
 
 	runtime->hw = snd_rme9652_capture_subinfo;
-	runtime->dma_area = rme9652->capture_buffer;
-	runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
+	snd_pcm_set_runtime_buffer(substream, rme9652->capture_dma_buf);
 
 	if (rme9652->playback_substream == NULL) {
 		rme9652_stop(rme9652);

Patches currently in stable-queue which might be from [email protected] are

Quoted 7 lines
Quoted 3 lines

queue-5.14/alsa-pci-rme-set-up-buffer-type-properly.patch queue-5.14/alsa-pcm-check-mmap-capability-of-runtime-dma-buffer-at-first.patch queue-5.14/alsa-pci-cs46xx-fix-set-up-buffer-type-properly.patch

This patch breaks the build, so I will drop it.

Can you provide a working backport?

Sorry, I overlooked that it's after the recent code change with the devres support.

Then rather drop this one, as I found another potential issue in this patch. I cooked another different fix now that should cover the regression, instead. It'll be included in the next pull request.

The other two patches are fine for stable trees.

thanks,

Takashi