<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/dma, branch v5.8-rc2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://www.git.shady.money/linux/atom?h=v5.8-rc2</id>
<link rel='self' href='https://www.git.shady.money/linux/atom?h=v5.8-rc2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/'/>
<updated>2020-06-15T06:35:30Z</updated>
<entry>
<title>dma-pool: decouple DMA_REMAP from DMA_COHERENT_POOL</title>
<updated>2020-06-15T06:35:30Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-06-11T07:25:57Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=dbed452a078d56bc7f1abecc3edd6a75e8e4484e'/>
<id>urn:sha1:dbed452a078d56bc7f1abecc3edd6a75e8e4484e</id>
<content type='text'>
DMA_REMAP is an unnecessary requirement for AMD SEV, which requires
DMA_COHERENT_POOL, so avoid selecting it when it is otherwise unnecessary.

The only other requirement for DMA coherent pools is DMA_DIRECT_REMAP, so
ensure that properly selects the config option when needed.

Fixes: 82fef0ad811f ("x86/mm: unencrypted non-blocking DMA allocations use coherent pools")
Reported-by: Alex Xu (Hello71) &lt;alex_y_xu@yahoo.ca&gt;
Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Tested-by: Alex Xu (Hello71) &lt;alex_y_xu@yahoo.ca&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-pool: fix too large DMA pools on medium memory size systems</title>
<updated>2020-06-09T13:25:52Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert@linux-m68k.org</email>
</author>
<published>2020-06-08T13:22:17Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=3ee06a6d532f75f20528ff4d2c473cda36c484fe'/>
<id>urn:sha1:3ee06a6d532f75f20528ff4d2c473cda36c484fe</id>
<content type='text'>
On systems with at least 32 MiB, but less than 32 GiB of RAM, the DMA
memory pools are much larger than intended (e.g. 2 MiB instead of 128
KiB on a 256 MiB system).

Fix this by correcting the calculation of the number of GiBs of RAM in
the system.  Invert the order of the min/max operations, to keep on
calculating in pages until the last step, which aids readability.

Fixes: 1d659236fb43c4d2 ("dma-pool: scale the default DMA coherent pool size with memory capacity")
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>Merge tag 'dma-mapping-5.8' of git://git.infradead.org/users/hch/dma-mapping</title>
<updated>2020-06-06T18:43:23Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-06-06T18:43:23Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=1ee18de92927f37e6948d5a6fc73cbf89f806905'/>
<id>urn:sha1:1ee18de92927f37e6948d5a6fc73cbf89f806905</id>
<content type='text'>
Pull dma-mapping updates from Christoph Hellwig:

 - enhance the dma pool to allow atomic allocation on x86 with AMD SEV
   (David Rientjes)

 - two small cleanups (Jason Yan and Peter Collingbourne)

* tag 'dma-mapping-5.8' of git://git.infradead.org/users/hch/dma-mapping:
  dma-contiguous: fix comment for dma_release_from_contiguous
  dma-pool: scale the default DMA coherent pool size with memory capacity
  x86/mm: unencrypted non-blocking DMA allocations use coherent pools
  dma-pool: add pool sizes to debugfs
  dma-direct: atomic allocations must come from atomic coherent pools
  dma-pool: dynamically expanding atomic pools
  dma-pool: add additional coherent pools to map to gfp mask
  dma-remap: separate DMA atomic pools from direct remap code
  dma-debug: make __dma_entry_alloc_check_leak() static
