[PATCH] [RFC] etnaviv: Don't apply pgprot_noncached for ETNA_BO_UNCACHED

Guido Günther agx at sigxcpu.org
Thu Sep 13 18:00:28 UTC 2018


Hi,
On arm64 userspace does not seem to be able to mmap memory marked as
pgprot_noncached(nGnRnE) or pgprot_device(nGnRE). I've worked around
this by treating it as write combined (see below) but wonder what the
right fix would look like? I looked around for similar cases but didn't
find anything that looked useful to me.

omap seems to use the same code so likely suffers from the same problem.

Cheers,
 -- Guido

---
 drivers/gpu/drm/etnaviv/etnaviv_gem.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 209ef1274b80..1b2ac7311232 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -133,10 +133,8 @@ static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
 
 	vm_page_prot = vm_get_page_prot(vma->vm_flags);
 
-	if (etnaviv_obj->flags & ETNA_BO_WC) {
+	if (etnaviv_obj->flags & (ETNA_BO_WC | ETNA_BO_UNCACHED)) {
 		vma->vm_page_prot = pgprot_writecombine(vm_page_prot);
-	} else if (etnaviv_obj->flags & ETNA_BO_UNCACHED) {
-		vma->vm_page_prot = pgprot_noncached(vm_page_prot);
 	} else {
 		/*
 		 * Shunt off cached objs to shmem file so they have their own
-- 
2.18.0


More information about the etnaviv mailing list