Discussion:
[PATCH] MIPS: Kconfig: microMIPS and SmartMIPS are mutually exclusive
Markos Chandras
2014-06-03 08:46:17 UTC
Permalink
Fixes the following build problem on randconfig:

Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'

Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
Reviewed-by: Steven J. Hill <***@imgtec.com>
Signed-off-by: Markos Chandras <***@imgtec.com>
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2fe8e60..ffde3d6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2063,7 +2063,7 @@ config ARCH_PHYS_ADDR_T_64BIT
def_bool 64BIT_PHYS_ADDR

config CPU_HAS_SMARTMIPS
- depends on SYS_SUPPORTS_SMARTMIPS
+ depends on SYS_SUPPORTS_SMARTMIPS && !CPU_MICROMIPS
bool "Support for the SmartMIPS ASE"
help
SmartMIPS is a extension of the MIPS32 architecture aimed at
--
1.9.3
Ralf Baechle
2014-06-03 09:34:34 UTC
Permalink
Post by Markos Chandras
Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'
Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2fe8e60..ffde3d6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2063,7 +2063,7 @@ config ARCH_PHYS_ADDR_T_64BIT
def_bool 64BIT_PHYS_ADDR
config CPU_HAS_SMARTMIPS
- depends on SYS_SUPPORTS_SMARTMIPS
+ depends on SYS_SUPPORTS_SMARTMIPS && !CPU_MICROMIPS
bool "Support for the SmartMIPS ASE"
help
SmartMIPS is a extension of the MIPS32 architecture aimed at
From a user's perspective that's a bit quirky; a user has to first
disable CPU_MICROMIPS before he can enable CPU_HAS_SMARTMIPS. So I
think this should become a choice statement.

