LoongArch: Add writecombine support for drm
ANBZ: #5200
commit 439057ec3b
upstream.
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 <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Xuefeng Li <lixuefeng@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Juxin Gao <gaojuxin@loongson.cn>
Link: https://gitee.com/anolis/cloud-kernel/pulls/1830
This commit is contained in:
parent
347f18c7ed
commit
13dadde176
|
@ -74,7 +74,7 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
|
|||
tmp = pgprot_decrypted(tmp);
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
|
||||
defined(__mips__)
|
||||
defined(__mips__) || defined(__loongarch__)
|
||||
if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING))
|
||||
tmp = pgprot_noncached(tmp);
|
||||
else
|
||||
|
|
|
@ -397,7 +397,7 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
|
|||
tmp = pgprot_noncached(tmp);
|
||||
#endif
|
||||
#if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
|
||||
defined(__powerpc__) || defined(__mips__)
|
||||
defined(__powerpc__) || defined(__mips__) || defined(__loongarch__)
|
||||
if (caching_flags & TTM_PL_FLAG_WC)
|
||||
tmp = pgprot_writecombine(tmp);
|
||||
else
|
||||
|
|
|
@ -65,6 +65,14 @@ static inline bool drm_arch_can_wc_memory(void)
|
|||
* optimization entirely for ARM and arm64.
|
||||
*/
|
||||
return false;
|
||||
#elif defined(CONFIG_LOONGARCH)
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue