summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kernel/setup.c
diff options
context:
space:
mode:
authorIcenowy Zheng <uwu@icenowy.me>2023-10-18 08:42:52 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2023-10-18 08:42:52 +0800
commit278be83601dd1725d4732241f066d528e160a39d (patch)
tree0027aaff07b4329c0186f6bbacc429fd636499e3 /arch/loongarch/kernel/setup.c
parent477a0ebec101359f49d92796e3b609857d564b52 (diff)
downloadlinux-278be83601dd1725d4732241f066d528e160a39d.tar.gz
linux-278be83601dd1725d4732241f066d528e160a39d.tar.bz2
linux-278be83601dd1725d4732241f066d528e160a39d.zip
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>
Diffstat (limited to 'arch/loongarch/kernel/setup.c')
-rw-r--r--arch/loongarch/kernel/setup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 7783f0a3d742..aed65915e932 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -161,19 +161,19 @@ static void __init smbios_parse(void)
}
#ifdef CONFIG_ARCH_WRITECOMBINE
-pgprot_t pgprot_wc = PAGE_KERNEL_WUC;
+bool wc_enabled = true;
#else
-pgprot_t pgprot_wc = PAGE_KERNEL_SUC;
+bool wc_enabled = false;
#endif
-EXPORT_SYMBOL(pgprot_wc);
+EXPORT_SYMBOL(wc_enabled);
static int __init setup_writecombine(char *p)
{
if (!strcmp(p, "on"))
- pgprot_wc = PAGE_KERNEL_WUC;
+ wc_enabled = true;
else if (!strcmp(p, "off"))
- pgprot_wc = PAGE_KERNEL_SUC;
+ wc_enabled = false;
else
pr_warn("Unknown writecombine setting \"%s\".\n", p);