Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1173987ybb; Fri, 10 Apr 2020 19:34:25 -0700 (PDT) X-Google-Smtp-Source: APiQypK96ZcE6s5lie6OgTJ+1LfXal20N320gO7JGrkUkRszxBQjuOjlVt7BGbFDEEnyc4a1tP8i X-Received: by 2002:a0c:f806:: with SMTP id r6mr7481330qvn.24.1586572465563; Fri, 10 Apr 2020 19:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586572465; cv=none; d=google.com; s=arc-20160816; b=mZGxiq5ymkHe3B2wh8NaKOzXACibtuvn+TgzYznE3GUUC8vK6We4hMf4xU2iTilDsm 5ICcFtr2/xS380xFA73fD+NuHA80n1igFxhMkgg8S4wIRMj+Lg3Dprl8AuojkNA7QdGI PJXnpsJnhZAbqq67077sowM1b6OiMOQN25VAxOJcM+/araH2hc9cKENRcReHfw+UUgLF H13jHb3TzuF6FLsTB4IKJKshPIPCgfOJjXVG0MfsWecf3YdPtN2+2Wx3nQPAvpjQfIyc jXUOV248j0hYEuUzeY2DfqpCbrHCah5jcqpY9kvOOu0iDVyo0rguIH9jp5f5Vvh9rzS7 h3/Q== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=VzgbpTmHZvOABa+BjLMuTb0zqmDBMbZvyZRtWHj2nmE=; b=A706ypAg6VGvW39xcDujmHtFGivUu5npWXE8Znnb1qN0znlR10Gb3O0c2xt1Li7Fnu 0ChRbImp3gxQRKpEVW7gykTTECt5vpdf8dVwLZo9D8KG9v+PPRozRkCrofx3YJl1aVGE PTcQArOAufCvS6FRKEooU0mwZRhD7BmRCmmpdqbnYrApEqbjwTikK14tjCQ6EaCO5hQr yP5YUYUQRescxyZTsyByUGMoJo15/+rfIW+52yMb7TytTJobpORk8TVO1j7Q9Pdzxree 4om6lmUdH0JBKiofLyOH8aVNB1xkRdK7oC36vS/FDy2/vwQ6BxdQ4qyQhDhhbQ6vxqEj JeEQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s89si2055600qtd.387.2020.04.10.19.34.09; Fri, 10 Apr 2020 19:34:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726676AbgDKCcM (ORCPT + 99 others); Fri, 10 Apr 2020 22:32:12 -0400 Received: from mail.loongson.cn ([114.242.206.163]:50172 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726648AbgDKCcM (ORCPT ); Fri, 10 Apr 2020 22:32:12 -0400 Received: from [10.130.0.79] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxf2kiLJFegGsmAA--.15S3; Sat, 11 Apr 2020 10:32:04 +0800 (CST) Subject: Re: [PATCH v2] MIPS: Limit check_bugs32() to affected platform To: Florian Fainelli , Thomas Bogendoerfer References: <1586488859-18715-1-git-send-email-yangtiezhu@loongson.cn> Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li From: Tiezhu Yang Message-ID: <181cf95e-c5f6-3899-e8eb-3f8847ec86d9@loongson.cn> Date: Sat, 11 Apr 2020 10:32:02 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9Dxf2kiLJFegGsmAA--.15S3 X-Coremail-Antispam: 1UD129KBjvJXoWxAFy5Xry3Cr43GrWftFy3XFb_yoWrWr1xpF 4Dtw4kXF4DuFyktFWFyr1kGrWYq34DGrZ0kryjgay8AF45XFs8GFn3Kr45Ar17ZrySga4r ua9aqr1ftr42yaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvm14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j 6r4UM28EF7xvwVC2z280aVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4j6r 4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCYjI0SjxkI62AI1cAE67vI Y487MxkIecxEwVAFwVW8JwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnU UI43ZEXa7VUbYhF7UUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/2020 12:25 AM, Florian Fainelli wrote: > > On 4/9/2020 8:20 PM, 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. >> >> Signed-off-by: Tiezhu Yang > This is not a whole lot of code, so moving this to a separate > translation unit seems a bit heavy handed, also file renames, albeit > tracked properly by git are always a challenge when doing back ports. Hi Florian, There exists the following three ways to do it, I'm fine either way, maybe the first way looks better. Let us wait for the MIPS maintainer to say what he prefer. Hi Thomas, What is your opinion? 1 just use CONFIG_CPU_MIPS32_R2 diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h index d72dc6e..743604f 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_MIPS32_R2)) + check_bugs32(); if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) check_bugs64(); diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 6ab6b03..383500b 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -461,7 +461,8 @@ 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) +#ifdef CONFIG_CPU_MIPS32_R2 +static inline void check_errata32(void) { struct cpuinfo_mips *c = ¤t_cpu_data; @@ -482,8 +483,9 @@ static inline void check_errata(void) void __init check_bugs32(void) { - check_errata(); + check_errata32(); } +#endif /* CONFIG_CPU_MIPS32_R2 */ /* * Probe whether cpu has config register by trying to play with 2 add CONFIG_CPU_34K_BUGS32 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 797d7f1..e936e3c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2605,6 +2605,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/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 6ab6b03..670bc7c 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -461,7 +461,8 @@ 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) +#ifdef CONFIG_CPU_34K_BUGS32 +static inline void check_errata32(void) { struct cpuinfo_mips *c = ¤t_cpu_data; @@ -482,8 +483,9 @@ static inline void check_errata(void) void __init check_bugs32(void) { - check_errata(); + check_errata32(); } +#endif /* CONFIG_CPU_34K_BUGS32 */ /* * Probe whether cpu has config register by trying to play with 3 add new 34k-bugs32.c and CONFIG_CPU_34K_BUGS32 just as this v2 patch: https://lore.kernel.org/patchwork/patch/1222273/ Thanks, Tiezhu Yang