Skip to content

Commit 439057e

Browse files
committed
LoongArch: Add writecombine support for drm
LoongArch maintains cache coherency in hardware, but its WUC attribute (Weak-ordered UnCached, which is similar to WC) is out of the scope of cache coherency machanism. This means WUC can only used for write-only memory regions. Cc: Daniel Vetter <[email protected]> Cc: [email protected] Reviewed-by: WANG Xuerui <[email protected]> Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 08145b0 commit 439057e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

drivers/gpu/drm/drm_vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
6969
pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
7070

7171
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
72-
defined(__mips__)
72+
defined(__mips__) || defined(__loongarch__)
7373
if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING))
7474
tmp = pgprot_noncached(tmp);
7575
else

drivers/gpu/drm/ttm/ttm_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp)
7474
#endif /* CONFIG_UML */
7575
#endif /* __i386__ || __x86_64__ */
7676
#if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
77-
defined(__powerpc__) || defined(__mips__)
77+
defined(__powerpc__) || defined(__mips__) || defined(__loongarch__)
7878
if (caching == ttm_write_combined)
7979
tmp = pgprot_writecombine(tmp);
8080
else

include/drm/drm_cache.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ static inline bool drm_arch_can_wc_memory(void)
6767
* optimization entirely for ARM and arm64.
6868
*/
6969
return false;
70+
#elif defined(CONFIG_LOONGARCH)
71+
/*
72+
* LoongArch maintains cache coherency in hardware, but its WUC attribute
73+
* (Weak-ordered UnCached, which is similar to WC) is out of the scope of
74+
* cache coherency machanism. This means WUC can only used for write-only
75+
* memory regions.
76+
*/
77+
return false;
7078
#else
7179
return true;
7280
#endif

0 commit comments

Comments
 (0)