From: Christian König Date: Wed, 13 Mar 2019 09:11:19 +0000 (+0100) Subject: drm: fallback to dma_alloc_coherent when memory encryption is active X-Git-Tag: v5.2-rc1~118^2~29^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64e1f830ea5b3516a4256ed1c504a265d7f2a65c;p=thirdparty%2Fkernel%2Flinux.git drm: fallback to dma_alloc_coherent when memory encryption is active We can't just map any randome page we get when memory encryption is active. Signed-off-by: Christian König Acked-by: Alex Deucher Link: https://patchwork.kernel.org/patch/10850833/ --- diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c index 8dbcdc77f6bfb..132fef8ff1b65 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); }