dma-direct: atomic allocations must come from atomic coherent pools
authorDavid Rientjes <rientjes@google.com>
Wed, 15 Apr 2020 00:04:58 +0000 (17:04 -0700)
committerChristoph Hellwig <hch@lst.de>
Sat, 25 Apr 2020 11:17:05 +0000 (13:17 +0200)
commit76a19940bd62a81148c303f3df6d0cee9ae4b509
tree71caddd9ff61acea7bb981c723e33575278431c4
parent54adadf9b08571fb8b11dc9d0d3a2ddd39825efd
dma-direct: atomic allocations must come from atomic coherent pools

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 <rientjes@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
kernel/dma/direct.c
kernel/dma/pool.c