]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm: fallback to dma_alloc_coherent when memory encryption is active
authorChristian König <christian.koenig@amd.com>
Wed, 13 Mar 2019 09:11:19 +0000 (10:11 +0100)
committerChristian König <christian.koenig@amd.com>
Mon, 1 Apr 2019 09:43:42 +0000 (11:43 +0200)
We can't just map any randome page we get when memory encryption is
active.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.kernel.org/patch/10850833/
drivers/gpu/drm/drm_memory.c

index 8dbcdc77f6bfb7c1332445adca706e5894ac5f53..132fef8ff1b65f1776459d5d864808c87de9d0eb 100644 (file)
@@ -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);
        }