<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/sound/memalloc.h, branch v5.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-05-30T18:26:35Z</updated>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156</title>
<updated>2019-05-30T18:26:35Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-27T06:55:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1a59d1b8e05ea6ab45f7e18897de1ef0e6bc3da6'/>
<id>urn:sha1:1a59d1b8e05ea6ab45f7e18897de1ef0e6bc3da6</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ALSA: Replace snd_malloc_pages() and snd_free_pages() with standard helpers, take#2</title>
<updated>2019-03-27T16:15:01Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2018-11-23T18:38:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=734b5a0bbdf43518e6739c8156a985e385e557fe'/>
<id>urn:sha1:734b5a0bbdf43518e6739c8156a985e385e557fe</id>
<content type='text'>
snd_malloc_pages() and snd_free_pages() are merely thin wrappers of
the standard page allocator / free functions.  Even the arguments are
compatible with some standard helpers, so there is little merit of
keeping these wrappers.

This patch replaces the all existing callers of snd_malloc_pages() and
snd_free_pages() with the direct calls of the standard helper
functions.  In this version, we use a recently introduced one,
alloc_pages_exact(), which suits better than the old
snd_malloc_pages() implementation for our purposes.  Then we can avoid
the waste of pages by alignment to power-of-two.

Since alloc_pages_exact() does split pages, we need no longer
__GFP_COMP flag; or better to say, we must not pass __GFP_COMP to
alloc_pages_exact().  So the former unconditional addition of
__GFP_COMP flag in snd_malloc_pages() is dropped, as well as in most
other places.

Reviewed-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: isa: Avoid passing NULL to memory allocators</title>
<updated>2019-02-01T16:16:40Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2019-02-01T11:14:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b6a2c9cf4a00f54a0916499ece8a5cf3cced385'/>
<id>urn:sha1:0b6a2c9cf4a00f54a0916499ece8a5cf3cced385</id>
<content type='text'>
We used to pass NULL to memory allocators for ISA devices due to
historical reasons.  But we prefer rather a proper device object to be
assigned, so let's fix it by replacing snd_dma_isa_data() call with
card-&gt;dev reference, and kill snd_dma_isa_data() definition.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: memalloc: Add non-cached buffer type</title>
<updated>2018-08-28T11:56:47Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2018-08-08T15:01:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=42e748a0b3251cca0de2c269ca106884907eb289'/>
<id>urn:sha1:42e748a0b3251cca0de2c269ca106884907eb289</id>
<content type='text'>
In some cases (mainly for x86), we need the DMA coherent buffer with
non-cached pages.  Although this has been done in each driver side
like HD-audio and intel8x0, it can be done cleaner in the core memory
allocator.

This patch adds the new types, SNDRV_DMA_TYPE_DEV_UC and
SNDRV_DMA_TYPE_DEV_UC_SG, for allocating such non-cached buffer
pages.  On non-x86 architectures, they work as same as the standard
SNDRV_DMA_TYPE_DEV and *_SG.

One additional change by this move is that we can assure to pass the
non-cached pgprot to the vmapped buffer, too.  It eventually fixes the
case like non-snoop mode without mmap access on HD-audio.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: memalloc: Fix missing PAGE_SIZE definition</title>
<updated>2018-07-30T11:02:24Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2018-07-30T06:46:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=345a9ca37aa69bb3133c1a8390a71f993abcef0c'/>
<id>urn:sha1:345a9ca37aa69bb3133c1a8390a71f993abcef0c</id>
<content type='text'>
The recent fix moved the inline snd_sgbuf_aligned_pages() outside the
ifdef, and this triggered a build error on some architectures due to
the undefined PAGE_SIZE, as spotted by 0day bot.
Fix it by adding the missing header inclusion.

