Skip to contentSkip to conversation

ALSA: hda: Use non-SG allocation for the communication buffers

PATCH In review Takashi Iwai 1 participant 2 messages Jul 29, 2024 – Jul 30, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: Use non-SG allocation for the communication buffers

The azx_bus->dma_type is referred only for allocating the communication buffers like CORB/RIRB, and the allocation size is small. Hence it doesn't have to be S/G buffer allocation, which is an obvious overkill. Use the standard SNDRV_DMA_TYPE_DEV_WC instead.

Looking at the commit history, this change was done together with a workaround of memalloc fixes, and it must come from misunderstanding of the data used there.

Fixes 37137ec26c2c ("ALSA: hda: Once again fix regression of page allocations with IOMMU")
---
 sound/pci/hda/hda_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +1 -1
index b33602e64d17..ad474ca9b24e 100644
@@ -1809,7 +1809,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
 
 	/* use the non-cached pages in non-snoop mode */
 	if (!azx_snoop(chip))
-		azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC_SG;
+		azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC;
 
 	if (chip->driver_type == AZX_DRIVER_NVIDIA) {
 		dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");
Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Takashi Iwai

The azx_bus->dma_type is referred only for allocating the communication buffers like CORB/RIRB, and the allocation size is small. Hence it doesn't have to be S/G buffer allocation, which is an obvious overkill. Use the standard SNDRV_DMA_TYPE_DEV_WC instead.

Quoted 6 lines

Looking at the commit history, this change was done together with a workaround of memalloc fixes, and it must come from misunderstanding of the data used there.

Fixes 37137ec26c2c ("ALSA: hda: Once again fix regression of page allocations with IOMMU")

This turned out to be a possible breaker. The current wc page allocator has specific workarounds for x86 that doesn't use the DMA API, and this won't work with IOMMU.

Another fix for x86 is needed to correct the WC page allocation behavior at first.

Takashi

Quoted 20 lines
---
 sound/pci/hda/hda_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +1 -1
index b33602e64d17..ad474ca9b24e 100644
@@ -1809,7 +1809,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
 
 	/* use the non-cached pages in non-snoop mode */
 	if (!azx_snoop(chip))
-		azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC_SG;
+		azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC;
 
 	if (chip->driver_type == AZX_DRIVER_NVIDIA) {
 		dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");
Signature · 1 line
2.43.0