linux-stable/kernel/dma
Thomas Hellstrom e88ee287fd dma-mapping: Fix dma_pgprot() for unencrypted coherent pages
[ Upstream commit 17c4a2ae15 ]

When dma_mmap_coherent() sets up a mapping to unencrypted coherent memory
under SEV encryption and sometimes under SME encryption, it will actually
set up an encrypted mapping rather than an unencrypted, causing devices
that DMAs from that memory to read encrypted contents. Fix this.

When force_dma_unencrypted() returns true, the linear kernel map of the
coherent pages have had the encryption bit explicitly cleared and the
page content is unencrypted. Make sure that any additional PTEs we set
up to these pages also have the encryption bit cleared by having
dma_pgprot() return a protection with the encryption bit cleared in this
case.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lkml.kernel.org/r/20200304114527.3636-3-thomas_os@shipmail.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-17 10:50:01 +02:00
..
coherent.c dma-mapping: fix handling of dma-ranges for reserved memory (again) 2020-01-04 19:17:00 +01:00
contiguous.c dma-direct: fix zone selection after an unaddressable CMA allocation 2019-08-21 07:14:10 +09:00
debug.c dma-debug: add a schedule point in debug_dma_dump_mappings() 2020-01-04 19:16:57 +01:00
direct.c dma-direct: don't check swiotlb=force in dma_direct_map_resource 2020-01-26 10:01:08 +01:00
dummy.c dma-mapping: factor out dummy DMA ops 2018-12-13 21:06:12 +01:00
Kconfig dma-mapping: remove arch_dma_mmap_pgprot 2019-08-29 16:43:22 +02:00
Makefile dma-mapping: improve selection of dma_declare_coherent availability 2019-02-20 07:26:35 -07:00
mapping.c dma-mapping: Fix dma_pgprot() for unencrypted coherent pages 2020-04-17 10:50:01 +02:00
remap.c dma-mapping: fix false positivse warnings in dma_common_free_remap() 2019-10-05 10:24:17 +02:00
swiotlb.c powerpc updates for 5.4 2019-09-20 11:48:06 -07:00
virt.c dma-mapping: zero memory returned from dma_alloc_* 2018-12-20 08:13:52 +01:00