Skip to content

Commit 630f472

Browse files
yanghaku6by9
authored andcommitted
drm/ttm: Use dmacoherent allocations on ARM64
Various PCIe controllers on ARM64 platforms don't support cache snooping, which leads to numerous issues when attempting to use PCIe graphics cards. Switching ttm_prot_from_caching to return pgprot_dmacoherent for ttm_cached pages solves the issue, albeit with a performance hit. There is a second check in ttm_prot_from_caching that also needs updating. Signed-off-by: Yang Bo <bo.yang@smail.nju.edu.cn> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent 025a969 commit 630f472

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

drivers/gpu/drm/ttm/ttm_bo_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ static int ttm_bo_kmap_ttm(struct ttm_buffer_object *bo,
359359
if (ret)
360360
return ret;
361361

362-
if (num_pages == 1 && ttm->caching == ttm_cached &&
362+
if (!IS_ENABLED(CONFIG_ARM64) &&
363+
num_pages == 1 && ttm->caching == ttm_cached &&
363364
!(man->use_tt && (ttm->page_flags & TTM_TT_FLAG_DECRYPTED))) {
364365
/*
365366
* We're mapping a single page, and the desired

drivers/gpu/drm/ttm/ttm_module.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp)
6363
{
6464
/* Cached mappings need no adjustment */
6565
if (caching == ttm_cached)
66+
#ifdef CONFIG_ARM64
67+
return pgprot_dmacoherent(tmp);
68+
#else
6669
return tmp;
70+
#endif
6771

6872
#if defined(__i386__) || defined(__x86_64__)
6973
if (caching == ttm_write_combined)

0 commit comments

Comments
 (0)