summaryrefslogtreecommitdiffstats
path: root/kernel/dma
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2020-06-11 12:20:32 -0700
committerChristoph Hellwig <hch@lst.de>2020-06-23 14:13:54 +0200
commit1a2b3357e860d890f8045367b179c7e7e802cd71 (patch)
tree9620e8050e5cba9e7ae8efa923d19d2c6b64ee29 /kernel/dma
parent56fccf21d1961a06e2a0c96ce446ebf036651062 (diff)
downloadlinux-stable-1a2b3357e860d890f8045367b179c7e7e802cd71.tar.gz
linux-stable-1a2b3357e860d890f8045367b179c7e7e802cd71.tar.bz2
linux-stable-1a2b3357e860d890f8045367b179c7e7e802cd71.zip
dma-direct: add missing set_memory_decrypted() for coherent mapping
When a coherent mapping is created in dma_direct_alloc_pages(), it needs to be decrypted if the device requires unencrypted DMA before returning. Fixes: 3acac065508f ("dma-mapping: merge the generic remapping helpers into dma-direct") Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/direct.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 2f69bfdbe315..93f578a8e613 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -195,6 +195,12 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
__builtin_return_address(0));
if (!ret)
goto out_free_pages;
+ if (force_dma_unencrypted(dev)) {
+ err = set_memory_decrypted((unsigned long)ret,
+ 1 << get_order(size));
+ if (err)
+ goto out_free_pages;
+ }
memset(ret, 0, size);
goto done;
}