* [PATCH] ALSA: hda: Use non-SG allocation for the communication buffers
@ 2024-07-29 12:09 Takashi Iwai
2024-07-30 6:39 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2024-07-29 12:09 UTC (permalink / raw)
To: linux-sound
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")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/hda_intel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b33602e64d17..ad474ca9b24e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -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");
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: hda: Use non-SG allocation for the communication buffers
2024-07-29 12:09 [PATCH] ALSA: hda: Use non-SG allocation for the communication buffers Takashi Iwai
@ 2024-07-30 6:39 ` Takashi Iwai
0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2024-07-30 6:39 UTC (permalink / raw)
To: linux-sound
On Mon, 29 Jul 2024 14:09:50 +0200,
Takashi Iwai wrote:
>
> 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")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
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
> ---
> sound/pci/hda/hda_intel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index b33602e64d17..ad474ca9b24e 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -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");
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ALSA: hda: Use non-SG allocation for the communication buffers
@ 2024-09-09 13:47 Takashi Iwai
0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2024-09-09 13:47 UTC (permalink / raw)
To: linux-sound
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.
This was changed to SNDRV_DMA_TYPE_DEV_WC_SG in the commit
37137ec26c2c ("ALSA: hda: Once again fix regression of page
allocations with IOMMU") as a workaround for IOMMU-backed
allocations. But this is no longer needed since the allocation with
SNDRV_DMA_TYPE_DEV_WC itself was fixed in the commit 9c27301342a5
("ALSA: memalloc: Use DMA API for x86 WC page allocations, too").
So this patch reverts the previous workaround in this piece of code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/hda_intel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b79020adce63..edeaf3ee273c 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1821,7 +1821,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");
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-09 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 12:09 [PATCH] ALSA: hda: Use non-SG allocation for the communication buffers Takashi Iwai
2024-07-30 6:39 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2024-09-09 13:47 Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox