mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
drm/etnaviv: Fix page property being used for non writecombine buffers
[ Upstream commit 834f304192834d6f0941954f3277ae0ba11a9a86 ]
In the etnaviv_gem_vmap_impl() function, the driver vmap whatever buffers
with write combine(WC) page property, this is incorrect. Cached buffers
should be mapped with the cached page property and uncached buffers should
be mapped with the uncached page property.
Fixes: a0a5ab3e99 ("drm/etnaviv: call correct function when trying to vmap a DMABUF")
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cd2f69b23f
commit
0720c5312b
@@ -342,6 +342,7 @@ void *etnaviv_gem_vmap(struct drm_gem_object *obj)
|
||||
static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj)
|
||||
{
|
||||
struct page **pages;
|
||||
pgprot_t prot;
|
||||
|
||||
lockdep_assert_held(&obj->lock);
|
||||
|
||||
@@ -349,8 +350,19 @@ static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj)
|
||||
if (IS_ERR(pages))
|
||||
return NULL;
|
||||
|
||||
return vmap(pages, obj->base.size >> PAGE_SHIFT,
|
||||
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
|
||||
switch (obj->flags & ETNA_BO_CACHE_MASK) {
|
||||
case ETNA_BO_CACHED:
|
||||
prot = PAGE_KERNEL;
|
||||
break;
|
||||
case ETNA_BO_UNCACHED:
|
||||
prot = pgprot_noncached(PAGE_KERNEL);
|
||||
break;
|
||||
case ETNA_BO_WC:
|
||||
default:
|
||||
prot = pgprot_writecombine(PAGE_KERNEL);
|
||||
}
|
||||
|
||||
return vmap(pages, obj->base.size >> PAGE_SHIFT, VM_MAP, prot);
|
||||
}
|
||||
|
||||
static inline enum dma_data_direction etnaviv_op_to_dma_dir(u32 op)
|
||||
|
||||
Reference in New Issue
Block a user