</content>
</entry>
<entry>
<title>dma-mapping: use vmap insted of reimplementing it</title>
<updated>2020-06-02T17:59:10Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-06-02T04:50:32Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=515e5b6d90d410a3b0b433853c367936830a45a4'/>
<id>urn:sha1:515e5b6d90d410a3b0b433853c367936830a45a4</id>
<content type='text'>
Replace the open coded instance of vmap with the actual function.  In
the non-contiguous (IOMMU) case this requires an extra find_vm_area,
but given that this isn't a fast path function that is a small price
to pay.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Cc: Christophe Leroy &lt;christophe.leroy@c-s.fr&gt;
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Cc: David Airlie &lt;airlied@linux.ie&gt;
Cc: Gao Xiang &lt;xiang@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Haiyang Zhang &lt;haiyangz@microsoft.com&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: "K. Y. Srinivasan" &lt;kys@microsoft.com&gt;
Cc: Laura Abbott &lt;labbott@redhat.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Michael Kelley &lt;mikelley@microsoft.com&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nitin Gupta &lt;ngupta@vflare.org&gt;
Cc: Robin Murphy &lt;robin.murphy@arm.com&gt;
Cc: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Cc: Stephen Hemminger &lt;sthemmin@microsoft.com&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Cc: Wei Liu &lt;wei.liu@kernel.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Paul Mackerras &lt;paulus@ozlabs.org&gt;
Cc: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Link: http://lkml.kernel.org/r/20200414131348.444715-6-hch@lst.de
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>dma-contiguous: fix comment for dma_release_from_contiguous</title>
<updated>2020-04-25T11:17:06Z</updated>
<author>
<name>Peter Collingbourne</name>
<email>pcc@google.com</email>
</author>
<published>2020-04-23T16:31:31Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=298f3db6ee690259927b105d5ad1079563361323'/>
<id>urn:sha1:298f3db6ee690259927b105d5ad1079563361323</id>
<content type='text'>
Commit 90ae409f9eb3 ("dma-direct: fix zone selection
after an unaddressable CMA allocation") changed the logic in
dma_release_from_contiguous to remove the normal pages fallback path,
but did not update the comment. Fix that.

Signed-off-by: Peter Collingbourne &lt;pcc@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-pool: scale the default DMA coherent pool size with memory capacity</title>
<updated>2020-04-25T11:17:06Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-04-15T00:05:02Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=1d659236fb43c4d2b37af7a4309681e834e9ec9a'/>
<id>urn:sha1:1d659236fb43c4d2b37af7a4309681e834e9ec9a</id>
<content type='text'>
When AMD memory encryption is enabled, some devices may use more than
256KB/sec from the atomic pools.  It would be more appropriate to scale
the default size based on memory capacity unless the coherent_pool
option is used on the kernel command line.

This provides a slight optimization on initial expansion and is deemed
appropriate due to the increased reliance on the atomic pools.  Note that
the default size of 128KB per pool will normally be larger than the
single coherent pool implementation since there are now up to three
coherent pools (DMA, DMA32, and kernel).

Note that even prior to this patch, coherent_pool= for sizes larger than
1 &lt;&lt; (PAGE_SHIFT + MAX_ORDER-1) can fail.  With new dynamic expansion
support, this would be trivially extensible to allow even larger initial
sizes.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-pool: add pool sizes to debugfs</title>
<updated>2020-04-25T11:17:05Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-04-15T00:04:59Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=2edc5bb3c5cc42131438460a50b7b16905c81c2a'/>
<id>urn:sha1:2edc5bb3c5cc42131438460a50b7b16905c81c2a</id>
<content type='text'>
The atomic DMA pools can dynamically expand based on non-blocking
allocations that need to use it.

Export the sizes of each of these pools, in bytes, through debugfs for
measurement.

Suggested-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
[hch: remove the !CONFIG_DEBUG_FS stubs]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-direct: atomic allocations must come from atomic coherent pools</title>
<updated>2020-04-25T11:17:05Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-04-15T00:04:58Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=76a19940bd62a81148c303f3df6d0cee9ae4b509'/>
<id>urn:sha1:76a19940bd62a81148c303f3df6d0cee9ae4b509</id>
<content type='text'>
When a device requires unencrypted memory and the context does not allow
blocking, memory must be returned from the atomic coherent pools.

This avoids the remap when CONFIG_DMA_DIRECT_REMAP is not enabled and the
config only requires CONFIG_DMA_COHERENT_POOL.  This will be used for
CONFIG_AMD_MEM_ENCRYPT in a subsequent patch.

Keep all memory in these pools unencrypted.  When set_memory_decrypted()
fails, this prohibits the memory from being added.  If adding memory to
the genpool fails, and set_memory_encrypted() subsequently fails, there
is no alternative other than leaking the memory.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-pool: dynamically expanding atomic pools</title>
<updated>2020-04-25T11:17:02Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-04-20T10:09:58Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=54adadf9b08571fb8b11dc9d0d3a2ddd39825efd'/>
<id>urn:sha1:54adadf9b08571fb8b11dc9d0d3a2ddd39825efd</id>
<content type='text'>
When an atomic pool becomes fully depleted because it is now relied upon
for all non-blocking allocations through the DMA API, allow background
expansion of each pool by a kworker.

When an atomic pool has less than the default size of memory left, kick
off a kworker to dynamically expand the pool in the background.  The pool
is doubled in size, up to MAX_ORDER-1.  If memory cannot be allocated at
the requested order, smaller allocation(s) are attempted.

This allows the default size to be kept quite low when one or more of the
atomic pools is not used.

Allocations for lowmem should also use GFP_KERNEL for the benefits of
reclaim, so use GFP_KERNEL | GFP_DMA and GFP_KERNEL | GFP_DMA32 for
lowmem allocations.

This also allows __dma_atomic_pool_init() to return a pointer to the pool
to make initialization cleaner.

Also switch over some node ids to the more appropriate NUMA_NO_NODE.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-pool: add additional coherent pools to map to gfp mask</title>
<updated>2020-04-20T10:09:40Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2020-04-15T00:04:55Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=c84dc6e68a1d2464e050d9694be4e4ff49e32bfd'/>
<id>urn:sha1:c84dc6e68a1d2464e050d9694be4e4ff49e32bfd</id>
<content type='text'>
The single atomic pool is allocated from the lowest zone possible since
it is guaranteed to be applicable for any DMA allocation.

Devices may allocate through the DMA API but not have a strict reliance
on GFP_DMA memory.  Since the atomic pool will be used for all
non-blockable allocations, returning all memory from ZONE_DMA may
unnecessarily deplete the zone.

Provision for multiple atomic pools that will map to the optimal gfp
mask of the device.

When allocating non-blockable memory, determine the optimal gfp mask of
the device and use the appropriate atomic pool.

The coherent DMA mask will remain the same between allocation and free
and, thus, memory will be freed to the same atomic pool it was allocated
from.

__dma_atomic_pool_init() will be changed to return struct gen_pool *
later once dynamic expansion is added.

Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
</feed>
