Skip to content

Commit

Permalink
drm: fallback to dma_alloc_coherent when memory encryption is active
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
Christian König committed Apr 1, 2019
1 parent 088aed8 commit 64e1f83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/gpu/drm/drm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 64e1f83

Please sign in to comment.