linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: disable MMID if GINVT is not usable
@ 2025-06-25 13:27 Gregory CLEMENT
  2025-06-25 14:44 ` Jiaxun Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Gregory CLEMENT @ 2025-06-25 13:27 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Vladimir Kondratiev, Théo Lebrun, Tawfik Bayouk,
	Thomas Petazzoni, linux-mips, linux-kernel, Gregory CLEMENT

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: disable MMID if GINVT is not usable
  2025-06-25 13:27 [PATCH] MIPS: disable MMID if GINVT is not usable Gregory CLEMENT
@ 2025-06-25 14:44 ` Jiaxun Yang
  2025-07-02 12:08   ` Thomas Bogendoerfer
  0 siblings, 1 reply; 4+ messages in thread
From: Jiaxun Yang @ 2025-06-25 14:44 UTC (permalink / raw)
  To: Gregory CLEMENT, Thomas Bogendoerfer
  Cc: Vladimir Kondratiev, Théo Lebrun, Tawfik Bayouk,
	Thomas Petazzoni, linux-mips@vger.kernel.org, linux-kernel

在2025年6月25日周三 下午2:27,Gregory CLEMENT写道:

Hi Gregory,

> 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.

Yes, it is the case if the NoC IP can't handle AMBA ACE DVM requests.

>
> 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
> +

I believe this should be a DeviceTree property of CM node instead of Kconfig
hack.

Thanks

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: disable MMID if GINVT is not usable
  2025-06-25 14:44 ` Jiaxun Yang
@ 2025-07-02 12:08   ` Thomas Bogendoerfer
  2025-07-04 15:17     ` Gregory CLEMENT
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bogendoerfer @ 2025-07-02 12:08 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Gregory CLEMENT, Vladimir Kondratiev, Théo Lebrun,
	Tawfik Bayouk, Thomas Petazzoni, linux-mips@vger.kernel.org,
	linux-kernel

On Wed, Jun 25, 2025 at 03:44:00PM +0100, Jiaxun Yang wrote:
> 在2025年6月25日周三 下午2:27,Gregory CLEMENT写道:
> 
> Hi Gregory,
> 
> > 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.
> 
> Yes, it is the case if the NoC IP can't handle AMBA ACE DVM requests.
> 
> >
> > 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
> > +
> 
> I believe this should be a DeviceTree property of CM node instead of Kconfig
> hack.

Either that or by a runtime check, if possible.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: disable MMID if GINVT is not usable
  2025-07-02 12:08   ` Thomas Bogendoerfer
@ 2025-07-04 15:17     ` Gregory CLEMENT
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory CLEMENT @ 2025-07-04 15:17 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jiaxun Yang
  Cc: Vladimir Kondratiev, Théo Lebrun, Tawfik Bayouk,
	Thomas Petazzoni, linux-mips@vger.kernel.org, linux-kernel

Thomas Bogendoerfer <tsbogend@alpha.franken.de> writes:

> On Wed, Jun 25, 2025 at 03:44:00PM +0100, Jiaxun Yang wrote:
>> 在2025年6月25日周三 下午2:27,Gregory CLEMENT写道:
>> 
>> Hi Gregory,
>> 
>> > 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.
>> 
>> Yes, it is the case if the NoC IP can't handle AMBA ACE DVM requests.
>> 
>> >
>> > 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
>> > +
>> 
>> I believe this should be a DeviceTree property of CM node instead of Kconfig
>> hack.
>
> Either that or by a runtime check, if possible.

Unfortunately we can't detect at runtime this (lack of) feature on the
NoC, so it has to be a device tree property.

Gregory

>
> Thomas.
>
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-04 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 13:27 [PATCH] MIPS: disable MMID if GINVT is not usable Gregory CLEMENT
2025-06-25 14:44 ` Jiaxun Yang
2025-07-02 12:08   ` Thomas Bogendoerfer
2025-07-04 15:17     ` Gregory CLEMENT

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).