From: Takashi Iwai <tiwai@suse.de>
To: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [alsa-devel] [PATCH 1/4] ALSA: memalloc: Allow NULL device for SNDRV_DMA_TYPE_CONTINOUS type
Date: Tue, 05 Nov 2019 19:10:58 +0100 [thread overview]
Message-ID: <s5hsgn29ost.wl-tiwai@suse.de> (raw)
In-Reply-To: <5d05a1419c6acee8adc8184751e42616898ea28c.camel@linux.intel.com>
On Tue, 05 Nov 2019 18:58:53 +0100,
Ranjani Sridharan wrote:
>
> On Tue, 2019-11-05 at 09:01 +0100, Takashi Iwai wrote:
> > Currently we pass the artificial device pointer to the allocation
> > helper in the case of SNDRV_DMA_TYPE_CONTINUOUS for passing the GFP
> > flags. But all common cases are the allocations with GFP_KERNEL, and
> > it's messy to put this in each place.
> >
> > In this patch, the memalloc core helper is changed to accept the NULL
> > device pointer and it treats as the default mode, GFP_KERNEL, so that
> > all callers can omit the complex argument but just leave NULL.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> > Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 14
> > ++++++++------
> > sound/core/memalloc.c | 9
> > ++++++++-
> > 2 files changed, 16 insertions(+), 7 deletions(-)
> >
> > diff --git a/Documentation/sound/kernel-api/writing-an-alsa-
> > driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-
> > driver.rst
> > index 132f5eb9b530..5385618fd881 100644
> > --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
> > +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
> > @@ -3523,12 +3523,14 @@ The second argument (type) and the third
> > argument (device pointer) are
> > dependent on the bus. For normal devices, pass the device pointer
> > (typically identical as ``card->dev``) to the third argument with
> > ``SNDRV_DMA_TYPE_DEV`` type. For the continuous buffer unrelated to
> >
> Hi Takashi,
>
> I have a question about the usage of snd_dma_alloc_pages() with the
> SNDRV_DMA_TYPE_DEV type. I am working on adding a platform-device for
> audio which is a child device of the top-level PCI device in SOF.
> When I use the handle for the platform-device as the "dev" argument for
> snd_dma_alloc_pages(), the dma alloc fails on some platforms (ex: Ice
> Lake). But it works fine if I use the top-level PCI device instead.
> Why would that be? Are there any restrictions to what devices can be
> used for dma alloc?
This pretty much depends on the device. Basically the ALSA memalloc
stuff simply calls dma_alloc_coherent() if the buffer type is
SNDRV_DMA_TYPE_DEV, and the rest goes deeply into the code in
kernel/dma/*.
My wild guess is that the significant difference in your case is about
the DMA coherence mask set on the device. As default the platform
device keeps 32bit DMA while the modern PCI drivers often sets up
64bit DMA mask.
Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2019-11-05 18:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 8:01 [alsa-devel] [PATCH 0/4] ALSA: enhancement / cleanup on memalloc stuff Takashi Iwai
2019-11-05 8:01 ` [alsa-devel] [PATCH 1/4] ALSA: memalloc: Allow NULL device for SNDRV_DMA_TYPE_CONTINOUS type Takashi Iwai
2019-11-05 17:58 ` Ranjani Sridharan
2019-11-05 18:10 ` Takashi Iwai [this message]
2019-11-05 18:17 ` Sridharan, Ranjani
2019-11-05 18:46 ` Takashi Iwai
2019-11-05 18:28 ` Amadeusz Sławiński
2019-11-05 18:47 ` Takashi Iwai
2019-11-06 14:59 ` [alsa-devel] [PATCH v2] ALSA: memalloc: Allow NULL device for SNDRV_DMA_TYPE_CONTINUOUS type Takashi Iwai
2019-11-05 8:01 ` [alsa-devel] [PATCH 2/4] ALSA: memalloc: Add vmalloc buffer allocation support Takashi Iwai
2019-11-05 8:01 ` [alsa-devel] [PATCH 3/4] ALSA: pcm: Handle special page mapping in the default mmap handler Takashi Iwai
2019-11-05 8:01 ` [alsa-devel] [PATCH 4/4] ALSA: docs: Update documentation about SG- and vmalloc-buffers Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hsgn29ost.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=ranjani.sridharan@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.