[PATCH] MIPS: disable MMID if GINVT is not usable

Gregory CLEMENT posted 1 patch 3 months, 2 weeks ago
arch/mips/Kconfig                    | 6 ++++++
arch/mips/include/asm/cpu-features.h | 5 ++++-
arch/mips/mobileye/Kconfig           | 2 ++
3 files changed, 12 insertions(+), 1 deletion(-)
[PATCH] MIPS: disable MMID if GINVT is not usable
Posted by Gregory CLEMENT 3 months, 2 weeks ago
If System-level Interconnect (aka Network on Chip) does not support
the global invalidation, then MMID feature is not usable. Indeed the
current implementation of MMID relies on the GINV* instruction.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 arch/mips/Kconfig                    | 6 ++++++
 arch/mips/include/asm/cpu-features.h | 5 ++++-
 arch/mips/mobileye/Kconfig           | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 1e48184ecf1ec8e29c0a25de6452ece5da835e30..05ce008459b89f03fa71d94429607feb9d06526f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2575,6 +2575,12 @@ config WAR_R10000_LLSC
 config WAR_MIPS34K_MISSED_ITLB
 	bool
 
+# Some I6500 based SoC do not support the global invalidation on their
+# System-level Interconnect (aka Network on Chip), this have an
+# influence on the MMID support.
+config GINVT_UNSUPPORTED_NOC
+	bool
+
 #
 # - Highmem only makes sense for the 32-bit kernel.
 # - The current highmem code will only work properly on physically indexed
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 404390bb87eaf5b3391b3d38be7cd3e43849dde2..03cf5f8e8371afe553a40739fd64909d68427764 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -642,9 +642,12 @@
  * We only enable MMID support for configurations which natively support 64 bit
  * atomics because getting good performance from the allocator relies upon
  * efficient atomic64_*() functions.
+ * If System-level Interconnect (aka Network on Chip) does not support
+ * the global invalidation, then we also disable MMID support which
+ * needs to use GINV*
  */
 #ifndef cpu_has_mmid
-# ifdef CONFIG_GENERIC_ATOMIC64
+# if defined(CONFIG_GENERIC_ATOMIC64) || defined(CONFIG_GINVT_UNSUPPORTED_NOC)
 #  define cpu_has_mmid		0
 # else
 #  define cpu_has_mmid		__isa_ge_and_opt(6, MIPS_CPU_MMID)
diff --git a/arch/mips/mobileye/Kconfig b/arch/mips/mobileye/Kconfig
index f9abb2d6e1787dbc5a173db48606ed5a02088e41..06ae5327ff657e0c86e2eb9c7fbd760be8ae0d99 100644
--- a/arch/mips/mobileye/Kconfig
+++ b/arch/mips/mobileye/Kconfig
@@ -12,6 +12,8 @@ choice
 
 	config MACH_EYEQ6H
 		bool "Mobileye EyeQ6H SoC"
+		select GINVT_UNSUPPORTED_NOC
+
 endchoice
 
 config FIT_IMAGE_FDT_EPM5

---
base-commit: 86731a2a651e58953fc949573895f2fa6d456841
change-id: 20250625-mmid_disable_no_ginv_on_noc-6467e2985ad8

Best regards,
-- 
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com