linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>
Subject: Re: [PATCH v2] MIPS: Limit check_bugs32() to affected platform
Date: Sat, 11 Apr 2020 10:32:02 +0800	[thread overview]
Message-ID: <181cf95e-c5f6-3899-e8eb-3f8847ec86d9@loongson.cn> (raw)
In-Reply-To: <c60f62cb-62e8-be13-f551-c9a13abc7f94@gmail.com>

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 <yangtiezhu@loongson.cn>
> 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 = &current_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 = &current_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


  reply	other threads:[~2020-04-11  2:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10  3:20 [PATCH v2] MIPS: Limit check_bugs32() to affected platform Tiezhu Yang
2020-04-10  4:18 ` Jiaxun Yang
2020-04-10  8:36 ` Jiaxun Yang
2020-04-10 16:25 ` Florian Fainelli
2020-04-11  2:32   ` Tiezhu Yang [this message]
2020-04-14 17:32     ` Thomas Bogendoerfer
2020-04-15  1:48       ` Tiezhu Yang
2020-04-15  8:31         ` Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=181cf95e-c5f6-3899-e8eb-3f8847ec86d9@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).