]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/ttm: add pgprot handling for RISC-V
authorIcenowy Zheng <uwu@icenowy.me>
Mon, 20 Oct 2025 05:35:23 +0000 (13:35 +0800)
committerChristian König <christian.koenig@amd.com>
Tue, 28 Oct 2025 08:19:46 +0000 (09:19 +0100)
The RISC-V Svpbmt privileged extension provides support for overriding
page memory coherency attributes, and, along with vendor extensions like
Xtheadmae, supports pgprot_{writecombine,noncached} on RISC-V.

Adapt the codepath that maps ttm_write_combined to pgprot_writecombine
and ttm_noncached to pgprot_noncached to RISC-V, to allow proper page
access attributes.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Tested-by: Han Gao <rabenda.cn@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20251020053523.731353-1-uwu@icenowy.me
drivers/gpu/drm/ttm/ttm_module.c

index b3fffe7b5062a9dd076a09d5b6099023006f19a3..aa137ead5cc596f5dfd249bcb908f6028b21ea35 100644 (file)
@@ -74,7 +74,8 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp)
 #endif /* CONFIG_UML */
 #endif /* __i386__ || __x86_64__ */
 #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
-       defined(__powerpc__) || defined(__mips__) || defined(__loongarch__)
+       defined(__powerpc__) || defined(__mips__) || defined(__loongarch__) || \
+       defined(__riscv)
        if (caching == ttm_write_combined)
                tmp = pgprot_writecombine(tmp);
        else