[PATCH] drm: fallback to dma_alloc_coherent when memory encryption is active

Christian König ckoenig.leichtzumerken at gmail.com
Wed Mar 13 09:20:52 UTC 2019


We can't just map any randome page we get when memory encryption is
active.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/gpu/drm/drm_memory.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 8dbcdc77f6bf..132fef8ff1b6 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -168,6 +168,13 @@ bool drm_need_swiotlb(int dma_bits)
 	if (xen_pv_domain())
 		return true;
 
+	/*
+	 * Enforce dma_alloc_coherent when memory encryption is active as well
+	 * for the same reasons as for Xen paravirtual hosts.
+	 */
+	if (mem_encrypt_active())
+		return true;
+
 	for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
 		max_iomem = max(max_iomem,  tmp->end);
 	}
-- 
2.17.1



More information about the dri-devel mailing list