diff options
author | Christian König <christian.koenig@amd.com> | 2019-03-13 12:11:19 +0300 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2019-04-01 12:43:42 +0300 |
commit | 64e1f830ea5b3516a4256ed1c504a265d7f2a65c (patch) | |
tree | 4f896326659882e997d76688ef658719b7874f7c /drivers/gpu/drm/drm_memory.c | |
parent | 088aed8bcab0fd63785144a0fdf53cbb6cee2ea8 (diff) | |
download | linux-64e1f830ea5b3516a4256ed1c504a265d7f2a65c.tar.xz |
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 <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.kernel.org/patch/10850833/
Diffstat (limited to 'drivers/gpu/drm/drm_memory.c')
-rw-r--r-- | drivers/gpu/drm/drm_memory.c | 7 |
1 files changed, 7 insertions, 0 deletions
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); } |