Based on https://github.com/geerlingguy/raspberry-pi-pcie-devices/discussions/756 Modified to upstream w/ CONFIG_X86 --- drivers/gpu/drm/ttm/ttm_bo_util.c | 14 +------------- drivers/gpu/drm/ttm/ttm_module.c | 5 +++++ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 0b3f4267130c..e0e55cb9edd2 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -343,8 +343,10 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, .no_wait_gpu = false }; struct ttm_tt *ttm = bo->ttm; +#if !defined(CONFIG_ARM64) struct ttm_resource_manager *man = ttm_manager_type(bo->bdev, bo->resource->mem_type); +#endif pgprot_t prot; int ret; @@ -354,17 +352,20 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo, if (ret) return ret; +#if !defined(CONFIG_ARM64) if (num_pages == 1 && ttm->caching == ttm_cached && !(man->use_tt && (ttm->page_flags & TTM_TT_FLAG_DECRYPTED))) { /* * We're mapping a single page, and the desired * page protection is consistent with the bo. */ map->bo_kmap_type = ttm_bo_map_kmap; map->page = ttm->pages[start_page]; map->virtual = kmap(map->page); - } else { + } else +#endif + { /* * We need to use vmap to get the desired page protection * or to make the buffer object look contiguous. diff --git a/drivers/gpu/drm/ttm/ttm_module.c b/drivers/gpu/drm/ttm/ttm_module.c index b3fffe7b5062..9f3e425626b5 100644 --- a/drivers/gpu/drm/ttm/ttm_module.c +++ b/drivers/gpu/drm/ttm/ttm_module.c @@ -63,7 +63,13 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp) { /* Cached mappings need no adjustment */ if (caching == ttm_cached) + { +#if !defined(CONFIG_ARM64) return tmp; +#else + return pgprot_dmacoherent(tmp); +#endif + } #if defined(__i386__) || defined(__x86_64__) if (caching == ttm_write_combined) -- 2.49.0