Ralf
Markos Chandras
2014-06-03 09:45:38 UTC
Permalink
Post by Markos Chandras
Post by Markos Chandras
Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'
Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2fe8e60..ffde3d6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2063,7 +2063,7 @@ config ARCH_PHYS_ADDR_T_64BIT
def_bool 64BIT_PHYS_ADDR
config CPU_HAS_SMARTMIPS
- depends on SYS_SUPPORTS_SMARTMIPS
+ depends on SYS_SUPPORTS_SMARTMIPS && !CPU_MICROMIPS
bool "Support for the SmartMIPS ASE"
help
SmartMIPS is a extension of the MIPS32 architecture aimed at
From a user's perspective that's a bit quirky; a user has to first
disable CPU_MICROMIPS before he can enable CPU_HAS_SMARTMIPS. So I
think this should become a choice statement.
Ralf
James (now on CC) suggested the same thing and I told him that choice
statements make sense for symbols that are somehow related. For example
SMVP or SMTC or no-MT. In this case, these symbols totally different so
in my opinion a choice symbol will be rather confusing. But I will not
object. Whatever works best.
--
markos
Maciej W. Rozycki
2014-06-03 11:18:43 UTC
Permalink
Post by Ralf Baechle
Post by Markos Chandras
Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'
Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2fe8e60..ffde3d6 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2063,7 +2063,7 @@ config ARCH_PHYS_ADDR_T_64BIT
def_bool 64BIT_PHYS_ADDR
config CPU_HAS_SMARTMIPS
- depends on SYS_SUPPORTS_SMARTMIPS
+ depends on SYS_SUPPORTS_SMARTMIPS && !CPU_MICROMIPS
bool "Support for the SmartMIPS ASE"
help
SmartMIPS is a extension of the MIPS32 architecture aimed at
From a user's perspective that's a bit quirky; a user has to first
disable CPU_MICROMIPS before he can enable CPU_HAS_SMARTMIPS. So I
think this should become a choice statement.
Do we need this CPU_HAS_SMARTMIPS setting at all? Can't we just
save/restore this SmartMIPS ACX register on context switches where
available (straightforward to detect at the run time) and have the
relevant pieces of code excluded (#ifdef-ed out or suchlike) on
non-supported configurations such as microMIPS or MIPS64?

Maciej
Ralf Baechle
2014-06-03 12:24:51 UTC
Permalink
Post by Maciej W. Rozycki
Do we need this CPU_HAS_SMARTMIPS setting at all? Can't we just
save/restore this SmartMIPS ACX register on context switches where
available (straightforward to detect at the run time) and have the
relevant pieces of code excluded (#ifdef-ed out or suchlike) on
non-supported configurations such as microMIPS or MIPS64?
SmartMIPS has new instructions which are hardcoded in various assembler
fragments, where something like if (cpu_has_smartmips) won't work.
So until a more complex solution is implemented CPU_HAS_SMARTMIPS is
what there is.

Ralf
Maciej W. Rozycki
2014-06-03 13:56:50 UTC
Permalink
Post by Ralf Baechle
Post by Maciej W. Rozycki
Do we need this CPU_HAS_SMARTMIPS setting at all? Can't we just
save/restore this SmartMIPS ACX register on context switches where
available (straightforward to detect at the run time) and have the
relevant pieces of code excluded (#ifdef-ed out or suchlike) on
non-supported configurations such as microMIPS or MIPS64?
SmartMIPS has new instructions which are hardcoded in various assembler
fragments, where something like if (cpu_has_smartmips) won't work.
So until a more complex solution is implemented CPU_HAS_SMARTMIPS is
what there is.
Well:

.set push
.set smartmips
# Whatever SmartMIPS stuff.
.set pop

should do. It has been supported by GAS since forever (well, since it has
included SmartMIPS instructions that is, which is 2.18; to support older
versions we can use $(call as-instr,...) and some #ifdef-ry that we have
anyway). It's <asm/stackframe.h> only BTW for six instructions total.

So I think that is straightforward to implement and much more reasonable
than the hacks we have now. A SmartMIPS-enabled kernel doesn't even check
if the CPU it's run on implements the ASE so it'll just crash at some
point trying to execute MFLHXU or MTLHX if it does not -- and obviously if
two SmartMIPS user programs are run concurrently on a SmartMIPS-disabled
kernel and use the ACX register, then they will yield random results.

Maciej
Markos Chandras
2014-07-21 07:46:14 UTC
Permalink
microMIPS and SmartMIPS can't be used together. This fixes the
following build problem:

Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'

Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
Signed-off-by: Markos Chandras <***@imgtec.com>
---
Hi Ralf,

Here is v2 of that patch, making SmartMIPS and microMIPS a
choice symbol as you requested in
http://www.linux-mips.org/archives/linux-mips/2014-06/msg00011.html

However, I still feel this is wrong since these two ASEs are completely
unrelated. The v1 of the patch is probably better in my opinion.
If the user fails to find the 'smartmips' option due to having 'micromips'
enabled, he/she can always search for the 'smartmips' symbol in the
menuconfig and he/she will notice the dependency on !micromips.
And if the user knows what he is doing he will probably never want to
use 'smartmips' and 'micromips' together.
---

arch/mips/Kconfig | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 4e238e6e661c..f30a43a52a09 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2090,9 +2090,17 @@ config 64BIT_PHYS_ADDR
config ARCH_PHYS_ADDR_T_64BIT
def_bool 64BIT_PHYS_ADDR

+choice
+ prompt "SmartMIPS or microMIPS ASE support"
+
+config CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS
+ bool "None"
+ help
+ Select this if you want neither microMIPS nor SmartMIPS support
+
config CPU_HAS_SMARTMIPS
depends on SYS_SUPPORTS_SMARTMIPS
- bool "Support for the SmartMIPS ASE"
+ bool "SmartMIPS"
help
SmartMIPS is a extension of the MIPS32 architecture aimed at
increased security at both hardware and software level for
@@ -2104,11 +2112,13 @@ config CPU_HAS_SMARTMIPS

config CPU_MICROMIPS
depends on SYS_SUPPORTS_MICROMIPS
- bool "Build kernel using microMIPS ISA"
+ bool "microMIPS"
help
When this option is enabled the kernel will be built using the
microMIPS ISA

+endchoice
+
config CPU_HAS_MSA
bool "Support for the MIPS SIMD Architecture"
depends on CPU_SUPPORTS_MSA
--
2.0.0
Markos Chandras
2014-10-08 13:28:47 UTC
Permalink
Post by Markos Chandras
microMIPS and SmartMIPS can't be used together. This fixes the
Warning: the 32-bit microMIPS architecture does not support the `smartmips'
extension
arch/mips/kernel/entry.S:90: Error: unrecognized opcode `mtlhx $24'
[...]
arch/mips/kernel/entry.S:109: Error: unrecognized opcode `mtlhx $24'
Link: https://dmz-portal.mips.com/bugz/show_bug.cgi?id=1021
---
Hi Ralf,
Here is v2 of that patch, making SmartMIPS and microMIPS a
choice symbol as you requested in
http://www.linux-mips.org/archives/linux-mips/2014-06/msg00011.html
However, I still feel this is wrong since these two ASEs are completely
unrelated. The v1 of the patch is probably better in my opinion.
If the user fails to find the 'smartmips' option due to having 'micromips'
enabled, he/she can always search for the 'smartmips' symbol in the
menuconfig and he/she will notice the dependency on !micromips.
And if the user knows what he is doing he will probably never want to
use 'smartmips' and 'micromips' together.
---
Hi,

Any comments on that one?
--
markos
Loading...