All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/4] ALSA: Support for non-coherent and non-contiguous page allocation
@ 2021-08-12 11:38 Takashi Iwai
  2021-08-12 11:38 ` [PATCH RFC v2 1/4] ALSA: memalloc: Count continuous pages in vmalloc buffer handler Takashi Iwai
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Takashi Iwai @ 2021-08-12 11:38 UTC (permalink / raw)
  To: alsa-devel

Hi,

this is a revised patchset to add the support for PCM buffers with
non-coherent and non-contiguous pages, typically useful for non-x86
architectures.  The first patch improves the SG-buffer handling, then
add a new PCM info flag that disables the control and status mmap, and
implements two new buffer types, SNDRV_DMA_TYPE_NONCONTIG and
SNDRV_DMA_TYPE_NONCOHERENT.  The former is the SG-buffer and the
latter is the continuous page allocation, corresponding to
SNDRV_DMA_TYPE_DEV_SG and SNDRV_DMA_TYPE_DEV on x86.

Unlike other page types, those are directional (that need the DMA
direction at allocation time) and require the explicit sync of buffers
around the data transfer (flushing, invalidating).  The sync is
implemented inside ALSA PCM core and automatically applied at updating
the applptr and hwsync via SYNC_PTR ioctl, which should be issued
during mmap operation, so it should work transparently as long as
applications are running with alsa-lib.  For tinyALSA, we might need
to revisit the implementation.

This is currently an RFC -- more exactly, CALL FOR TESTERS, as I have
no Arm machine with the sound device for now.  The needed change for
an existing driver is simple:

* Replace the buffer type from SNDRV_DMA_TYPE_DEV to
  SNDRV_DMA_TYPE_NONCOHERENT (or from SNDRV_DMA_TYPE_DEV_SG to
  SNDRV_DMA_TYPE_NONCONTIG), which is set up typically in
  snd_pcm_set_managed_buffer*() call.

* Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag to the PCM runtime
  hardware.info field

It'd be greatly appreciated if anyone can test and try the changes,
and help debugging.  Again, the code is faily untested.

The latest code is found in topic/memalloc-noncontig branch of my
sound git tree:
 git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

The patch set is based on for-next branch, i.e. changes for 5.15 are
included.


thanks,

Takashi

===

v1: https://lore.kernel.org/r/20210810122200.971-1-tiwai@suse.de

v1->v2:
* Drop the optimization patch for embedding ops that turned out to be
negligible but causing a trouble with the existing sgbuf.
* Minor code refactoring

===

Takashi Iwai (4):
  ALSA: memalloc: Count continuous pages in vmalloc buffer handler
  ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag
  ALSA: memalloc: Support for non-contiguous page allocation
  ALSA: memalloc: Support for non-coherent page allocation

 include/sound/memalloc.h    |  46 +++++++++-
 include/uapi/sound/asound.h |   1 +
 sound/core/memalloc.c       | 172 ++++++++++++++++++++++++++++++++----
 sound/core/memalloc_local.h |   1 +
 sound/core/pcm_lib.c        |   3 +
 sound/core/pcm_local.h      |   7 ++
 sound/core/pcm_memory.c     |  13 ++-
 sound/core/pcm_native.c     |  15 ++++
 8 files changed, 236 insertions(+), 22 deletions(-)

-- 
2.26.2


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

end of thread, other threads:[~2021-08-13  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 11:38 [PATCH RFC v2 0/4] ALSA: Support for non-coherent and non-contiguous page allocation Takashi Iwai
2021-08-12 11:38 ` [PATCH RFC v2 1/4] ALSA: memalloc: Count continuous pages in vmalloc buffer handler Takashi Iwai
2021-08-12 11:38 ` [PATCH RFC v2 2/4] ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag Takashi Iwai
2021-08-12 18:37   ` Pierre-Louis Bossart
2021-08-13  6:03     ` Takashi Iwai
2021-08-12 11:38 ` [PATCH RFC v2 3/4] ALSA: memalloc: Support for non-contiguous page allocation Takashi Iwai
2021-08-12 11:38 ` [PATCH RFC v2 4/4] ALSA: memalloc: Support for non-coherent " 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.