linux/kernel/dma
Thomas Hellstrom 17c4a2ae15 dma-mapping: Fix dma_pgprot() for unencrypted coherent pages
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
2020-03-17 11:52:58 +01:00
..
coherent.c dma-mapping: fix handling of dma-ranges for reserved memory (again) 2019-10-30 11:07:35 -07:00
contiguous.c dma-contiguous: CMA: give precedence to cmdline 2020-01-30 14:41:42 +01:00
debug.c dma-mapping updates for 5.5-rc1 2019-11-28 11:16:43 -08:00
direct.c dma-direct: improve DMA mask overflow reporting 2020-02-05 18:53:41 +01:00
dummy.c dma-mapping: factor out dummy DMA ops 2018-12-13 21:06:12 +01:00
Kconfig dma-direct: provide mmap and get_sgtable method overrides 2019-11-11 10:52:15 +01: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-03-17 11:52:58 +01:00
remap.c lib/genalloc.c: rename addr_in_gen_pool to gen_pool_has_addr 2019-12-04 19:44:13 -08:00
swiotlb.c dma-direct: improve swiotlb error reporting 2020-02-05 18:53:05 +01:00
virt.c dma-mapping: zero memory returned from dma_alloc_* 2018-12-20 08:13:52 +01:00