Skip to contentSkip to conversation

drm: fallback to dma_alloc_coherent when memory encryption is active

PATCH In review Christian König 2 participants 2 messages Mar 13, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/drm_memory.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_memory.c +7 -0
index 8dbcdc77f6bf..132fef8ff1b6 100644
@@ -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);
 	}
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christian König

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

Quoted 25 lines
---
 drivers/gpu/drm/drm_memory.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_memory.c +7 -1
index 8dbcdc77f6bf..132fef8ff1b6 100644
@@ -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

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel