<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/dma/direct.c, branch linux-5.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-06-09T08:25:58Z</updated>
<entry>
<title>dma-direct: don't over-decrypt memory</title>
<updated>2022-06-09T08:25:58Z</updated>
<author>
<name>Robin Murphy</name>
</author>
<published>2022-05-20T17:10:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=204dfb6305a5c31196a46e39269476af88cb1882'/>
<id>urn:sha1:204dfb6305a5c31196a46e39269476af88cb1882</id>
<content type='text'>
[ Upstream commit 4a37f3dd9a83186cb88d44808ab35b78375082c9 ]

The original x86 sev_alloc() only called set_memory_decrypted() on
memory returned by alloc_pages_node(), so the page order calculation
fell out of that logic. However, the common dma-direct code has several
potential allocators, not all of which are guaranteed to round up the
underlying allocation to a power-of-two size, so carrying over that
calculation for the encryption/decryption size was a mistake. Fix it by
rounding to a *number* of pages, rather than an order.

Until recently there was an even worse interaction with DMA_DIRECT_REMAP
where we could have ended up decrypting part of the next adjacent
vmalloc area, only averted by no architecture actually supporting both
configs at once. Don't ask how I found that one out...

Fixes: c10f07aa27da ("dma/direct: Handle force decryption for DMA coherent buffers in common code")
Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>dma-direct: don't fail on highmem CMA pages in dma_direct_alloc_pages</title>
<updated>2022-06-09T08:25:50Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2022-04-23T17:20:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3cace34c9e6a50b2182aa41e63fc5c319f69d373'/>
<id>urn:sha1:3cace34c9e6a50b2182aa41e63fc5c319f69d373</id>
<content type='text'>
[ Upstream commit 92826e967535db2eb117db227b1191aaf98e4bb3 ]

When dma_direct_alloc_pages encounters a highmem page it just gives up
currently.  But what we really should do is to try memory using the
page allocator instead - without this platforms with a global highmem
CMA pool will fail all dma_alloc_pages allocations.

Fixes: efa70f2fdc84 ("dma-mapping: add a new dma_alloc_pages API")
Reported-by: Mark O'Neill &lt;mao@tumblingdice.co.uk&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>dma-direct: add a dma_direct_use_pool helper</title>
<updated>2021-12-08T15:46:35Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-11-09T14:50:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=28e4576d556bca543b0996e9edd4b767397e24c6'/>
<id>urn:sha1:28e4576d556bca543b0996e9edd4b767397e24c6</id>
<content type='text'>
Add a helper to check if a potentially blocking operation should
dip into the atomic pools.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: factor the swiotlb code out of __dma_direct_alloc_pages</title>
<updated>2021-12-07T11:50:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-21T07:39:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aea7e2a86a94b2583e1e812c596140034398a169'/>
<id>urn:sha1:aea7e2a86a94b2583e1e812c596140034398a169</id>
<content type='text'>
Add a new helper to deal with the swiotlb case.  This keeps the code
nicely boundled and removes the not required call to
dma_direct_optimal_gfp_mask for the swiotlb case.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: drop two CONFIG_DMA_RESTRICTED_POOL conditionals</title>
<updated>2021-12-07T11:50:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-21T07:34:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f5d3939a5916c0a8a0b47dcbc33963dbffe74f90'/>
<id>urn:sha1:f5d3939a5916c0a8a0b47dcbc33963dbffe74f90</id>
<content type='text'>
swiotlb_alloc and swiotlb_free are properly stubbed out if
CONFIG_DMA_RESTRICTED_POOL is not set, so skip the extra checks.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: warn if there is no pool for force unencrypted allocations</title>
<updated>2021-12-07T11:50:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-21T08:00:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=78bc72787ab9e638173aeb1f589578105d3a43c9'/>
<id>urn:sha1:78bc72787ab9e638173aeb1f589578105d3a43c9</id>
<content type='text'>
Instead of blindly running into a blocking operation for a non-blocking gfp,
return NULL and spew an error.  Note that Kconfig prevents this for all
currently relevant platforms, and this is just a debug check.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: fail allocations that can't be made coherent</title>
<updated>2021-12-07T11:50:06Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-11-09T14:47:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=955f58f7406ad912825fc344c7825fd904b124a0'/>
<id>urn:sha1:955f58f7406ad912825fc344c7825fd904b124a0</id>
<content type='text'>
If the architecture can't remap or set an address uncached there is no way
to fullfill a request for a coherent allocation.  Return NULL in that case.
Note that this case currently does not happen, so this is a theoretical
fixup and/or a preparation for eventually supporting platforms that
can't support coherent allocations with the generic code.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: refactor the !coherent checks in dma_direct_alloc</title>
<updated>2021-12-07T11:49:57Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-21T07:47:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a86d10942db2e0099a369b367fe62898f95987a8'/>
<id>urn:sha1:a86d10942db2e0099a369b367fe62898f95987a8</id>
<content type='text'>
Add a big central !dev_is_dma_coherent(dev) block to deal with as much
as of the uncached allocation schemes and document the schemes a bit
better.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: factor out a helper for DMA_ATTR_NO_KERNEL_MAPPING allocations</title>
<updated>2021-12-07T11:49:50Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-18T11:08:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d541ae55d538265861ef729a64d2d816d34ef1e2'/>
<id>urn:sha1:d541ae55d538265861ef729a64d2d816d34ef1e2</id>
<content type='text'>
Split the code for DMA_ATTR_NO_KERNEL_MAPPING allocations into a separate
helper to make dma_direct_alloc a little more readable.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Acked-by: David Rientjes &lt;rientjes@google.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: clean up the remapping checks in dma_direct_alloc</title>
<updated>2021-12-07T11:48:09Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-11-09T14:20:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3c962226dbec7a611ddd4eb7af7f4e19f4790ea'/>
<id>urn:sha1:f3c962226dbec7a611ddd4eb7af7f4e19f4790ea</id>
<content type='text'>
Add two local variables to track if we want to remap the returned
address using vmap or call dma_set_uncached and use that to simplify
the code flow.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
</content>
</entry>
</feed>
