diff mbox series

MIPS: select CPU_MIPS64 for remaining MIPS64 CPUs

Message ID 20210227122605.2680138-1-Jason@zx2c4.com (mailing list archive)
State Superseded
Headers show
Series MIPS: select CPU_MIPS64 for remaining MIPS64 CPUs | expand

Commit Message

Jason A. Donenfeld Feb. 27, 2021, 12:26 p.m. UTC
The CPU_MIPS64 and CPU_MIPS32 variables are supposed to be able to
distinguish broadly between 64-bit and 32-bit MIPS CPUs. However, they
weren't selected by the specialty CPUs, Octeon and Loongson, which meant
it was possible to hit a weird state of:

    MIPS=y, CONFIG_64BIT=y, CPU_MIPS64=n

This commit rectifies the issue by having CPU_MIPS64 be selected when
the missing Octeon or Loongson models are selected.

Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: George Cherian <gcherian@marvell.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/mips/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maciej W. Rozycki Feb. 27, 2021, 1:40 p.m. UTC | #1
On Sat, 27 Feb 2021, Jason A. Donenfeld wrote:

> The CPU_MIPS64 and CPU_MIPS32 variables are supposed to be able to
> distinguish broadly between 64-bit and 32-bit MIPS CPUs. However, they

 That is not true.  The purpose of these options is to identify MIPS64 and 
MIPS32 ISA processors respectively (and the generic features these ISAs 
imply).  There are 64-bit and 32-bit MIPS processors which do not qualify, 
specifically all MIPS I, MIPS II, MIPS III, and MIPS IV implementations.

> weren't selected by the specialty CPUs, Octeon and Loongson, which meant
> it was possible to hit a weird state of:
> 
>     MIPS=y, CONFIG_64BIT=y, CPU_MIPS64=n

 This is a correct combination for MIPS III and MIPS IV processors.

> This commit rectifies the issue by having CPU_MIPS64 be selected when
> the missing Octeon or Loongson models are selected.

 From the description and/or other options selected by CPU_LOONGSON64 and 
CPU_CAVIUM_OCTEON I infer the change itself is correct, so you only need 
to rewrite the change description.

 Though overall it seems we have quite a mess here, several other CPUs, 
such as at the very least CPU_XLR and CPU_XLP, do not select this option 
either, and then we have say CPU_MIPSR2 that is selected by some CPUs 
while being conditional on other ones.  All this stuff asks for being 
rewritten in a consistent manner.

 In any case your change may have to be run-time verified though with the 
respective processors.

  Maciej
Jason A. Donenfeld Feb. 27, 2021, 10:59 p.m. UTC | #2
On Sat, Feb 27, 2021 at 2:41 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> On Sat, 27 Feb 2021, Jason A. Donenfeld wrote:
>
> > The CPU_MIPS64 and CPU_MIPS32 variables are supposed to be able to
> > distinguish broadly between 64-bit and 32-bit MIPS CPUs. However, they
>
>  That is not true.  The purpose of these options is to identify MIPS64 and
> MIPS32 ISA processors respectively (and the generic features these ISAs
> imply).  There are 64-bit and 32-bit MIPS processors which do not qualify,
> specifically all MIPS I, MIPS II, MIPS III, and MIPS IV implementations.
>
> > weren't selected by the specialty CPUs, Octeon and Loongson, which meant
> > it was possible to hit a weird state of:
> >
> >     MIPS=y, CONFIG_64BIT=y, CPU_MIPS64=n
>
>  This is a correct combination for MIPS III and MIPS IV processors.
>
> > This commit rectifies the issue by having CPU_MIPS64 be selected when
> > the missing Octeon or Loongson models are selected.
>
>  From the description and/or other options selected by CPU_LOONGSON64 and
> CPU_CAVIUM_OCTEON I infer the change itself is correct, so you only need
> to rewrite the change description.

Indeed you're right. v2 on its way.

Jason
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d89efba3d8a4..3e0e8f1d2e82 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2118,7 +2118,7 @@  config CPU_MIPS32
 config CPU_MIPS64
 	bool
 	default y if CPU_MIPS64_R1 || CPU_MIPS64_R2 || CPU_MIPS64_R5 || \
-		     CPU_MIPS64_R6
+		     CPU_MIPS64_R6 || CPU_LOONGSON64 || CPU_CAVIUM_OCTEON
 
 #
 # These indicate the revision of the architecture