* [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
@ 2018-11-07 23:19 Paul Burton
2018-11-13 22:22 ` Paul Burton
2018-11-28 3:10 ` Maciej W. Rozycki
0 siblings, 2 replies; 6+ messages in thread
From: Paul Burton @ 2018-11-07 23:19 UTC (permalink / raw)
To: linux-mips@linux-mips.org; +Cc: Paul Burton
If we built the kernel targeting the microMIPS ISA then the very fact
that the kernel is running implies that the CPU supports microMIPS. Thus
we can hardcode cpu_has_mmips to 1 allowing the compiler greater scope
for optimisation due to the compile-time constant.
Signed-off-by: Paul Burton <paul.burton@mips.com>
---
arch/mips/include/asm/cpu-features.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 0edba3e75747..8669fdb503a5 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -195,7 +195,9 @@
#endif
#ifndef cpu_has_mmips
-# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
+# if defined(__mips_micromips)
+# define cpu_has_mmips 1
+# elif defined(CONFIG_SYS_SUPPORTS_MICROMIPS)
# define cpu_has_mmips __opt(MIPS_CPU_MICROMIPS)
# else
# define cpu_has_mmips 0
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
2018-11-07 23:19 [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels Paul Burton
@ 2018-11-13 22:22 ` Paul Burton
2018-11-13 22:22 ` Paul Burton
2018-11-28 3:10 ` Maciej W. Rozycki
1 sibling, 1 reply; 6+ messages in thread
From: Paul Burton @ 2018-11-13 22:22 UTC (permalink / raw)
To: Paul Burton
Cc: linux-mips@linux-mips.org, Paul Burton, linux-mips@linux-mips.org
Hello,
Paul Burton wrote:
> If we built the kernel targeting the microMIPS ISA then the very fact
> that the kernel is running implies that the CPU supports microMIPS. Thus
> we can hardcode cpu_has_mmips to 1 allowing the compiler greater scope
> for optimisation due to the compile-time constant.
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
2018-11-13 22:22 ` Paul Burton
@ 2018-11-13 22:22 ` Paul Burton
0 siblings, 0 replies; 6+ messages in thread
From: Paul Burton @ 2018-11-13 22:22 UTC (permalink / raw)
To: Paul Burton; +Cc: linux-mips@linux-mips.org
Hello,
Paul Burton wrote:
> If we built the kernel targeting the microMIPS ISA then the very fact
> that the kernel is running implies that the CPU supports microMIPS. Thus
> we can hardcode cpu_has_mmips to 1 allowing the compiler greater scope
> for optimisation due to the compile-time constant.
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
2018-11-07 23:19 [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels Paul Burton
2018-11-13 22:22 ` Paul Burton
@ 2018-11-28 3:10 ` Maciej W. Rozycki
2018-11-28 22:33 ` Paul Burton
1 sibling, 1 reply; 6+ messages in thread
From: Maciej W. Rozycki @ 2018-11-28 3:10 UTC (permalink / raw)
To: Paul Burton; +Cc: linux-mips@linux-mips.org, Paul Burton
On Wed, 7 Nov 2018, Paul Burton wrote:
> diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
> index 0edba3e75747..8669fdb503a5 100644
> --- a/arch/mips/include/asm/cpu-features.h
> +++ b/arch/mips/include/asm/cpu-features.h
> @@ -195,7 +195,9 @@
> #endif
>
> #ifndef cpu_has_mmips
> -# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
> +# if defined(__mips_micromips)
Wouldn't it be cleaner if it was written:
# if defined(CONFIG_CPU_MICROMIPS)
?
Maciej
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
2018-11-28 3:10 ` Maciej W. Rozycki
@ 2018-11-28 22:33 ` Paul Burton
2018-11-29 14:04 ` Maciej W. Rozycki
0 siblings, 1 reply; 6+ messages in thread
From: Paul Burton @ 2018-11-28 22:33 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: linux-mips@linux-mips.org, Paul Burton
Hi Maciej,
On Wed, Nov 28, 2018 at 03:10:53AM +0000, Maciej W. Rozycki wrote:
> On Wed, 7 Nov 2018, Paul Burton wrote:
>
> > diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
> > index 0edba3e75747..8669fdb503a5 100644
> > --- a/arch/mips/include/asm/cpu-features.h
> > +++ b/arch/mips/include/asm/cpu-features.h
> > @@ -195,7 +195,9 @@
> > #endif
> >
> > #ifndef cpu_has_mmips
> > -# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
> > +# if defined(__mips_micromips)
>
> Wouldn't it be cleaner if it was written:
>
> # if defined(CONFIG_CPU_MICROMIPS)
I suppose it's just a matter of preference - in practice both ought to
be defined or undefined at the same times. My personal preference is the
standard macro provided by the compiler, so that's what I used.
Thanks,
Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels
2018-11-28 22:33 ` Paul Burton
@ 2018-11-29 14:04 ` Maciej W. Rozycki
0 siblings, 0 replies; 6+ messages in thread
From: Maciej W. Rozycki @ 2018-11-29 14:04 UTC (permalink / raw)
To: Paul Burton; +Cc: linux-mips@linux-mips.org, Paul Burton
Hi Paul,
> > > -# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
> > > +# if defined(__mips_micromips)
> >
> > Wouldn't it be cleaner if it was written:
> >
> > # if defined(CONFIG_CPU_MICROMIPS)
>
> I suppose it's just a matter of preference - in practice both ought to
> be defined or undefined at the same times. My personal preference is the
> standard macro provided by the compiler, so that's what I used.
The minor difference as I see it is that CONFIG_CPU_MICROMIPS is ours
and the primary knob while `__mips_micromips' is GCC's. I don't see it as
a big problem if any at all, it's just my guts feeling.
Do we have a consistency check between the two macros anywhere?
Maciej
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-11-29 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07 23:19 [PATCH] MIPS: Hardcode cpu_has_mmips=1 for microMIPS kernels Paul Burton
2018-11-13 22:22 ` Paul Burton
2018-11-13 22:22 ` Paul Burton
2018-11-28 3:10 ` Maciej W. Rozycki
2018-11-28 22:33 ` Paul Burton
2018-11-29 14:04 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox