Skip to content

Commit

Permalink
drm/ttm: ioremap buffer according to TTM mem caching setting
Browse files Browse the repository at this point in the history
If tbo.mem.bus.caching is cached, buffer is intended to be mapped
as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped
as cached from CPU side. It becomes necessary for aldebaran as
device memory is mapped cached from CPU.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Christian Konig <Christian.Koenig@amd.com>
  • Loading branch information
oakzeng authored and intel-lab-lkp committed Mar 1, 2021
1 parent ed428ff commit 225bb37
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/gpu/drm/ttm/ttm_bo_util.c
Expand Up @@ -91,6 +91,8 @@ static int ttm_resource_ioremap(struct ttm_bo_device *bdev,

if (mem->bus.caching == ttm_write_combined)
addr = ioremap_wc(mem->bus.offset, bus_size);
else if (mem->bus.caching == ttm_cached)
addr = ioremap_cache(mem->bus.offset, bus_size);
else
addr = ioremap(mem->bus.offset, bus_size);
if (!addr) {
Expand Down Expand Up @@ -373,6 +375,9 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
if (mem->bus.caching == ttm_write_combined)
map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
size);
else if (mem->bus.caching == ttm_cached)
map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
size);
else
map->virtual = ioremap(bo->mem.bus.offset + offset,
size);
Expand Down Expand Up @@ -491,6 +496,9 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
else if (mem->bus.caching == ttm_write_combined)
vaddr_iomem = ioremap_wc(mem->bus.offset,
bo->base.size);
else if (mem->bus.caching == ttm_cached)
vaddr_iomem = ioremap_cache(mem->bus.offset,
bo->base.size);
else
vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);

Expand Down

0 comments on commit 225bb37

Please sign in to comment.