Fixes: 4cae99d9b530 ("ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally")
Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Cc: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally</title>
<updated>2018-07-26T16:05:29Z</updated>
<author>
<name>Pierre-Louis Bossart</name>
<email>pierre-louis.bossart@linux.intel.com</email>
</author>
<published>2018-07-25T20:15:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4cae99d9b5305ab8cccc839fccceb81ec9e5abda'/>
<id>urn:sha1:4cae99d9b5305ab8cccc839fccceb81ec9e5abda</id>
<content type='text'>
Make this helper inline function available for all platforms. This
helps solve 0-day compilation issues when CONFIG_SND_DMA_SGBUF is not
defined.

Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Signed-off-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>ALSA: memalloc: Drop superfluous ifndef</title>
<updated>2018-05-24T09:14:13Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2018-05-24T09:14:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=96961fa048cf2eef2b53cbc26313629937198996'/>
<id>urn:sha1:96961fa048cf2eef2b53cbc26313629937198996</id>
<content type='text'>
Drop the superfluous #ifndef check in memalloc.h that had been put
just for allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: Remove memory reservation code from memalloc helper</title>
<updated>2014-01-09T06:32:10Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2014-01-08T15:12:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=47d98c026ef9a9888c36f3c4f26b81f548a0ca86'/>
<id>urn:sha1:47d98c026ef9a9888c36f3c4f26b81f548a0ca86</id>
<content type='text'>
Nowadays we have CMA for obtaining the contiguous memory pages
efficiently.  Let's kill the old kludge for reserving the memory pages
for large buffers.  It was rarely useful (only for preserving pages
among module reloading or a little help by an early boot scripting),
used only by a couple of drivers, and yet it gives too much ugliness
than its benefit.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: memalloc.h - fix wrong truncation of dma_addr_t</title>
<updated>2013-12-10T14:30:46Z</updated>
<author>
<name>Stefano Panella</name>
<email>stefano.panella@citrix.com</email>
</author>
<published>2013-12-10T14:20:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=932e9dec380c67ec15ac3eb073bb55797d8b4801'/>
<id>urn:sha1:932e9dec380c67ec15ac3eb073bb55797d8b4801</id>
<content type='text'>
When running a 32bit kernel the hda_intel driver is still reporting
a 64bit dma_mask if the HW supports it.

From sound/pci/hda/hda_intel.c:

        /* allow 64bit DMA address if supported by H/W */
        if ((gcap &amp; ICH6_GCAP_64OK) &amp;&amp; !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
                pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
        else {
                pci_set_dma_mask(pci, DMA_BIT_MASK(32));
                pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
        }

which means when there is a call to dma_alloc_coherent from
snd_malloc_dev_pages a machine address bigger than 32bit can be returned.
This can be true in particular if running  the 32bit kernel as a pv dom0
under the Xen Hypervisor or PAE on bare metal.

The problem is that when calling setup_bdle to program the BLE the
dma_addr_t returned from the dma_alloc_coherent is wrongly truncated
from snd_sgbuf_get_addr if running a 32bit kernel:

static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
                                           size_t offset)
{
        struct snd_sg_buf *sgbuf = dmab-&gt;private_data;
        dma_addr_t addr = sgbuf-&gt;table[offset &gt;&gt; PAGE_SHIFT].addr;
        addr &amp;= PAGE_MASK;
        return addr + offset % PAGE_SIZE;
}

where PAGE_MASK in a 32bit kernel is zeroing the upper 32bit af addr.

Without this patch the HW will fetch the 32bit truncated address,
which is not the one obtained from dma_alloc_coherent and will result
to a non working audio but can corrupt host memory at a random location.

The current patch apply to v3.13-rc3-74-g6c843f5

Signed-off-by: Stefano Panella &lt;stefano.panella@citrix.com&gt;
Reviewed-by: Frediano Ziglio &lt;frediano.ziglio@citrix.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: Add ifdef CONFIG_GENERIC_ALLOCATOR for SNDRV_DMA_TYPE_IRAM code</title>
<updated>2013-10-24T12:36:40Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2013-10-24T12:25:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a5606f85611267047206d8ba055bc0e4ba166ad3'/>
<id>urn:sha1:a5606f85611267047206d8ba055bc0e4ba166ad3</id>
<content type='text'>
It turned out that we can't use gen_pool_*() functions on archs
without CONFIG_GENERIC_ALLOCATOR (resulting in missing symbols), since
linux/genalloc.h doesn't provide dummy functions for all.  We'd be
able to fix linux/genalloc.h size, but I take an easier path for
now...

Reported-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
</feed>
