LoongArch: Disable WUC for pgprot_writecombine() like ioremap_wc()
authorIcenowy Zheng <uwu@icenowy.me>
Wed, 18 Oct 2023 00:42:52 +0000 (08:42 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 18 Oct 2023 00:42:52 +0000 (08:42 +0800)
commit278be83601dd1725d4732241f066d528e160a39d
tree0027aaff07b4329c0186f6bbacc429fd636499e3
parent477a0ebec101359f49d92796e3b609857d564b52
LoongArch: Disable WUC for pgprot_writecombine() like ioremap_wc()

Currently the code disables WUC only disables it for ioremap_wc(), which
is only used when mapping writecombine pages like ioremap() (mapped to
the kernel space). But for VRAM mapped in TTM/GEM, it is mapped with a
crafted pgprot by the pgprot_writecombine() function, in which case WUC
isn't disabled now.

Disable WUC for pgprot_writecombine() (fallback to SUC) if needed, like
ioremap_wc().

This improves the AMDGPU driver's stability (solves some misrendering)
on Loongson-3A5000/3A6000 machines.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/io.h
arch/loongarch/include/asm/pgtable-bits.h
arch/loongarch/kernel/setup.c