Skip to content

Commit 24ded29

Browse files
author
Oleksandr Andrushchenko
committed
drm/xen-front: Fix mmap attributes for display buffers
When GEM backing storage is allocated those are normal pages, so there is no point using pgprot_writecombine while mmaping. This fixes mismatch of buffer pages' memory attributes between the frontend and backend which may cause screen artifacts. Fixes: c575b7e ("drm/xen-front: Add support for Xen PV display frontend") Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Suggested-by: Julien Grall <julien.grall@arm.com> Acked-by: Julien Grall <julien.grall@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190129150422.19867-1-andr2000@gmail.com
1 parent 938010a commit 24ded29

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/gpu/drm/xen/xen_drm_front_gem.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,14 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj,
235235
vma->vm_flags &= ~VM_PFNMAP;
236236
vma->vm_flags |= VM_MIXEDMAP;
237237
vma->vm_pgoff = 0;
238-
vma->vm_page_prot =
239-
pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
238+
/*
239+
* According to Xen on ARM ABI (xen/include/public/arch-arm.h):
240+
* all memory which is shared with other entities in the system
241+
* (including the hypervisor and other guests) must reside in memory
242+
* which is mapped as Normal Inner Write-Back Outer Write-Back
243+
* Inner-Shareable.
244+
*/
245+
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
240246

241247
/*
242248
* vm_operations_struct.fault handler will be called if CPU access
@@ -282,8 +288,9 @@ void *xen_drm_front_gem_prime_vmap(struct drm_gem_object *gem_obj)
282288
if (!xen_obj->pages)
283289
return NULL;
284290

291+
/* Please see comment in gem_mmap_obj on mapping and attributes. */
285292
return vmap(xen_obj->pages, xen_obj->num_pages,
286-
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
293+
VM_MAP, PAGE_KERNEL);
287294
}
288295

289296
void xen_drm_front_gem_prime_vunmap(struct drm_gem_object *gem_obj,

0 commit comments

Comments
 (0)