Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1145274pxa; Thu, 6 Aug 2020 00:12:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYrerrFigyhpMt1IamM6UyVAego/oNfFrH4VYGJj0BBCCOeAJxUw3ew0AGCuvecuF4sj6G X-Received: by 2002:a17:906:841:: with SMTP id f1mr3094463ejd.158.1596697943494; Thu, 06 Aug 2020 00:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596697943; cv=none; d=google.com; s=arc-20160816; b=PXDPo+SOyH8TamPw88z+MSt3NzLuydZ9u60alSxCj1jEfcn58kjlCdeNvuVxxGt5ue +FWKB8K5xBNWMJ5iZVEVr86tqLeKlsd80Vs8WU0o4I/+NxoRCrPMMEdErkn9ikZHt6Cc Q+wmow4MyhnrqO3ZvZhEzFQcYRevYUuDiC9dZYFbczUDs9Y9ULc96Ms3/1Flt4KP6xxz 3LSkZAlt/GxTwUdD0LyqjX2vQ5b8+LaBiV2uu7GFPye4/EjYR9/7zjESIUC4SZk4UWEm E8dYIF7vNjf4zPocuDvIBfpxtF4O7TVlFgkxud8HWFOcyCmegsxNl46FSnZ55kdgt356 ckZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=42a/rMy5dEgYrVQgTqNaGuYsg/gxbOHbpUMC+358SRc=; b=zmWRlxpHVNhkeUEIECkavCSgSz8wNR7sroxWf50wRvOqHXz+VuJnD9bieZ+ewjZip/ njU+o0s1f6p0B59bE5oX9LLF7W9n6WhdptaDZMdK1QFoVfh1pYY1Ei4IhQZpPksBr68f qL9UN5iUJOUkBrwCwMSmrK/g9pOfNWhzFJ9unl9s6hpQ3bMp5n6gDqDl00RNY4FfIxtT KsKuTE7TXlccTquyAWwrCtYIBWlbUUgl/mHA53cAIHmcErWxbtVUzsYNV/ir+aXjybQk QtFU64dFsXs44KbSrRgv0WU2UhgBN4nONRBXYsu0AD/BpPk10BrVC7AjnSv6a32N+ela ZZEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c90si2628665edd.562.2020.08.06.00.12.01; Thu, 06 Aug 2020 00:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728526AbgHFHJU (ORCPT + 99 others); Thu, 6 Aug 2020 03:09:20 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47006 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728443AbgHFHJQ (ORCPT ); Thu, 6 Aug 2020 03:09:16 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxP9yNrCtfsTgFAA--.866S2; Thu, 06 Aug 2020 15:09:05 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer , Huacai Chen , Jiaxun Yang Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: Introduce cmdline argument writecombine= Date: Thu, 6 Aug 2020 15:09:01 +0800 Message-Id: <1596697741-3561-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9DxP9yNrCtfsTgFAA--.866S2 X-Coremail-Antispam: 1UD129KBjvJXoWxGFWUGFyrtw1ftr47CF48JFb_yoW5XrW7pF 4qk3Z7Gr4Fgw1vyF9xAr1jgrW5Zrn5AFZxJr4UCw18Zas0qr4kKFnaqrWaqF48XFyxJa48 tFWruFyUKw1Iy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyqb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwV C2z280aVCY1x0267AKxVWxJr0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r4j6F 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCF x2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14 v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY 67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2 IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AK xVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUy75rDUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Loongson processors have a writecombine issue that maybe failed to write back framebuffer used with ATI Radeon or AMD GPU at times, after commit 8a08e50cee66 ("drm: Permit video-buffers writecombine mapping for MIPS"), there exists some errors such as blurred screen and lockup, and so on. With this patch, disable writecombine by default for Loongson64 to work well with ATI Radeon or AMD GPU, and it has no influence on the other platforms due to writecombine is enabled by default. Additionally, if it is necessary, writecombine=on can be set manually in the cmdline to enhance the performance for Loongson LS7A integrated graphics in the future. [ 60.958721] radeon 0000:03:00.0: ring 0 stalled for more than 10079msec [ 60.965315] radeon 0000:03:00.0: GPU lockup (current fence id 0x0000000000000112 last fence id 0x000000000000011d on ring 0) [ 60.976525] radeon 0000:03:00.0: ring 3 stalled for more than 10086msec [ 60.983156] radeon 0000:03:00.0: GPU lockup (current fence id 0x0000000000000374 last fence id 0x00000000000003a8 on ring 3) Signed-off-by: Tiezhu Yang --- arch/mips/include/asm/pgtable.h | 4 ++++ arch/mips/kernel/cpu-probe.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index dd7a0f5..34869f7 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -473,6 +473,10 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) static inline pgprot_t pgprot_writecombine(pgprot_t _prot) { unsigned long prot = pgprot_val(_prot); + extern bool mips_writecombine; + + if (!mips_writecombine) + return pgprot_noncached(_prot); /* cpu_data[0].writecombine is already shifted by _CACHE_SHIFT */ prot = (prot & ~_CACHE_MASK) | cpu_data[0].writecombine; diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index e2955f1..98777ca 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -459,6 +459,25 @@ static int __init ftlb_disable(char *s) __setup("noftlb", ftlb_disable); +#ifdef CONFIG_MACH_LOONGSON64 +bool mips_writecombine; /* initialise to false by default */ +#else +bool mips_writecombine = true; +#endif +EXPORT_SYMBOL(mips_writecombine); + +static int __init writecombine_setup(char *str) +{ + if (strcmp(str, "on") == 0) + mips_writecombine = true; + else if (strcmp(str, "off") == 0) + mips_writecombine = false; + + return 1; +} + +__setup("writecombine=", writecombine_setup); + /* * Check if the CPU has per tc perf counters */ -- 2.1.0