From 4fe87e818ea492ade079cc01a31d088e445f8539 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 31 Mar 2022 08:01:21 +0200 Subject: dma-mapping: move pgprot_decrypted out of dma_pgprot pgprot_decrypted is used by AMD SME systems to allow access to memory that was set to not encrypted using set_memory_decrypted. That only happens for dma-direct memory as the IOMMU solves the addressing challenges for the encryption bit using its own remapping. Move the pgprot_decrypted call out of dma_pgprot which is also used by the IOMMU mappings and into dma-direct so that it is only used with memory that was set decrypted. Fixes: f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP") Reported-by: Alex Xu (Hello71) Signed-off-by: Christoph Hellwig Tested-by: Alex Xu (Hello71) --- kernel/dma/mapping.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'kernel/dma/mapping.c') diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index 559461a826ba..db7244291b74 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -407,8 +407,6 @@ EXPORT_SYMBOL(dma_get_sgtable_attrs); */ pgprot_t dma_pgprot(struct device *dev, pgprot_t prot, unsigned long attrs) { - if (force_dma_unencrypted(dev)) - prot = pgprot_decrypted(prot); if (dev_is_dma_coherent(dev)) return prot; #ifdef CONFIG_ARCH_HAS_DMA_WRITE_COMBINE -- cgit v1.2.3