Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp214071ybb; Thu, 9 Apr 2020 21:24:40 -0700 (PDT) X-Google-Smtp-Source: APiQypKVtxDoOBkkM8GYSgxF/lDkD6gH13jrA2Y6HbIVl1kXrtb4AH8UvQAe65WzTa9z4MjzErHB X-Received: by 2002:ae9:ec0c:: with SMTP id h12mr2377140qkg.232.1586492680020; Thu, 09 Apr 2020 21:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586492680; cv=none; d=google.com; s=arc-20160816; b=iyxGJo4QffhwI8Idyt3Cx3jhbFOhAeu2/SLEQOeyp44ZK4ER8EaWvmbVe+j4aWFee+ ZAzU+2oBQhQWnRX857vaCfNGi2tRgs0meL6LXM/lw09kd3WAVNmHZnntC1PZvKDVAzXP WfFJWu2iw89We/Xz/+yWwDyBiF1SLPn4M5ByHTvBLV/V10X4i/fmMiuESIVQkR/lzYpp YpFrrNXPJAdgcBkq4mPxD5VIClKuDc3MGuTBDVdMo1w00Cv9fYRAyNLi/Y5nbxQvi4Mk qepbmDecxwwMZRC0QoDcMgA+pB0I+4Qx5jrK0xawjJxH6GJNIpwaRJQaEP4yAm+Pxqsl YaHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SwcFG6Shj3gv3gX5nsm9G0gUmlBVmM+/0TXu9yOfkFU=; b=wwgAK4Zd993B2TWpvHwt57wf10RzdJURfUPJB+u6VSds02+LLJ4HJw2hQ3BZlCTJy5 l0KrfwlqE9fpLXsYWZqqqSk5Q2Mz3bK0h2ECtONh1zTSja4WHDY76tC2VWU/m/z8ZuIT Fd/j67X27kEhTTWEHx2aCE2G8UzGHfpaKhCS9x3iKkxrFUnK/CQlKLmCfbfrhal2WL0n 2MMgjU3OIxqz+vKPzwqnVBqR64Zx0bqyGoVIjE/yA7XSIFqJARsvjQ/Zf8GVWSpbQRBt KOIS8z5y3gCFk/b7GvMoDPm86PaikV0cRbCrvcbHi5MblpHm35FInPsv2dQZT/uyYBNQ GEkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=pic header.b=IwGeZBmw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t186si729450qkb.61.2020.04.09.21.24.22; Thu, 09 Apr 2020 21:24:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@flygoat.com header.s=pic header.b=IwGeZBmw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725844AbgDJEXi (ORCPT + 99 others); Fri, 10 Apr 2020 00:23:38 -0400 Received: from m228-4.mailgun.net ([159.135.228.4]:29908 "EHLO m228-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbgDJEXi (ORCPT ); Fri, 10 Apr 2020 00:23:38 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=flygoat.com; q=dns/txt; s=pic; t=1586492612; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-ID: Subject: Cc: To: From: Date: Sender; bh=SwcFG6Shj3gv3gX5nsm9G0gUmlBVmM+/0TXu9yOfkFU=; b=IwGeZBmwtx2np0rU/Vyplh7WgY8lltyq55wvH7Wiek3boOr3fTg/tb1UXaYDhyhMTFDCs6ic Y7tRGrmgiASzOq3zlPOa1SS9/rpyI2WSl5TFrp6OR4mTLCLNPpzZmcloqCIys/7oGkG2/7JX jFR9R9ULM6lGwUNbaDLEVI8wUTI= X-Mailgun-Sending-Ip: 159.135.228.4 X-Mailgun-Sid: WyJlMmQxMiIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImQ1YjMwNGEiXQ== Received: from flygoat-x1e (Unknown [122.235.212.87]) by mxa.mailgun.org with ESMTP id 5e8ff380.7fec9ece29f0-smtp-out-n03; Fri, 10 Apr 2020 04:18:08 -0000 (UTC) Date: Fri, 10 Apr 2020 12:18:01 +0800 From: Jiaxun Yang To: Tiezhu Yang Cc: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , "Maciej W. Rozycki" Subject: Re: [PATCH v2] MIPS: Limit check_bugs32() to affected platform Message-ID: <20200410121801.47c927bd@flygoat-x1e> In-Reply-To: <1586488859-18715-1-git-send-email-yangtiezhu@loongson.cn> References: <1586488859-18715-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Apr 2020 11:20:59 +0800 Tiezhu Yang wrote: > In the current code, check_bugs32() only handles MIPS32 CPU type > CPU_34K, it is better to build and call it on the affected platform. > > Move check_bugs32() to the new added 34k-bugs32.c to indicate the > fact that the code is specific to the 34k CPU, and also add > CONFIG_CPU_34K_BUGS32 to control whether or not check the bugs. Reviewed-by: Jiaxun Yang +Maciej, that's basically my intention. Thanks. > > Signed-off-by: Tiezhu Yang > --- > > v2: > - Add new 34k-bugs32.c > - Rename check_errata() to check_errata32() > - Add CONFIG_CPU_34K_BUGS32 > - Modify commit message > > arch/mips/Kconfig | 4 ++++ > arch/mips/include/asm/bugs.h | 4 +++- > arch/mips/kernel/34k-bugs32.c | 29 +++++++++++++++++++++++++++++ > arch/mips/kernel/Makefile | 1 + > arch/mips/kernel/cpu-probe.c | 25 ------------------------- > 5 files changed, 37 insertions(+), 26 deletions(-) > create mode 100644 arch/mips/kernel/34k-bugs32.c > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > index a1f973c..d95dc18 100644 > --- a/arch/mips/Kconfig > +++ b/arch/mips/Kconfig > @@ -2619,6 +2619,10 @@ config CPU_R4X00_BUGS64 > bool > default y if SYS_HAS_CPU_R4X00 && 64BIT && (TARGET_ISA_REV < > 1) > +config CPU_34K_BUGS32 > + bool > + default y if CPU_MIPS32_R2 > + > config MIPS_ASID_SHIFT > int > default 6 if CPU_R3000 || CPU_TX39XX > diff --git a/arch/mips/include/asm/bugs.h > b/arch/mips/include/asm/bugs.h index d72dc6e..bbf843a 100644 > --- a/arch/mips/include/asm/bugs.h > +++ b/arch/mips/include/asm/bugs.h > @@ -35,7 +35,9 @@ static inline void check_bugs(void) > unsigned int cpu = smp_processor_id(); > > cpu_data[cpu].udelay_val = loops_per_jiffy; > - check_bugs32(); > + > + if (IS_ENABLED(CONFIG_CPU_34K_BUGS32)) > + check_bugs32(); > > if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) > check_bugs64(); > diff --git a/arch/mips/kernel/34k-bugs32.c > b/arch/mips/kernel/34k-bugs32.c new file mode 100644 > index 0000000..dc3ac01 > --- /dev/null > +++ b/arch/mips/kernel/34k-bugs32.c > @@ -0,0 +1,29 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include > +#include > +#include > +#include > + > +static inline void check_errata32(void) > +{ > + struct cpuinfo_mips *c = ¤t_cpu_data; > + > + switch (current_cpu_type()) { > + case CPU_34K: > + /* > + * Erratum "RPS May Cause Incorrect Instruction > Execution" > + * This code only handles VPE0, any SMP/RTOS code > + * making use of VPE1 will be responsable for that > VPE. > + */ > + if ((c->processor_id & PRID_REV_MASK) <= > PRID_REV_34K_V1_0_2) > + write_c0_config7(read_c0_config7() | > MIPS_CONF7_RPS); > + break; > + default: > + break; > + } > +} > + > +void __init check_bugs32(void) > +{ > + check_errata32(); > +} > diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile > index d6e97df..c2fd191 100644 > --- a/arch/mips/kernel/Makefile > +++ b/arch/mips/kernel/Makefile > @@ -81,6 +81,7 @@ obj-$(CONFIG_PROC_FS) += proc.o > obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o > > obj-$(CONFIG_CPU_R4X00_BUGS64) += r4k-bugs64.o > +obj-$(CONFIG_CPU_34K_BUGS32) += 34k-bugs32.o > > obj-$(CONFIG_I8253) += i8253.o > > diff --git a/arch/mips/kernel/cpu-probe.c > b/arch/mips/kernel/cpu-probe.c index f21a230..7179787 100644 > --- a/arch/mips/kernel/cpu-probe.c > +++ b/arch/mips/kernel/cpu-probe.c > @@ -14,7 +14,6 @@ > #include > #include > > -#include > #include > #include > #include > @@ -461,30 +460,6 @@ static inline void cpu_set_mt_per_tc_perf(struct > cpuinfo_mips *c) c->options |= MIPS_CPU_MT_PER_TC_PERF_COUNTERS; > } > > -static inline void check_errata(void) > -{ > - struct cpuinfo_mips *c = ¤t_cpu_data; > - > - switch (current_cpu_type()) { > - case CPU_34K: > - /* > - * Erratum "RPS May Cause Incorrect Instruction > Execution" > - * This code only handles VPE0, any SMP/RTOS code > - * making use of VPE1 will be responsable for that > VPE. > - */ > - if ((c->processor_id & PRID_REV_MASK) <= > PRID_REV_34K_V1_0_2) > - write_c0_config7(read_c0_config7() | > MIPS_CONF7_RPS); > - break; > - default: > - break; > - } > -} > - > -void __init check_bugs32(void) > -{ > - check_errata(); > -} > - > /* > * Probe whether cpu has config register by trying to play with > * alternate cache bit and see whether it matters.